Remoing trunk dir
git-svn-id: https://svn.apache.org/repos/asf/lenya/tags/RELEASE_2_0_RC_4@603226 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/trunk/CREDITS.txt b/trunk/CREDITS.txt
deleted file mode 100644
index 26f85d8..0000000
--- a/trunk/CREDITS.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-
- C R E D I T S
-
-This is the file where major donations to the Lenya project are listed and it
-should be used to give appropriate visibility to those inviduals, organizations
-or companies that donated resources to the effort. This file wants to be one of
-the ways the Lenya community pays back.
-
-
- Community Credits
- =================
-
- Active Committers:
- ------------------
-
-* Doug Chestnut
-* Edith Chevrier
-* Dale Christ
-* Christian Egli
-* Jann Forrer
-* Antonio Gallardo
-* Andreas Hartmann Andreas runs the cocooncenter.org site.
-* Andreas Kuckartz Tester, Bugzilla reporter
-* Rolf Kulemann
-* Gregor J. Rothfuss
-* Thorsten Scherler
-* Torsten Schlabach
-* J. Wolfgang Kaltz
-* Michael Wechner
-
- Inactive Committers:
- --------------------
-
-* Juergen Bigalke wrote some creators.
-* Memo Birgi
-* Marc Liyanage wrote the first Lenya build system way back.
-* Felix Maeder
-* Rene Niedermowe
-* Giacomo Pati helped to port the predecessor of Lenya to Cocoon.
-
- Other Contributors:
- -------------------
-
-* Lon Boonen Lon is the original creator of Xopus and helped a
- lot to integrate it into Lenya. Recently he
- rewrote the JavaScript of the Lenya menubar.
-* Jose Chaso Spanish translation.
-* Paul Ercolino (solprovider) Refactored search, various small fixes
-* Stephen England Design of the Lenya logo, design of the Lenya UI.
-* Jorge Gutierrez Spanish translation.
-* Martin Hitz
-* Margrit John
-* Olivier Lange French translation.
-* Jean Pierre LeJacq Build system improvements.
-* Martin Lüthi Mail class.
-* Christian Stocker Christian is the original creator of the
- Bitflux Editor and helped a lot to integrate
- it into Lenya.
-* Urs Stöckli
-* Giampaolo Trapasso Italian translation, entertainer on #lenya
-* Markus Vaterlaus
-* Kars Veiling
-* Marc von Wattenwyl
-* Thomas Werschlein
-
-
- The Apache Lenya Community
- http://lenya.apache.org
diff --git a/trunk/INSTALL-BIN.txt b/trunk/INSTALL-BIN.txt
deleted file mode 100644
index bd49069..0000000
--- a/trunk/INSTALL-BIN.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-There is no binary release of Lenya 2.0 at this point.
-We recommend checking out the SVN repository instead (see INSTALL-SRC.txt).
diff --git a/trunk/INSTALL-SRC.txt b/trunk/INSTALL-SRC.txt
deleted file mode 100644
index 41bc75e..0000000
--- a/trunk/INSTALL-SRC.txt
+++ /dev/null
@@ -1,190 +0,0 @@
-# FIXME: this file duplicates the contents of
-# docu/src/documentation/content/xdocs/docs/2_0_x/installation/ (which is
-# currently out of date)
-# It would make a lot of sense to only maintain the xdocs and generate this
-# file with an xslt.
-
-Installation of the Source Version
-
- * Prerequisites
- * Standalone Installation (using the built-in Jetty)
- * Installation with Apache Tomcat
- * Security considerations
-
-Prerequisites
-
-
- The following list describes the setup that is tested and recommended.
- Please note that you can use other servlet containers as well, but Jetty and Tomcat are the tested ones.
-
-
- * Java 2 Platform, Standard Edition
- Recommended version: JDK 1.5 (used by most developers). Java 1.4.2 or later should also
- work, and people are using Java 1.6 successfully in day-to-day operation.
- Get the JDK at http://java.sun.com/javase/downloads/index_jdk5.jsp.
-
- WARNING: There have been numerous reports of spurious VM crashes with Java versions from
- 1.5.0-07 to 1.5.0-11 both on Windows and Linux. Make sure you are using the latest available Java
- 5 package for your operating system (-13 as of this writing).
- If you encounter such crashes with more current revisions, please re-open
- http://issues.apache.org/bugzilla/show_bug.cgi?id=42493 .
-
- * Apache Cocoon
- Recommended version: BRANCH_2_1_X (https://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X)
- When you check out the latest Lenya source from svn, Cocoon will be included as an svn external
- and you don't need to download it separately.
- Note that Cocoon is needed when building the source version of Lenya, but the
- resulting Lenya webapp is completely self contained and therefore it does not need
- the Cocoon webapp to be installed. See the FAQ for details of configuration changes
- required when running multiple Cocoon based applications.
-
- * A SVN client
- SVN (or subversion) is a software revision control system that is used by the Lenya community to
- manage the development tree. You will need to install a client in order to check out your local
- copy of Lenya.
- All Linux distributions come with svn (or subversion) packages. Under Windows, you can either use
- TortoiseSVN (see http://tortoisesvn.tigris.org) or the svn package included in Cygwin (http://cygwin.com).
-
- * (optional) Apache Tomcat for JDK 1.5, version: 5.5.20 or later (earlier versions may work as well,
- but they are not tested).
- Get the source at http://jakarta.apache.org/site/binindex.cgi
- Note that Lenya ships with Jetty and therefore does not need a servlet container to be installed.
-
-
-
-Standalone Installation (using the built-in Jetty)
-
-
- This is the recommended mode of installation that is used by most developers.
-
- 1. Get the Java SDK (see Prerequisites): e.g. J2SDK_1.5.0-11
- and set JAVA_HOME
- (Windows: start -> Control Panel -> System -> Advanced -> Environment Variables -> User variables
- ...)
-
- 2. Check out Apache Lenya from SVN:
- Change into the directory where you want your Lenya sources to be, and do
-
- svn checkout http://svn.apache.org/repos/asf/lenya/trunk lenya-2.0.x
-
- 3. Configure Lenya:
-
- In the newly created lenya-2.0.x directory, copy build.properties to local.build.properties
- and edit it to taste or use the configure script:
-
- * Linux: configure.sh (works also on Windows with Cygwin)
- * Windows: configure.bat
-
-
- 4. Build Lenya:
-
- Make sure that you have the environment variable JAVA_HOME defined to point
- to the location of the Java SDK you installed (see Prerequisites).
-
- MS Windows: http://support.microsoft.com/default.aspx?scid=kb;en-us;310519&sd=tech
- Linux/Unix: export JAVA_HOME=/usr/local/jdk-1.5.0 (or wherever your JDK is)
-
- Start the build process:
-
- * Linux: ./build.sh (works also on Windows with Cygwin)
- * Windows: build.bat
-
- 5. Start Lenya:
-
- * Linux: ./lenya.sh
- * Windows: lenya.bat
-
- 6. Test the installation by pointing your browser to
- http://localhost:8888/
-
-
-
-Installation with Apache Tomcat
-
-
- Watch out: Tomcat integration has not been tested much yet. You are welcome
- to direct questions at or point out problems to the lenya developer mailing
- list.
-
- Installing Lenya with Tomcat is similar to stand-alone mode. Follow Steps 1-3
- above, then do the steps below.
-
- 1. Get Apache Tomcat (see Prerequisites)
-
- 2. Install Apache Tomcat as per the Tomcat docs.
-
- Important: Make sure you do not install at a location with spaces in the path, such as
- C:\Tomcat Webapps\Lenya - some components in Lenya/Cocoon don't play well with such paths.
-
- 3. Configure Lenya for Tomcat
-
- Edit local.build.properties. For the described configuration the following settings
- will work (MS Windows: Don't use backslashes "\" for directory separation.) It is
- important that tomcat.home.dir is an absolute path. Replace $TOMCAT_HOME by your Tomcat
- installation directory. If your Cocoon source directory is not at ../cocoon
- relative to Lenya, then change the cocoon.webapp.dir and cocoon.src.dir properties.
- * cocoon.src.dir=$COCOON_HOME
- * tomcat.home.dir=$TOMCAT_HOME
-
- 4. Build Lenya (see "Standalone Installation" above)
-
- 5. Check versions of endorsed libraries
-
- Lenya and Tomcat will inter-operate correctly only if the proper versions of the Xalan
- and Xerces libraries are used consistently throughout the deployment. Unfortunately
- this can be difficult to get to work correctly since both of these libraries are shipped
- with Java 2 SDK, Tomcat, Cocoon and Lenya.
-
- The following libraries must be placed in the endorsed library directory for your deployment.
- * xalan-2.7.0.jar
- * xalan-2.7.0-serializer.jar
- * xerces-2.9.0-xercesImpl.jar
- * xerces-2.9.0-xml-apis.jar
-
- They are placed by the build process in the directory specified by tomcat.endorsed.dir in
- build.properties. You should validate that these files are indeed in the proper location
- for your deployment. You must then validate that no other instances of these libraries
- exist in any of the following directories:
- * The Java 2 SDK endorsed standards directories. This is usually ${JAVA_HOME}/lib/endorsed/.
- * Any other location in your Tomcat deployment. Specifically, check shared/lib/, common/lib/ and server/lib/.
- * Any other location in your Lenya deployment. Specifically, check webapps/lenya/WEB-INF/lib/.
-
- A common symptom of incorrect library version are blank pages after starting Lenya.
- Try carefully checking the location and version numbers of each of the libraries.
-
- References:
- * Tomcat Class Loader HOWTO
- (http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html)
- * Java 2 Endorsed Standards Override Mechanism
- (http://java.sun.com/j2se/1.4.2/docs/guide/standards/index.html)
-
- 6. Restart Tomcat
-
- 7. Test the installation by pointing your browser to
- http://localhost:8080/lenya/
-
-
-Security Considerations
-
- It is advisable to run Lenya's servlet container with limited privileges,
- to reduce the impact of a possible exploit.
- You might want to create a user "lenya" with default group "lenya" for
- this, change the rights of the build/ tree accordingly, and start the
- server as that user.
-
- Additionally, you might want to consider tightening the write privileges
- of the servlet container. At run-time, it only needs write access to
- WEB-INF/* and the publication's content and access-control store.
- While not strictly necessary, disallowing write access to other parts
- makes it harder for an attacker to manipulate the system.
- FIXME: this needs more detailed documentation.
-
-
-Performing automated tests
-
- If you are hacking Lenya (or you have healthy paranoia levels), you might want to run automated unit
- and web tests on your Lenya checkout, especially after modifications.
- In the lenya-2.0.x directory, do
- ./build.sh test (to run the junit tests, requires a successful build), and
- ./build.sh modules.test.canoo (to run the canoo web tests, requires a running servlet engine).
-
\ No newline at end of file
diff --git a/trunk/KEYS b/trunk/KEYS
deleted file mode 100644
index c8d8936..0000000
--- a/trunk/KEYS
+++ /dev/null
@@ -1,77 +0,0 @@
-(instructions copied from cocoons's KEYS file)
-
-This file contains the PGP keys of various developers.
-Please don't use them for email unless you have to. Their main
-purpose is code signing.
-
-Users: pgp < KEYS
-Developers:
- pgp -kxa <your name> and append it to this file.
- (pgpk -ll <your name> && pgpk -xa <your name>) >> this file.
- (gpg --list-sigs <your name>
- && gpg --armor --export <your name>) >> this file.
-
-pub 1024D/08586F81 2004-12-29 Rolf Kulemann (Commiter of the Apache Software Foundation) <roku@apache.org>
-sig 3 08586F81 2004-12-29 Rolf Kulemann (Commiter of the Apache Software Foundation) <roku@apache.org>
-sub 2048g/A57AD592 2004-12-29
-sig 08586F81 2004-12-29 Rolf Kulemann (Commiter of the Apache Software Foundation) <roku@apache.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.2.4 (GNU/Linux)
-
-mQGiBEHTMc8RBACrsQmDSKRahyGhnb2744to8ejgPpNSnZ2Zxr4D7YFG3h5YfbXJ
-GOGbtqelSCHUUhUxmOUOUmaiuhSN0l3a1D+zgiesuZxQyCVUVuKPqKkmxm3+q5Ir
-dg6/BXTVQJ+oLJNa4/k/P3V4uncq67NXvweJSzsm15Z9b92K0uFne+m8FwCgp85g
-Lhq+KSHxWTbeZfkUOhhTm7UD/3bcXgOs2NWmqvoOjNVvGu1Fp8mUvpDt5k4mXLqc
-SxAWHm84Mb4K4jrutoc+zWUvXI+ZtoElYGBm3VPBmqSxMgtUrnlPPpQCqZ6w2dU9
-TgJRzJgzwqJFwT++ivPMIokwL5ORn9oKMZUjNjjwCDGFuhUGNTZ2hwiF8568CPs2
-VDIQA/9vQlH5qyJrS9iHvpWKSkE2IdLf1KzpiLx/wiMdRU3UPRN4+ZlObfYwOOdp
-HG0/1njFqueQT4N38DsIzbkXrPd9QPYFiVgbH7dfXKMl3Ddc/5WibfvAWABC6p2u
-Jm6/NANTG9/3aHzg2BsYi+LYgbKJP9+DBIurM511PnIhlW46zLRMUm9sZiBLdWxl
-bWFubiAoQ29tbWl0ZXIgb2YgdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9u
-KSA8cm9rdUBhcGFjaGUub3JnPoheBBMRAgAeBQJB0zHPAhsDBgsJCAcDAgMVAgMD
-FgIBAh4BAheAAAoJEAFpbawIWG+BG7gAoJ5fRwMJ3uH4458Plut5lmKu3bggAKCf
-TAn5L3xkjOuIeLjsHM3eI8nYJbkCDQRB0zHgEAgArsy9ADrDmueVAPyYBCDwR2nL
-IekaRRngrocjPPiy4dbEAywkw9A0ixpWKOsTeWHu8/+fKu7+gbInwH3YPLvpJ2+N
-3sHdNpGlGYEV2v50EoJnjeRzRi9HZzPlMtyde/x6Buedz/UtuA3P3IRxSH64OzJE
-DQmMEETkgbIC+//OiNBlxZNzXDhwxoCXjZMTAiXoGITPg6PvDfzgFITWnu6kbLy0
-37aaWAlOS1OLCP9emhDC6I6fE+JaHJyfXfNYlNIy3IMEHVJPsn9uMPcI2jsfiaF2
-HcHJXWFxwWXLHAwRIxXyKPDuKpY6eWU2SIXMNRPsYBiEdgjn8hBWwwFAfT8P0wAD
-Bgf9HSwOjl6MIEpM//JPRV4WMWje7orme+uNVIv5PUmtEev2VE8nSJE5zjgcTYjs
-scSqRFKxHojCDEMbN7GtIXF+AUgoB8BNYT0x0fGf2uohWSteKjGLV23AYG1T+ENr
-v/VqEEP0KnRSwi214rKOsl9msvUtKsX3VqnFiWfSsfv7Azntv1gnHIAIEtlL2Av+
-5aIlbDQ85MGQITOMDO8jGFb+IT/8uf6JnyyxzQzxnKlpp19kew6jnrCCTorral8r
-e7RV4b+KAkHU19YsJWyb+9boCyzA/sgZpjEA9BTAxQOG/TgnR3nqeLyC6mpCVczZ
-JQ7nBdkp2cPEyuTJoE7g1JIhKohJBBgRAgAJBQJB0zHgAhsMAAoJEAFpbawIWG+B
-cMIAmwYpKy/m/LVY7OVZFg7ZoxUU0M14AJ9KrFhoLUbekdKWVY6YNMKarO055w==
-=ndjW
------END PGP PUBLIC KEY BLOCK-----
- pub 1024D/6A6DC9F7 2005-05-01 Gregor J. Rothfuss <gregor@apache.org>
-sig 3 6A6DC9F7 2005-05-01 Gregor J. Rothfuss <gregor@apache.org>
-sub 1024g/E245A2B0 2005-05-01
-sig 6A6DC9F7 2005-05-01 Gregor J. Rothfuss <gregor@apache.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.2.3-nr1 (Windows XP)
-
-mQGiBEJ1SoQRBAC99TailoMLV0eeOkkt+j2qcSiMIFkHdjvh4HoqR6IFwU25gBTB
-0kc6oqx6DzeHI+k8OYh0oG6d7N82kgeGAYsxtYfSrHGqWTr7zz/YjY1N/0xHS+iW
-AEprN7s8Zf3kKQH53bKS6OOVMfdjTkrjwTOw9z0EE6aWzV0y9SIyj3QiKwCgm1dt
-Z1EdHHWGQ0D/iOuPJy4ejCkD/3MLJqjBicx5Lbhm444C28Na7G4QMq84QqhC+qNf
-VY2NcnuMxni7AbcrbGxB5Cvo8untgt/flTvMmK+o0oYZ/zuvvK4sJ5uXDawWnFLH
-nFcvRyLdzHglKeqpEh4LirxR0noiZyrBy0JiHg9NeB/UviFD3bMPRHZorYNoeACK
-WrAHA/wNoH8w/lyYjycVJXgYCW1a4KXpkYqPBpJKKjqPvg9djuWNOaAmWoHcKBI3
-dxyySihi5nQ7ZsZhPXA1Qs/Mp8FeF7xXvr9c2j+r5LWDm4fy3kIpUEcQt3DPubpm
-N+jsb7q3zYcx9jDE5/gE3G4oiS2WqzZ/5+KVrU8dycxAO2tVmbQmR3JlZ29yIEou
-IFJvdGhmdXNzIDxncmVnb3JAYXBhY2hlLm9yZz6IXwQTEQIAHwUCQnVKhAIbAwcL
-CQgHAwIBAxUCAwMWAgECHgECF4AACgkQ8XfjPGptyfe1UwCfaZ8d+pVjgb2yMMa/
-q9+HYzsF9KIAnicPkeNbup0JWZ/Ax5ejNS/1s1GAuQENBEJ1SocQBACN+vU6lOYw
-TB+4s/7xdzSmGWoLv5ZNUNUrXVUwNYAdSCpwfIUcCOkE7mD2QCY7lkeukyYUzy6n
-y7C2zYCIxcf5B12mEX82jUcvHyezgCLziTCKKKnO6kfn5rG18MaPwqNEpyI+PG+h
-FFXGO42+aansVLIMpvHxwkVF0V/fqDtmEwADBQP/cFz7JuuEu0KgAxv8Q2oGsfbm
-qZzrPErChls7mSYBN2n7fWiqb1qcm2rfGq7vUtWGM+I26p+UKZhcF/AnDbfp9lT9
-xdp3rSg3t64//i8VbOv3Y5DCFbcfSVjRCvLzFMnQIT0NwLxkhGh8ugrharCVKgr2
-dEmRNV5jP7dHEpQx356ISQQYEQIACQUCQnVKhwIbDAAKCRDxd+M8am3J97oCAJ0d
-IfihpLACvSdSiT2fCm5UEFrI3ACfXOPMYHCtG4wDI7hrpjFcIjuTzEo=
-=C9sc
------END PGP PUBLIC KEY BLOCK-----
diff --git a/trunk/LICENSE.txt b/trunk/LICENSE.txt
deleted file mode 100644
index 261eeb9..0000000
--- a/trunk/LICENSE.txt
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/trunk/NOTICE.txt b/trunk/NOTICE.txt
deleted file mode 100644
index dc7fb79..0000000
--- a/trunk/NOTICE.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-Apache Lenya
-Copyright 1999-2006 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-This product includes software developed by the DOM4J Project
-(http://www.dom4j.org/).
-
-This product includes software developed by the XML:DB Initiative
-(http://www.xmldb.org/).
-
-This product includes software developed by the BXE Project
-(http://bxe.oscom.org/).
-
-This product includes software developed by the Kupu Project
-(http://kupu.oscom.org/).
-
-Portions are Copyright (c) 1998-2000 World Wide Web Consortium
-(Massachusetts Institute of Technology, Institut National de Recherche en
-Informatique et en Automatique, Keio University). All Rights Reserved.
-
-Portions are Copyright (c) 2001, 2002 Thai Open Source Software Center Ltd.
-All rights reserved.
diff --git a/trunk/README.txt b/trunk/README.txt
deleted file mode 100644
index 65ea2f7..0000000
--- a/trunk/README.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-
- A P A C H E L E N Y A
-
- About Apache Lenya
- ------------------
-
- Apache Lenya is a Java-based Open-Source Content Management System.
- It is based on open standards such as XML and XSLT. One of its core
- components is Cocoon from the Apache Software Foundation.
-
- Apache Lenya supports inline WYSIWYG editors. Your site editors do not
- have to learn XML. This is possible thanks to the support of XML,
- XSLT and XML Schema on the client side. An administration interface
- allows advanced users to monitor the CMS, and perform configuration
- tasks.
-
-
- Installation Instructions and Documentation
- -------------------------------------------
-
- For the binary distribution read INSTALL-BIN.txt.
-
- For the source distribution read INSTALL-SRC.txt.
-
- The documentation available as of the date of this release is included
- in this directory.
-
- If you are updating from a previous release of Lenya, make sure
- that you read the installation instructions on updating first.
-
- Look for the most updated documentation on the Apache Lenya web site
- (http://lenya.apache.org/).
-
-
-
- Licensing and legal issues
- --------------------------
-
- Apache Lenya is licensed under the Apache Software License, a license of the BSD
- family, and contains software which is compatible with the BSD licensing
- style.
-
- For more information, please read the LICENSE files in the /legal directory.
-
-
-
- Credits
- -------
-
- For more information on credits and due reference to included software,
- please read the CREDITS.txt file in this directory.
-
-
- Known issues
- ------------
-
- The Apache issue tracker is available at
- http://issues.apache.org/bugzilla/ .
-
-
-
- Thanks for your interest in Apache Lenya.
-
-
-
- The Apache Lenya Project
- http://lenya.apache.org/
diff --git a/trunk/build.bat b/trunk/build.bat
deleted file mode 100644
index 4f1373c..0000000
--- a/trunk/build.bat
+++ /dev/null
@@ -1,45 +0,0 @@
-@echo off
-rem Licensed to the Apache Software Foundation (ASF) under one or more
-rem contributor license agreements. See the NOTICE file distributed with
-rem this work for additional information regarding copyright ownership.
-rem The ASF licenses this file to You under the Apache License, Version 2.0
-rem (the "License"); you may not use this file except in compliance with
-rem the License. You may obtain a copy of the License at
-rem
-rem http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing, software
-rem distributed under the License is distributed on an "AS IS" BASIS,
-rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-rem See the License for the specific language governing permissions and
-rem limitations under the License.
-rem
-rem ----------------------------------------------------------------------------
-rem build.bat - Win32 Build Script for Apache Lenya
-rem
-rem $Id: build.bat 54525 2004-10-11 09:39:04Z cziegeler $
-rem ----------------------------------------------------------------------------
-
-
-set COCOON_HOME=externals\cocoon_2_1_x
-set COCOON_ENDORSED_DIR=%COCOON_HOME%\lib\endorsed
-
-rem ----- Ignore system CLASSPATH variable
-set OLD_CLASSPATH=%CLASSPATH%
-set CLASSPATH=
-for %%i in (lib\*.jar) do call tools\bin\appendcp.bat %%i
-for %%i in (%COCOON_ENDORSED_DIR%\*.jar) do call tools\bin\appendcp.bat %%i
-
-rem ----- Use Ant shipped with Cocoon. Ignore installed in the system Ant
-set OLD_ANT_HOME=%ANT_HOME%
-set ANT_HOME=tools
-
-call %ANT_HOME%\bin\ant -Djava.endorsed.dirs=%COCOON_ENDORSED_DIR% -logger org.apache.tools.ant.NoBannerLogger -emacs %1 %2 %3 %4 %5 %6 %7 %8 %9
-
-rem ----- Restore ANT_HOME and ANT_OPTS
-set ANT_HOME=%OLD_ANT_HOME%
-set OLD_ANT_HOME=
-
-rem ----- Restore CLASSPATH
-set CLASSPATH=%OLD_CLASSPATH%
-set OLD_CLASSPATH=
diff --git a/trunk/build.properties b/trunk/build.properties
deleted file mode 100644
index fc05ab5..0000000
--- a/trunk/build.properties
+++ /dev/null
@@ -1,194 +0,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.
-#------------------------------------------------------------------------------------
-
-
-# Properties controlling the build process
-
-# NOTE:
-# Don't modify this file directly but create a file named
-# 'local.build.properties' and implement ONLY
-# the properties you need.
-
-# You do NOT have to copy the whole 'build.properties' file.
-
-# The build system will first read all properties defined
-# in the 'local.build.properties' file and then will read out the
-# ones in 'build.properties'. Ant will use the first found.
-# You can as well execute ./configure.sh (Linux) or configure (Windows)
-# to generate the 'local.build.properties'.
-
-#------------------------------------------------------------------------------------
-# Build properties version to make sure that local.build.properties is kept in sync
-# NOTE: Do NOT modify this number unless you are a Dev and want to modify this file
-# NOTE for Devs: Update this number if this file is being updated.
-# Also update the version number within src/targets/properties-build.xml
-
-build.properties.version=594644
-
-#------------------------------------------------------------------------------------
-# The root of the Cocoon source tree
-
-cocoon.src.dir=externals/cocoon_2_1_x
-#cocoon.src.dir=../../cocoon/branches/BRANCH_2_1_X
-
-
-#------------------------------------------------------------------------------------
-# The cocoon webapp directory
-# You do not have to change this since Lenya will build Cocoon for you
-
-cocoon.webapp.dir=${cocoon.src.dir}/build/webapp
-
-
-#------------------------------------------------------------------------------------
-# Root directories where publications are located
-
-pubs.root.dirs=src/pubs
-#pubs.root.dirs=src/pubs:../anotherproject/pubs:/home/user/my-pub
-
-
-#------------------------------------------------------------------------------------
-# Root directories where modules are located
-modules.root.dirs=src/modules:src/modules-core:src/pubs/default/modules
-#modules.root.dirs=src/modules:src/pubs/default/modules:src/modules-optional
-
-# copy modules to the web application?
-modules.copy=true
-
-#------------------------------------------------------------------------------------
-# Web Application Server
-# NOTE: There are slight differences re deployment on the various servlet containers, e.g. endorsed libraries ...
-
-web.app.server=Jetty
-# NOTE: This only works for lenya.sh (Linux). TODO: Make it also work for lenya.bat (Windows)
-web.app.server.jetty.port=8888
-web.app.server.jetty.admin.port=8889
-#web.app.server=Tomcat
-#web.app.server=WLS
-
-
-#------------------------------------------------------------------------------------
-# Where the 'install' build target should put the webapp context
-# WARNING: This has to be an absolute path! (FIXME: cocoon.xconf needs absolute path (scr/targets/init-build.xml))
-# NOTE: Do not use white spaces within the path
-
-tomcat.home.dir=/usr/local/tomcat
-#tomcat.home.dir=C:/build/tomcat
-
-
-#------------------------------------------------------------------------------------
-# Where the 'install' build target should put the webapp context
-# NOTE: This path is not necessarily relative to tomcat.home.dir
-
-tomcat.webapps.dir=${tomcat.home.dir}/webapps/lenya
-
-
-#------------------------------------------------------------------------------------
-# The server cache directory to be cleaned by the 'reset' target
-# NOTE: This path is not necessarily relative to tomcat.home.dir
-
-# Tomcat 5.x
-tomcat.cache.dir=${tomcat.home.dir}/work/Catalina/localhost/lenya
-# Tomcat 4.x
-#tomcat.cache.dir=${tomcat.home.dir}/work/Standalone/localhost/lenya
-
-#------------------------------------------------------------------------------------
-# Where the 'install' build target should copy the endorsed libraries
-# NOTE: This path is not necessarily relative to tomcat.home.dir
-
-tomcat.endorsed.dir=${tomcat.home.dir}/common/endorsed
-
-
-#------------------------------------------------------------------------------------
-# Files and directories which should be excluded during 'install', 'clean' and 'reset'
-# Comma- or space-separated list of patterns
-# All files are included when commented
-# This is useful for preserving content while you are developing a publication
-
-#target.install.excludes=**/pubs/default/content/**,**/pubs/default/resources/authoring/**,**/pubs/default/resources/live/**,**/pubs/default/config/ac/passwd/*.iml
-#target.reset.excludes=${target.install.excludes}
-
-
-#------------------------------------------------------------------------------------
-# TODO: This seems to have moved to src/confpatch/enable-uploads.xweb whereas it
-# does NOT seem to work properly!
-# Enable file uploads in Lenya
-# If you leave this set to false, asset and image upload will not work.
-# It is disabled by default for security reasons
-# NOTE: One can change this after the build within build/lenya/webapp/WEB-INF/web.xml
-# where also the max upload size can be configured (upload-max-size parameter)
-
-enable.uploads=false
-
-
-#------------------------------------------------------------------------------------
-# Anteater home directory
-
-#anteater.home=/usr/local/anteater
-
-
-#------------------------------------------------------------------------------------
-# Canoo Webtest configuration
-
-# Webtest home directory
-#webtest.home=/usr/local/canoo-webtest-2.1
-
-# Webtest configuration parameters
-webtest.config.host=localhost
-webtest.config.port=8888
-webtest.config.basepath=default/authoring
-
-
-#------------------------------------------------------------------------------------
-# Eclipse Properties for use with the eclipse-project target
-
-ide.eclipse.outputdir=build/eclipse/classes
-ide.eclipse.export.libs=false
-
-
-#------------------------------------------------------------------------------------
-# The Java version.
-
-# Change to 1.5 if you need the features of 1.5.
-src.java.version=1.4
-
-
-#------------------------------------------------------------------------------------
-# Xopus context name
-
-xopus.context=Xopus2.1.64
-xopus.path=../../ROOT
-
-
-#------------------------------------------------------------------------------------
-# JCR repository factory
-
-repository.factory=org.apache.lenya.cms.jcr.jackrabbit.JackrabbitRepositoryFactory
-# NOTE: JeceiraRepositoryFactory has not been implemented yet
-#repository.factory=org.apache.lenya.cms.jcr.jeceira.JeceiraRepositoryFactory
-
-
-#------------------------------------------------------------------------------------
-# NOTE: The node factory needs to be configured within "build/lenya/webapp/WEB-INF/classes/org/apache/lenya/lenya.roles" after having build Lenya
-
-#node.factory=org.apache.lenya.cms.repository.SourceNodeFactory
-#node.factory=org.apache.lenya.cms.repo.adapter.RepoNodeFactory
-#node.factory=org.apache.lenya.cms.jcr.JCRNodeFactory
-
-
-#------------------------------------------------------------------------------------
-# SVN Revision number
-
-lenya.revision=xxx
diff --git a/trunk/build.sh b/trunk/build.sh
deleted file mode 100755
index 14ea29c..0000000
--- a/trunk/build.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-chmod u+x ./tools/bin/antRun
-chmod u+x ./tools/bin/ant
-
-# ----- Verify and Set Required Environment Variables -------------------------
-
-if [ "$TERM" = "cygwin" ] ; then
- S=';'
-else
- S=':'
-fi
-
-# ----- Ignore system CLASSPATH variable
-OLD_CLASSPATH="$CLASSPATH"
-unset CLASSPATH
-CLASSPATH="`echo lib/*.jar | tr ' ' $S`"
-ENDORSED_DIR="externals/cocoon_2_1_x/lib/endorsed"
-# Add cocoon endorsed libs
-CLASSPATH="$CLASSPATH `echo $ENDORSED_DIR/*.jar | tr ' ' $S`"
-export CLASSPATH
-
-# ----- Use Ant shipped with Lenya. Ignore installed in the system Ant
-OLD_ANT_HOME="$ANT_HOME"
-ANT_HOME=tools
-OLD_ANT_OPTS="$ANT_OPTS"
-ANT_OPTS="-Xms32M -Xmx512M -Djava.endorsed.dirs=$ENDORSED_DIR"
-export ANT_HOME ANT_OPTS
-
-"$ANT_HOME/bin/ant" -logger org.apache.tools.ant.NoBannerLogger -emacs $@
-ERR=$?
-
-# ----- Restore ANT_HOME and ANT_OPTS
-ANT_HOME="$OLD_ANT_HOME"
-ANT_OPTS="$OLD_ANT_OPTS"
-export ANT_HOME ANT_OPTS
-unset OLD_ANT_HOME
-unset OLD_ANT_OPTS
-
-# ----- Restore CLASSPATH
-CLASSPATH="$OLD_CLASSPATH"
-export CLASSPATH
-unset OLD_CLASSPATH
-
-# Build status return
-# Usage: e.g. bash: ./build.sh; if [ $? -ne 0 ]; then echo "Build FAILED"; fi
-exit $ERR
diff --git a/trunk/build.xml b/trunk/build.xml
deleted file mode 100644
index 09fc558..0000000
--- a/trunk/build.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<!DOCTYPE project [
-<!-- ===========================================================================
-
- * =========================== *
- | Apache Lenya Build System |
- * =========================== *
-
- CVS $Id$:
-
-============================================================================ -->
-
-]>
-
-<project default="webapp" basedir="." name="lenya">
-
- <!-- ================== Apache Lenya targets ======================== -->
-
- <!-- =================================================================== -->
- <!-- Global properties -->
- <import file="src/targets/properties-build.xml" />
- <!-- Initialization targets -->
- <import file="src/targets/init-build.xml" />
- <!-- IDE targets -->
- <import file="src/targets/ide-build.xml" />
- <!-- Compile targets -->
- <import file="src/targets/compile-build.xml" />
- <!-- Documentation targets -->
- <import file="src/targets/docs-build.xml" />
- <!-- Web application targets -->
- <import file="src/targets/webapp-build.xml" />
- <!-- Testcases targets -->
- <import file="src/targets/test-build.xml" />
- <!-- Distribution targets -->
- <import file="src/targets/dist-build.xml" />
- <!-- Kupu targets -->
- <import file="src/targets/kupu-build.xml" />
- <!-- Export targets -->
- <import file="src/targets/export-build.xml" />
- <!-- module targets -->
- <import file="src/targets/modules-build.xml" />
- <!-- migration targets -->
- <import file="src/targets/migration-build.xml" />
- <!-- Publication tests -->
- <import file="src/targets/publication-test-build.xml" />
- <!-- Successfully Built Message -->
- <import file="src/targets/message-build.xml" />
- <!-- =================================================================== -->
-
-</project>
diff --git a/trunk/configure.bat b/trunk/configure.bat
deleted file mode 100644
index affdab6..0000000
--- a/trunk/configure.bat
+++ /dev/null
@@ -1,51 +0,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.
-::
-::
-@echo off
-
-:: define variables for paths
-set LENYA_HOME=%CD%
-set CP=%LENYA_HOME%\tools\configure\lib\apache-lenya-configure-core-1.4-dev-r414579.jar;%LENYA_HOME%\tools\configure\lib\apache-lenya-configure-impl-1.4-dev-r414579.jar
-echo The classpath is set to: %CP%
-
-:: check if JAVA_HOME is set or goto end
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-echo You must set JAVA_HOME to point at your Java Development Kit installation
-goto end
-
-:gotJavaHome
-:: If commandline argument cmd is given goto javaCmd. Default without any argument
-:: it will start the GUI.
-if "%1" == "gui" goto javaGui
-goto javaCmd
-
-:javaGui
-java -classpath %CP% org.apache.lenya.config.impl.ConfigureGUI %LENYA_HOME%
-goto end
-
-:javaCmd
-java -classpath %CP% org.apache.lenya.config.impl.ConfigureCommandLine %LENYA_HOME%
-goto end
-
-:help
-echo Usage: %0 gui or cmd
-goto end
-
-
-:end
-:: unset used variables
-set LENYA_HOME=
-set CP=
diff --git a/trunk/configure.sh b/trunk/configure.sh
deleted file mode 100755
index e350bcf..0000000
--- a/trunk/configure.sh
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# ----- Verify and Set Required Environment Variables -------------------------
-
-if [ "$TERM" = "cygwin" ] ; then
- S=';'
-else
- S=':'
-fi
-
-# ----- Check JAVA_HOME
-JAVA_HOME="$JAVA_HOME"
-if [ "$JAVA_HOME" = "" ];then
- echo "ERROR: No JAVA_HOME set yet!"
- echo " Have you installed JDK 1.4.2 or higher?"
- echo ""
- echo "NOTE: Apache Lenya does not work properly with JDK 1.5!"
- exit 1
-fi
-
-# ----- Ignore system CLASSPATH variable
-OLD_CLASSPATH="$CLASSPATH"
-unset CLASSPATH
-#CLASSPATH="`echo tools/configure/build/classes | tr ' ' $S`"
-CLASSPATH="tools/configure/lib/apache-lenya-configure-core-1.4-dev-r414579.jar:tools/configure/lib/apache-lenya-configure-impl-1.4-dev-r414579.jar"
-export CLASSPATH
-#echo "DEBUG: $CLASSPATH"
-
-DEFAULT_UI_TYPE=cmd
-UI_TYPE=$1
-if [ "$UI_TYPE" = "" ];then
- UI_TYPE=$DEFAULT_UI_TYPE
-fi
-#echo "DEBUG: $UI_TYPE"
-
-
-PWD=`pwd`
-if [ "$UI_TYPE" = "cmd" ];then
- java org.apache.lenya.config.impl.ConfigureCommandLine $PWD
-elif [ "$UI_TYPE" = "gui" ]; then
- java org.apache.lenya.config.impl.ConfigureGUI $PWD
-else
- echo "ERROR: No such User Interface: $UI_TYPE"
- exit 1
-fi
-ERR=$?
-
-echo ""
-echo "NOTE (for the advanced user): You might want to edit the local.* files manually, because there are often even more parameters which can be configured than the ones which were presented during this configuration setup!"
-
-echo ""
-echo "NOTE: Build Lenya now by running ./build.sh!"
-
-# ----- Restore CLASSPATH
-CLASSPATH="$OLD_CLASSPATH"
-export CLASSPATH
-unset OLD_CLASSPATH
-
-# Build status return
-# Usage: e.g. bash: ./build.sh; if [ $? -ne 0 ]; then echo "Build FAILED"; fi
-exit $ERR
diff --git a/trunk/legal/LICENSE.apache b/trunk/legal/LICENSE.apache
deleted file mode 100644
index 1fc4c3e..0000000
--- a/trunk/legal/LICENSE.apache
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <stefano@apache.org>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
diff --git a/trunk/legal/LICENSE.avalon b/trunk/legal/LICENSE.avalon
deleted file mode 100644
index 86f3c8a..0000000
--- a/trunk/legal/LICENSE.avalon
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1997-2001 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Jakarta", "Avalon", "Excalibur", "Avalon Framework" and
- "Apache Software Foundation" must not be used to endorse or promote
- products derived from this software without prior written permission.
- For written permission, please contact apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation. For more information on the
- Apache Software Foundation, please see <http://www.apache.org/>.
-
-
diff --git a/trunk/legal/LICENSE.batik b/trunk/legal/LICENSE.batik
deleted file mode 100644
index 6480f2a..0000000
--- a/trunk/legal/LICENSE.batik
+++ /dev/null
@@ -1,45 +0,0 @@
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 2000 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Batik" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation. For more information on the
- Apache Software Foundation, please see <http://www.apache.org/>.
diff --git a/trunk/legal/LICENSE.bxeng b/trunk/legal/LICENSE.bxeng
deleted file mode 100644
index 7dd2916..0000000
--- a/trunk/legal/LICENSE.bxeng
+++ /dev/null
@@ -1,49 +0,0 @@
-The Bitflux Editor Software License
-
-Copyright (c) 2002, 2003 Bitflux GmbH. All rights reserved.
-
-Redistribution and use in source and binary forms,
-with or without modification, are permitted provided
-that the following conditions are met:
-
-1. Redistributions of source code must retain the
-above copyright notice, this list of conditions and
-the following disclaimer.
-
-2. Redistributions in binary form must reproduce the
-above copyright notice, this list of conditions and
-the following disclaimer in the documentation and/or
-other materials provided with the distribution.
-
-3. All advertising materials mentioning features or
-use of this software must display the following
-acknowledgment: "This product includes software
-developed by Bitflux GmbH (http://www.bitflux.ch)"
-
-4. The name "Bitflux Editor" and "Bitflux" must not be
-used to endorse or promote products derived from this
-software without prior written permission. For written
-permission, please contact editor@bitflux.ch
-
-5. Products derived from this software may not be
-called "Bitflux" or "Bitflux Editor" nor may "Bitflux"
-or "Bitflux Editor" appear in their names without
-prior written permission of Bitflux.
-
-6. Redistributions of any form whatsoever must retain
-the following acknowledgment: "This product includes
-software developed by Bitflux GmbH
-(http://www.bitflux.ch)"
-
-
-THIS SOFTWARE IS PROVIDED BY Bitflux "AS IS" WITHOUT
-ANY WARRANTY EXPRESS OR IMPLIED, INCLUDING THE
-WARRANTY OF NON-INFRINGEMENT AND THE IMPLIED
-WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A
-PARTICULAR PURPOSE. Bitflux WILL NOT BE LIABLE FOR ANY
-DAMAGES SUFFERED BY YOU AS A RESULT OF USING THIS
-SOFTWARE. IN NO EVENT WILL Bitflux BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR LOST
-PROFITS EVEN IF Bitflux HAS BEEN ADVISED OF THE
-POSSIBILITY OF THEIR OCCURRENCE. Bitflux WILL NOT BE
-LIABLE FOR ANY THIRD PARTY CLAIMS AGAINST YOU.
diff --git a/trunk/legal/LICENSE.forrest b/trunk/legal/LICENSE.forrest
deleted file mode 100644
index f376e9b..0000000
--- a/trunk/legal/LICENSE.forrest
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Forrest" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation. For more information on the
- Apache Software Foundation, please see <http://www.apache.org/>.
-
-*/
diff --git a/trunk/legal/LICENSE.jakarta-commons b/trunk/legal/LICENSE.jakarta-commons
deleted file mode 100644
index 5fb9ec1..0000000
--- a/trunk/legal/LICENSE.jakarta-commons
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgement may appear in the software itself,
- * if and wherever such third-party acknowledgements normally appear.
- *
- * 4. The names "Apache", "The Jakarta Project", "Commons", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their name without prior
- * written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
\ No newline at end of file
diff --git a/trunk/legal/LICENSE.jakarta-regexp b/trunk/legal/LICENSE.jakarta-regexp
deleted file mode 100644
index 64ea074..0000000
--- a/trunk/legal/LICENSE.jakarta-regexp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Jakarta-Regexp", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
diff --git a/trunk/legal/LICENSE.jing b/trunk/legal/LICENSE.jing
deleted file mode 100644
index f257dcc..0000000
--- a/trunk/legal/LICENSE.jing
+++ /dev/null
@@ -1,39 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Jing Copying Conditions</title></head>
-<body>
-<h1>Jing Copying Conditions</h1>
-
-<p>Copyright (c) 2001-2003 Thai Open Source Software Center Ltd<br>
-All rights reserved.</p>
-
-<p>Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:</p>
-
-<ul>
- <li>Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.</li>
-
- <li>Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.</li>
-
- <li>Neither the name of the Thai Open Source Software Center Ltd nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.</li>
-</ul>
-
-<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
-
-</body></html>
\ No newline at end of file
diff --git a/trunk/legal/LICENSE.jtidy b/trunk/legal/LICENSE.jtidy
deleted file mode 100644
index 84e366b..0000000
--- a/trunk/legal/LICENSE.jtidy
+++ /dev/null
@@ -1,49 +0,0 @@
- Java HTML Tidy - JTidy
- HTML parser and pretty printer
-
- Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts
- Institute of Technology, Institut National de Recherche en
- Informatique et en Automatique, Keio University). All Rights
- Reserved.
-
- Contributing Author(s):
-
- Dave Raggett <dsr@w3.org>
- Andy Quick <ac.quick@sympatico.ca> (translation to Java)
- Gary L Peskin <garyp@firstech.com> (Java development)
- Sami Lempinen <sami@lempinen.net> (release management)
-
- The contributing author(s) would like to thank all those who
- helped with testing, bug fixes, and patience. This wouldn't
- have been possible without all of you.
-
- COPYRIGHT NOTICE:
-
- This software and documentation is provided "as is," and
- the copyright holders and contributing author(s) make no
- representations or warranties, express or implied, including
- but not limited to, warranties of merchantability or fitness
- for any particular purpose or that the use of the software or
- documentation will not infringe any third party patents,
- copyrights, trademarks or other rights.
-
- The copyright holders and contributing author(s) will not be
- liable for any direct, indirect, special or consequential damages
- arising out of any use of the software or documentation, even if
- advised of the possibility of such damage.
-
- Permission is hereby granted to use, copy, modify, and distribute
- this source code, or portions hereof, documentation and executables,
- for any purpose, without fee, subject to the following restrictions:
-
- 1. The origin of this source code must not be misrepresented.
- 2. Altered versions must be plainly marked as such and must
- not be misrepresented as being the original source.
- 3. This Copyright notice may not be removed or altered from any
- source or altered source distribution.
-
- The copyright holders and contributing author(s) specifically
- permit, without fee, and encourage the use of this source code
- as a component for supporting the Hypertext Markup Language in
- commercial products. If you use this source code in a product,
- acknowledgment is not required but would be appreciated.
diff --git a/trunk/legal/LICENSE.junit b/trunk/legal/LICENSE.junit
deleted file mode 100644
index cdf887a..0000000
--- a/trunk/legal/LICENSE.junit
+++ /dev/null
@@ -1,185 +0,0 @@
-
-IBM Public License Version 1.0
-THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS IBM PUBLIC
-LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE
-PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
-1. DEFINITIONS
-
-"Contribution" means:
- a) in the case of International Business Machines Corporation ("IBM"),
- the Original Program, and
- b) in the case of each Contributor,
- i) changes to the Program, and
- ii) additions to the Program;
- where such changes and/or additions to the Program originate from and
- are distributed by that particular Contributor. A Contribution
- 'originates' from a Contributor if it was added to the Program by such
- Contributor itself or anyone acting on such Contributor's behalf.
- Contributions do not include additions to the Program which: (i) are
- separate modules of software distributed in conjunction with the Program
- under their own license agreement, and (ii) are not derivative works of
- the Program.
-"Contributor" means IBM and any other entity that distributes the Program.
-
-"Licensed Patents " mean patent claims licensable by a Contributor which
-are necessarily infringed by the use or sale of its Contribution alone or
-when combined with the Program.
-"Original Program" means the original version of the software accompanying
-this Agreement as released by IBM, including source code, object code and
-documentation, if any.
-"Program" means the Original Program and Contributions.
-"Recipient" means anyone who receives the Program under this Agreement,
-including all Contributors.
-2. GRANT OF RIGHTS
- a) Subject to the terms of this Agreement, each Contributor hereby
- grants Recipient a non-exclusive, worldwide, royalty-free copyright
- license to reproduce, prepare derivative works of, publicly display,
- publicly perform, distribute and sublicense the Contribution of such
- Contributor, if any, and such derivative works, in source code and
- object code form.
- b) Subject to the terms of this Agreement, each Contributor hereby
- grants Recipient a non-exclusive, worldwide, royalty-free patent license
- under Licensed Patents to make, use, sell, offer to sell, import and
- otherwise transfer the Contribution of such Contributor, if any, in
- source code and object code form. This patent license shall apply to the
- combination of the Contribution and the Program if, at the time the
- Contribution is added by the Contributor, such addition of the
- Contribution causes such combination to be covered by the Licensed
- Patents. The patent license shall not apply to any other combinations
- which include the Contribution. No hardware per se is licensed
- hereunder.
- c) Recipient understands that although each Contributor grants the
- licenses to its Contributions set forth herein, no assurances are
- provided by any Contributor that the Program does not infringe the
- patent or other intellectual property rights of any other entity. Each
- Contributor disclaims any liability to Recipient for claims brought by
- any other entity based on infringement of intellectual property rights
- or otherwise. As a condition to exercising the rights and licenses
- granted hereunder, each Recipient hereby assumes sole responsibility to
- secure any other intellectual property rights needed, if any. For
- example, if a third party patent license is required to allow Recipient
- to distribute the Program, it is Recipient's responsibility to acquire
- that license before distributing the Program.
- d) Each Contributor represents that to its knowledge it has sufficient
- copyright rights in its Contribution, if any, to grant the copyright
- license set forth in this Agreement.
-3. REQUIREMENTS
-A Contributor may choose to distribute the Program in object code form
-under its own license agreement, provided that:
- a) it complies with the terms and conditions of this Agreement; and
- b) its license agreement:
- i) effectively disclaims on behalf of all Contributors all warranties
- and conditions, express and implied, including warranties or conditions
- of title and non-infringement, and implied warranties or conditions of
- merchantability and fitness for a particular purpose;
- ii) effectively excludes on behalf of all Contributors all liability for
- damages, including direct, indirect, special, incidental and
- consequential damages, such as lost profits;
- iii) states that any provisions which differ from this Agreement are
- offered by that Contributor alone and not by any other party; and
- iv) states that source code for the Program is available from such
- Contributor, and informs licensees how to obtain it in a reasonable
- manner on or through a medium customarily used for software exchange.
-When the Program is made available in source code form:
- a) it must be made available under this Agreement; and
- b) a copy of this Agreement must be included with each copy of the
- Program.
-Each Contributor must include the following in a conspicuous location in
-the Program:
- Copyright © {date here}, International Business Machines Corporation and
- others. All Rights Reserved.
-In addition, each Contributor must identify itself as the originator of
-its Contribution, if any, in a manner that reasonably allows subsequent
-Recipients to identify the originator of the Contribution.
-4. COMMERCIAL DISTRIBUTION
-Commercial distributors of software may accept certain responsibilities
-with respect to end users, business partners and the like. While this
-license is intended to facilitate the commercial use of the Program, the
-Contributor who includes the Program in a commercial product offering
-should do so in a manner which does not create potential liability for
-other Contributors. Therefore, if a Contributor includes the Program in a
-commercial product offering, such Contributor ("Commercial Contributor")
-hereby agrees to defend and indemnify every other Contributor
-("Indemnified Contributor") against any losses, damages and costs
-(collectively "Losses") arising from claims, lawsuits and other legal
-actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor
-in connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or
-Losses relating to any actual or alleged intellectual property
-infringement. In order to qualify, an Indemnified Contributor must: a)
-promptly notify the Commercial Contributor in writing of such claim, and
-b) allow the Commercial Contributor to control, and cooperate with the
-Commercial Contributor in, the defense and any related settlement
-negotiations. The Indemnified Contributor may participate in any such
-claim at its own expense.
-For example, a Contributor might include the Program in a commercial
-product offering, Product X. That Contributor is then a Commercial
-Contributor. If that Commercial Contributor then makes performance claims,
-or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under
-this section, the Commercial Contributor would have to defend claims
-against the other Contributors related to those performance claims and
-warranties, and if a court requires any other Contributor to pay any
-damages as a result, the Commercial Contributor must pay those damages.
-5. NO WARRANTY
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED
-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. Each Recipient is solely responsible for determining
-the appropriateness of using and distributing the Program and assumes all
-risks associated with its exercise of rights under this Agreement,
-including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations.
-6. DISCLAIMER OF LIABILITY
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
-CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
-WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION
-OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-7. GENERAL
-If any provision of this Agreement is invalid or unenforceable under
-applicable law, it shall not affect the validity or enforceability of the
-remainder of the terms of this Agreement, and without further action by
-the parties hereto, such provision shall be reformed to the minimum extent
-necessary to make such provision valid and enforceable.
-If Recipient institutes patent litigation against a Contributor with
-respect to a patent applicable to software (including a cross-claim or
-counterclaim in a lawsuit), then any patent licenses granted by that
-Contributor to such Recipient under this Agreement shall terminate as of
-the date such litigation is filed. In addition, If Recipient institutes
-patent litigation against any entity (including a cross-claim or
-counterclaim in a lawsuit) alleging that the Program itself (excluding
-combinations of the Program with other software or hardware) infringes
-such Recipient's patent(s), then such Recipient's rights granted under
-Section 2(b) shall terminate as of the date such litigation is filed.
-All Recipient's rights under this Agreement shall terminate if it fails to
-comply with any of the material terms or conditions of this Agreement and
-does not cure such failure in a reasonable period of time after becoming
-aware of such noncompliance. If all Recipient's rights under this
-Agreement terminate, Recipient agrees to cease use and distribution of the
-Program as soon as reasonably practicable. However, Recipient's
-obligations under this Agreement and any licenses granted by Recipient
-relating to the Program shall continue and survive.
-IBM may publish new versions (including revisions) of this Agreement from
-time to time. Each new version of the Agreement will be given a
-distinguishing version number. The Program (including Contributions) may
-always be distributed subject to the version of the Agreement under which
-it was received. In addition, after a new version of the Agreement is
-published, Contributor may elect to distribute the Program (including its
-Contributions) under the new version. No one other than IBM has the right
-to modify this Agreement. Except as expressly stated in Sections 2(a) and
-2(b) above, Recipient receives no rights or licenses to the intellectual
-property of any Contributor under this Agreement, whether expressly, by
-implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.
-This Agreement is governed by the laws of the State of New York and the
-intellectual property laws of the United States of America. No party to
-this Agreement will bring a legal action under this Agreement more than
-one year after the cause of action arose. Each party waives its rights to
-a jury trial in any resulting litigation.
diff --git a/trunk/legal/LICENSE.logkit b/trunk/legal/LICENSE.logkit
deleted file mode 100644
index b360565..0000000
--- a/trunk/legal/LICENSE.logkit
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2001 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "LogKit", "Jakarta" and "Apache Software Foundation" must not
- be used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <stefano@apache.org>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
diff --git a/trunk/legal/LICENSE.quartz b/trunk/legal/LICENSE.quartz
deleted file mode 100644
index 4c8db80..0000000
--- a/trunk/legal/LICENSE.quartz
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * All source code, binaries, documentation and other files distributed
- * with Quartz Enterprise Job Scheduler are subject to the following
- * license terms, and are held under the following copyright notice,
- * unless otherwise noted within the individual files.
- *
- */
-
-
-/*
- * Copyright James House (c) 2001-2003
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *
- * This product uses and includes within its distribution,
- * software developed by the Apache Software Foundation
- * (http://www.apache.org/)
- *
- */
diff --git a/trunk/legal/LICENSE.resolver b/trunk/legal/LICENSE.resolver
deleted file mode 100644
index b9f6031..0000000
--- a/trunk/legal/LICENSE.resolver
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
diff --git a/trunk/legal/LICENSE.servlet b/trunk/legal/LICENSE.servlet
deleted file mode 100644
index 9bace83..0000000
--- a/trunk/legal/LICENSE.servlet
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * ====================================================================
- *
- * This source code implements specifications defined by the Java
- * Community Process. In order to remain compliant with the specification
- * DO NOT add / change / or delete method signatures!
- */
diff --git a/trunk/legal/LICENSE.websphinx b/trunk/legal/LICENSE.websphinx
deleted file mode 100644
index 3a6c289..0000000
--- a/trunk/legal/LICENSE.websphinx
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * WebSphinx web-crawling toolkit
- *
- * Copyright (c) 1998-2002 Carnegie Mellon University. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
- * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
- * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
diff --git a/trunk/legal/LICENSE.xalan b/trunk/legal/LICENSE.xalan
deleted file mode 100644
index 21156a6..0000000
--- a/trunk/legal/LICENSE.xalan
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, Lotus
- * Development Corporation., http://www.lotus.com. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
diff --git a/trunk/legal/LICENSE.xerces b/trunk/legal/LICENSE.xerces
deleted file mode 100644
index b37087c..0000000
--- a/trunk/legal/LICENSE.xerces
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- *
- * Copyright (c) 1999 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Xerces" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation and was
- * originally based on software copyright (c) 1999, International
- * Business Machines, Inc., http://www.ibm.com. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
diff --git a/trunk/legal/LICENSE.xml-apis b/trunk/legal/LICENSE.xml-apis
deleted file mode 100644
index 930145f..0000000
--- a/trunk/legal/LICENSE.xml-apis
+++ /dev/null
@@ -1,5 +0,0 @@
-
-xml-apis is covered by The Apache Software License, Version 1.1
-
-FIXME: Put license text in here once it is available at
- http://cvs.apache.org/viewcvs.cgi/xml-commons/
diff --git a/trunk/legal/ant-contrib-0.6.jar.license.txt b/trunk/legal/ant-contrib-0.6.jar.license.txt
deleted file mode 100644
index 4d8c2fb..0000000
--- a/trunk/legal/ant-contrib-0.6.jar.license.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001-2003 Ant-Contrib project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Ant-Contrib project (http://sourceforge.net/projects/ant-contrib)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The name Ant-Contrib must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact
- * ant-contrib-developers@lists.sourceforge.net.
- *
- * 5. Products derived from this software may not be called "Ant-Contrib"
- * nor may "Ant-Contrib" appear in their names without prior written
- * permission of the Ant-Contrib project.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE ANT-CONTRIB PROJECT OR ITS
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- */
diff --git a/trunk/legal/ant-junit.jar.license.txt b/trunk/legal/ant-junit.jar.license.txt
deleted file mode 100644
index f820d4b..0000000
--- a/trunk/legal/ant-junit.jar.license.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * 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/trunk/legal/ant-launcher.jar.license.txt b/trunk/legal/ant-launcher.jar.license.txt
deleted file mode 100644
index f820d4b..0000000
--- a/trunk/legal/ant-launcher.jar.license.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * 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/trunk/legal/ant-trax.jar.license.txt b/trunk/legal/ant-trax.jar.license.txt
deleted file mode 100644
index f820d4b..0000000
--- a/trunk/legal/ant-trax.jar.license.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * 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/trunk/legal/ant.jar.license.txt b/trunk/legal/ant.jar.license.txt
deleted file mode 100644
index f820d4b..0000000
--- a/trunk/legal/ant.jar.license.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * 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/trunk/legal/commons-cli-1.0.jar.license.txt b/trunk/legal/commons-cli-1.0.jar.license.txt
deleted file mode 100644
index 4088a92..0000000
--- a/trunk/legal/commons-cli-1.0.jar.license.txt
+++ /dev/null
@@ -1,203 +0,0 @@
- 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/trunk/legal/commons-logging.jar.license.txt b/trunk/legal/commons-logging.jar.license.txt
deleted file mode 100644
index 4088a92..0000000
--- a/trunk/legal/commons-logging.jar.license.txt
+++ /dev/null
@@ -1,203 +0,0 @@
- 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/trunk/legal/howl.jar.license.html b/trunk/legal/howl.jar.license.html
deleted file mode 100644
index 0f6e253..0000000
--- a/trunk/legal/howl.jar.license.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<html>
-<head>
-<meta name="generator" content="
-HTML Tidy for Windows (vers 1st July 2003), see www.w3.org">
-<title>BSD-style License</title>
-</head>
-<body bgcolor="#FFFFFF" text="#000000" link="#1F00FF" alink="
-#FF0000" vlink="#9900DD">
-<h1>BSD-style License</h1>
-<hr>
-<p>Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the following
-conditions are met:</p>
-<p>-Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.</p>
-<p>-Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials provided
-with the distribution.</p>
-
-<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.</p>
-<hr>
-<p>Updated: <!-- hhmts start -->
- 9 Dec 2003 jotm <!-- hhmts end --></p>
-<hr>
-</body>
-</html>
\ No newline at end of file
diff --git a/trunk/legal/jaas-5.1.4.jar.license.txt b/trunk/legal/jaas-5.1.4.jar.license.txt
deleted file mode 100644
index 261eeb9..0000000
--- a/trunk/legal/jaas-5.1.4.jar.license.txt
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/trunk/legal/jetty.plus-5.1.4.jar.license.txt b/trunk/legal/jetty.plus-5.1.4.jar.license.txt
deleted file mode 100644
index 261eeb9..0000000
--- a/trunk/legal/jetty.plus-5.1.4.jar.license.txt
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/trunk/legal/jotm.jar.license.html b/trunk/legal/jotm.jar.license.html
deleted file mode 100644
index 0f6e253..0000000
--- a/trunk/legal/jotm.jar.license.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<html>
-<head>
-<meta name="generator" content="
-HTML Tidy for Windows (vers 1st July 2003), see www.w3.org">
-<title>BSD-style License</title>
-</head>
-<body bgcolor="#FFFFFF" text="#000000" link="#1F00FF" alink="
-#FF0000" vlink="#9900DD">
-<h1>BSD-style License</h1>
-<hr>
-<p>Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the following
-conditions are met:</p>
-<p>-Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.</p>
-<p>-Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials provided
-with the distribution.</p>
-
-<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.</p>
-<hr>
-<p>Updated: <!-- hhmts start -->
- 9 Dec 2003 jotm <!-- hhmts end --></p>
-<hr>
-</body>
-</html>
\ No newline at end of file
diff --git a/trunk/legal/kupu.license.txt b/trunk/legal/kupu.license.txt
deleted file mode 100644
index 124695f..0000000
--- a/trunk/legal/kupu.license.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-Copyright (c) 2003-2004, Kupu Contributors
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- * Neither the name of Kupu nor the names of its contributors may
- be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/trunk/legal/log4j.jar.license.txt b/trunk/legal/log4j.jar.license.txt
deleted file mode 100644
index e7e2637..0000000
--- a/trunk/legal/log4j.jar.license.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- 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.
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT 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/trunk/legal/neko.license.txt b/trunk/legal/neko.license.txt
deleted file mode 100644
index 760f629..0000000
--- a/trunk/legal/neko.license.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-The CyberNeko Software License, Version 1.0
-
-
-(C) Copyright 2002, Andy Clark. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by Andy Clark."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
-4. The names "CyberNeko" and "NekoHTML" must not be used to endorse
- or promote products derived from this software without prior
- written permission. For written permission, please contact
- andy@cyberneko.net.
-
-5. Products derived from this software may not be called "NekoHTML",
- nor may "NekoHTML" appear in their name, without prior written
- permission of the author.
-
-THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-====================================================================
-
-This license is based on the Apache Software License, version 1.1.
\ No newline at end of file
diff --git a/trunk/legal/xindice-1.1.jar.license.txt b/trunk/legal/xindice-1.1.jar.license.txt
deleted file mode 100644
index 261eeb9..0000000
--- a/trunk/legal/xindice-1.1.jar.license.txt
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/trunk/legal/xmldb-common-20030701.jar.license.txt b/trunk/legal/xmldb-common-20030701.jar.license.txt
deleted file mode 100644
index 6cf5b78..0000000
--- a/trunk/legal/xmldb-common-20030701.jar.license.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-
- The XML:DB Initiative Software License, Version 1.0
-
-
- Copyright (c) 2000-2001 The XML:DB Initiative. All rights
- reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- XML:DB Initiative (http://www.xmldb.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "XML:DB Initiative" must not be used to endorse or
- promote products derived from this software without prior written
- permission. For written permission, please contact info@xmldb.org.
-
- 5. Products derived from this software may not be called "XML:DB",
- nor may "XML:DB" appear in their name, without prior written
- permission of the XML:DB Initiative.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the XML:DB Initiative. For more information
- on the XML:DB Initiative, please see <http://www.xmldb.org/>.
-
diff --git a/trunk/legal/xmldb-xupdate-20040205.jar.license.txt b/trunk/legal/xmldb-xupdate-20040205.jar.license.txt
deleted file mode 100644
index 6cf5b78..0000000
--- a/trunk/legal/xmldb-xupdate-20040205.jar.license.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-
- The XML:DB Initiative Software License, Version 1.0
-
-
- Copyright (c) 2000-2001 The XML:DB Initiative. All rights
- reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by the
- XML:DB Initiative (http://www.xmldb.org/)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The name "XML:DB Initiative" must not be used to endorse or
- promote products derived from this software without prior written
- permission. For written permission, please contact info@xmldb.org.
-
- 5. Products derived from this software may not be called "XML:DB",
- nor may "XML:DB" appear in their name, without prior written
- permission of the XML:DB Initiative.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
- ====================================================================
-
- This software consists of voluntary contributions made by many
- individuals on behalf of the XML:DB Initiative. For more information
- on the XML:DB Initiative, please see <http://www.xmldb.org/>.
-
diff --git a/trunk/legal/xmlunit1.0.jar.license.txt b/trunk/legal/xmlunit1.0.jar.license.txt
deleted file mode 100644
index 0a1439f..0000000
--- a/trunk/legal/xmlunit1.0.jar.license.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-******************************************************************
-Copyright (c) 2001, Jeff Martin, Tim Bacon
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of the xmlunit.sourceforge.net nor the names
- of its contributors may be used to endorse or promote products
- derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-******************************************************************
-*/
diff --git a/trunk/lenya.bat b/trunk/lenya.bat
deleted file mode 100644
index ec98e15..0000000
--- a/trunk/lenya.bat
+++ /dev/null
@@ -1,162 +0,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.
-
-@echo off
-:: -----------------------------------------------------------------------------
-:: Lenya Win32 Shell Script
-::
-:: $Id$
-:: -----------------------------------------------------------------------------
-
-:: Configuration variables
-::
-:: LENYA_HOME
-:: Folder that points to the root of the Lenya distribution
-::
-:: LENYA_LIB
-:: Folder containing all the library files needed by the Lenya CLI
-::
-:: JAVA_HOME
-:: Home of Java installation.
-::
-:: JAVA_OPTIONS
-:: Extra options to pass to the JVM
-::
-:: JAVA_DEBUG_PORT
-:: The location where the JVM debug server should listen to
-::
-:: JETTY_PORT
-:: Override the default port for Jetty
-::
-:: JETTY_ADMIN_PORT
-:: The port where the jetty web administration should bind
-::
-:: JETTY_WEBAPP
-:: The directory where the webapp that jetty has to execute is located
-::
-
-:: ----- Verify and Set Required Environment Variables -------------------------
-
-if not "%JAVA_HOME%" == "" goto gotJavaHome
-echo You must set JAVA_HOME to point at your Java Development Kit installation
-goto end
-:gotJavaHome
-
-:: ----- Check System Properties -----------------------------------------------
-
-if not "%EXEC%" == "" goto gotExec
-if not "%OS%" == "Windows_NT" goto noExecNT
-set EXEC=start "Apache Lenya" /D. /MAX
-goto gotExec
-:noExecNT
-set EXEC=
-:gotExec
-
-set LENYA_HOME=.
-:: echo lenya.bat: using %LENYA_HOME% as home
-
-set LENYA_LIB=%LENYA_HOME%\build\lenya\webapp\WEB-INF\lib
-:: echo lenya.bat: using %LENYA_LIB% as lib
-
-set JETTY_PORT=8888
-
-set JETTY_ADMIN_PORT=8889
-set JETTY_URI_CHARSET=ISO-8859-1
-set JETTY_WEBAPP=%LENYA_HOME%\build\lenya\webapp
-:: echo lenya.bat: using %JETTY_WEBAPP% as the webapp directory
-
-set JAVA_DEBUG_PORT=8000
-
-:: ----- Set Up The Classpath --------------------------------------------------
-
-set CP=%LENYA_HOME%\tools\loader
-
-:: ----- Unpack WAR file if needed --------------------------------------------------
-
-if exist build\lenya\webapp goto action
-
-echo ###############################################
-echo # First start of Lenya. Unpacking now... #
-echo ###############################################
-
-mkdir build\lenya\webapp
-cd build\lenya\webapp
-"%JAVA_HOME%\bin\jar.exe" -xf ..\..\..\lenya.war
-cd ..\..\..
-mkdir build\lenya\webapp\WEB-INF\logs
-
-:: ----- Check action ----------------------------------------------------------
-:action
-if ""%1"" == ""cli"" goto doCli
-if ""%1"" == ""servlet"" goto doServlet
-if ""%1"" == ""servlet-admin"" goto doAdmin
-if ""%1"" == ""servlet-debug"" goto doDebug
-IF ""%1"" == ""servlet-profile"" goto doProfile
-goto doServlet
-
-echo Usage: lenya (action)
-echo actions:
-echo cli Run Lenya from command line
-echo servlet Run Lenya in a servlet container
-echo servlet-admin Run Lenya in a servlet container and turn container web administration on
-echo servlet-debug Run Lenya in a servlet container and turn on remote JVM debug
-echo servlet-profile Run Lenya in a servlet container and turn on JVM profiling
-goto end
-
-:: ----- Cli -------------------------------------------------------------------
-
-:doCli
-set param=
-shift
-:cliLoop
-if "%1"=="" goto cliLoopEnd
-if not "%1"=="" set param=%param% %1
-shift
-goto cliLoop
-
-:cliLoopEnd
-
-"%JAVA_HOME%\bin\java.exe" %JAVA_OPTIONS% -classpath %CP% -Djava.endorsed.dirs=%LENYA_LIB%\endorsed -Dloader.jar.repositories=%LENYA_LIB% -Dloader.main.class=org.apache.cocoon.Main Loader %param%
-goto end
-
-:: ----- Servlet ---------------------------------------------------------------
-
-:doServlet
-%EXEC% "%JAVA_HOME%\bin\java.exe" %JAVA_OPTIONS% -classpath %CP% -Djava.endorsed.dirs=%LENYA_LIB%\endorsed -Dwebapp=%JETTY_WEBAPP% -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -Djetty.port=%JETTY_PORT% -Djetty.admin.port=%JETTY_ADMIN_PORT% -Dhome=%LENYA_HOME% "-Dloader.jar.repositories=%LENYA_HOME%\tools\jetty\lib;%LENYA_HOME%\tools\jetty\extra\lib;%LENYA_HOME%\tools\jetty\extra\ext;%LENYA_HOME%\tools\jetty\ext;%LENYA_HOME%\tools\jetty\extra\resources;%LENYA_LIB%\endorsed" -Dloader.main.class=org.mortbay.jetty.plus.Server -Dorg.mortbay.util.URI.charset=%JETTY_URI_CHARSET% Loader %LENYA_HOME%\tools\jetty\conf\main.xml
-goto end
-
-:: ----- Servlet with Administration Web Interface -----------------------------
-
-:doAdmin
-%EXEC% "%JAVA_HOME%\bin\java.exe" %JAVA_OPTIONS% -classpath %CP% -Djava.endorsed.dirs=%LENYA_LIB%\endorsed -Dwebapp=%JETTY_WEBAPP% -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -Djetty.port=%JETTY_PORT% -Djetty.admin.port=%JETTY_ADMIN_PORT% -Dhome=%LENYA_HOME% "-Dloader.jar.repositories=%LENYA_HOME%\tools\jetty\lib;%LENYA_HOME%\tools\jetty\extra\lib;%LENYA_HOME%\tools\jetty\extra\ext;%LENYA_HOME%\tools\jetty\ext;%LENYA_HOME%\tools\jetty\extra\resources;%LENYA_LIB%\endorsed" -Dloader.main.class=org.mortbay.jetty.plus.Server -Dorg.mortbay.util.URI.charset=%JETTY_URI_CHARSET% Loader %LENYA_HOME%\tools\jetty\conf\main.xml %LENYA_HOME%\tools\jetty\conf\admin.xml
-goto end
-
-:: ----- Servlet Debug ---------------------------------------------------------
-
-:doDebug
-%EXEC% "%JAVA_HOME%\bin\java.exe" %JAVA_OPTIONS% -Xdebug -Xrunjdwp:transport=dt_socket,address=%JAVA_DEBUG_PORT%,server=y,suspend=n -classpath %CP% -Djava.endorsed.dirs=%LENYA_LIB%\endorsed -Dwebapp=%JETTY_WEBAPP% -Dhome=%LENYA_HOME% -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -Djetty.port=%JETTY_PORT% -Djetty.admin.port=%JETTY_ADMIN_PORT% "-Dloader.jar.repositories=%LENYA_HOME%\tools\jetty\lib;%LENYA_HOME%\tools\jetty\extra\lib;%LENYA_HOME%\tools\jetty\extra\ext;%LENYA_HOME%\tools\jetty\ext;%LENYA_HOME%\tools\jetty\extra\resources;%LENYA_LIB%\endorsed" -Dloader.main.class=org.mortbay.jetty.plus.Server -Dorg.mortbay.util.URI.charset=%JETTY_URI_CHARSET% Loader %LENYA_HOME%\tools\jetty\conf\main.xml
-goto end
-
-:: ----- Servlet Profile ---------------------------------------------------------
-
-:doProfile
-%EXEC% "%JAVA_HOME%\bin\java.exe" %JAVA_OPTIONS% -Xrunhprof:heap=all,cpu=samples,thread=y,depth=3 -classpath %CP% -Djava.endorsed.dirs=%LENYA_LIB%\endorsed -Dwebapp=%JETTY_WEBAPP% -Dhome=%LENYA_HOME% -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -Djetty.port=%JETTY_PORT% -Djetty.admin.port=%JETTY_ADMIN_PORT% "-Dloader.jar.repositories=%LENYA_HOME%\tools\jetty\lib;%LENYA_HOME%\tools\jetty\extra\lib;%LENYA_HOME%\tools\jetty\extra\ext;%LENYA_HOME%\tools\jetty\ext;%LENYA_HOME%\tools\jetty\extra\resources;%LENYA_LIB%\endorsed" -Dloader.main.class=org.mortbay.jetty.plus.Server -Dorg.mortbay.util.URI.charset=%JETTY_URI_CHARSET% Loader %LENYA_HOME%\tools\jetty\conf\main.xml
-
-:: ----- End -------------------------------------------------------------------
-
-:end
-set CP=
-set EXEC=
-
diff --git a/trunk/lenya.nsi b/trunk/lenya.nsi
deleted file mode 100644
index c31d72f..0000000
--- a/trunk/lenya.nsi
+++ /dev/null
@@ -1,165 +0,0 @@
-;NSIS Lenya Installer script
-
-; Licensed to the Apache Software Foundation (ASF) under one or more
-; contributor license agreements. See the NOTICE file distributed with
-; this work for additional information regarding copyright ownership.
-; The ASF licenses this file to You under the Apache License, Version 2.0
-; (the "License"); you may not use this file except in compliance with
-; the License. You may obtain a copy of the License at
-;
-; http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing, software
-; distributed under the License is distributed on an "AS IS" BASIS,
-; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-; See the License for the specific language governing permissions and
-; limitations under the License.
-
-; $Id$
-
-;--------------------------------
-;Include Modern UI
-
- !include "MUI.nsh"
-
-;--------------------------------
-;Configuration
-
- ;General
- Var product_name
- Name "Apache Lenya 2.0-dev"
- OutFile "apache-lenya-2.0-dev-bin.exe"
-
- CRCCheck on
- SetCompress force
- SetDatablockOptimize on
-
- ;Folder selection page
- InstallDir "C:\apache-lenya-2.0-dev"
-
-;--------------------------------
-;Interface Settings
-
- !define MUI_ABORTWARNING
-
-;--------------------------------
-;Pages
-
- !insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
- !insertmacro MUI_PAGE_COMPONENTS
- !insertmacro MUI_PAGE_DIRECTORY
- !insertmacro MUI_PAGE_INSTFILES
-
- !insertmacro MUI_UNPAGE_CONFIRM
- !insertmacro MUI_UNPAGE_INSTFILES
-
-;--------------------------------
-;Languages
-
- !insertmacro MUI_LANGUAGE "English"
-
-;--------------------------------
-;Installer Sections
-
-Section "Apache Lenya 2.0-dev" SecDummy
-
- Call findJavaPath
- StrCpy $product_name "Apache Lenya 2.0-dev"
- SetOutPath $INSTDIR
-
- SetOutPath $INSTDIR\build\lenya\webapp
- File build\lenya\webapp\global-sitemap.xmap
- File build\lenya\webapp\sitemap.xmap
- File /r build\lenya\webapp\lenya
- File /r build\lenya\webapp\WEB-INF
-
- SetOutPath $INSTDIR
- File lenya.bat
- File build.properties
- File build.xml
- File NOTICE.txt
- File LICENSE.txt
- File README.txt
- File CREDITS.txt
- File /r tools
- File /r legal
-
- CreateDirectory "$SMPROGRAMS\$product_name"
- CreateShortCut "$SMPROGRAMS\$product_name\Apache Lenya Home Page.lnk" \
- "http://lenya.apache.org/"
-
- CreateShortCut "$SMPROGRAMS\$product_name\Welcome to $product_name.lnk" \
- "http://127.0.0.1:8888"
-
- CreateShortCut "$SMPROGRAMS\$product_name\Uninstall $product_name.lnk" \
- "$INSTDIR\Uninstall.exe"
-
- CreateShortCut "$SMPROGRAMS\$product_name\Start $product_name.lnk" \
- "$INSTDIR\lenya.bat" \
- 'servlet' \
- "$INSTDIR\lenya.bat" 1 SW_SHOWNORMAL
-
- ClearErrors
-
- ;Start Apache Lenya, wait 12 seconds to give it time to start, then launch start page
- ExecShell "open" '"$INSTDIR\lenya.bat"' 0 SW_SHOWMINIMIZED
- ;Create uninstaller
- WriteUninstaller "$INSTDIR\Uninstall.exe"
- Sleep 12000
- ExecShell "open" '"http://127.0.0.1:8888"' 0 SW_SHOWNORMAL
- Quit
-SectionEnd
-
-;--------------------------------
-;Descriptions
-
- LangString DESC_SecDummy ${LANG_ENGLISH} "Installs the Apache Lenya 2.0-dev Content Management System."
-
- !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
- !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
- !insertmacro MUI_FUNCTION_DESCRIPTION_END
-
-;--------------------------------
-;Uninstaller Section
-
-Section "Uninstall"
- RMDir /r "$SMPROGRAMS\Apache Lenya 2.0-dev"
- RMDir /r "$INSTDIR"
-SectionEnd
-
-; =====================
-; FindJavaPath Function
-; =====================
-;
-; Find the JAVA_HOME used on the system, and put the result on the top of the
-; stack
-; Will exit if the path cannot be determined
-;
-Function findJavaPath
-
- ClearErrors
-
- ReadEnvStr $1 JAVA_HOME
-
- IfErrors 0 FoundJDK
-
- ClearErrors
-
- ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
- ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$2" "JavaHome"
- ReadRegStr $3 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
- ReadRegStr $4 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$3" "RuntimeLib"
-
- FoundJDK:
-
- IfErrors 0 NoAbort
- MessageBox MB_OK "Couldn't find a Java Development Kit installed on this \
-computer. Please download one from http://java.sun.com. If there is already \ a JDK installed on this computer, set an environment variable JAVA_HOME to the \ pathname of the directory where it is installed."
- Abort
-
- NoAbort:
-
- ; Put the result in the stack
- Push $1
-
-FunctionEnd
diff --git a/trunk/lenya.sh b/trunk/lenya.sh
deleted file mode 100755
index b19d2b8..0000000
--- a/trunk/lenya.sh
+++ /dev/null
@@ -1,218 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# -----------------------------------------------------------------------------
-# Lenya Unix Shell Script
-#
-# $Id$
-# -----------------------------------------------------------------------------
-
-# Configuration variables
-#
-# LENYA_HOME
-# The root of the Lenya distribution
-#
-# LENYA_WEBAPP_HOME
-# The root of the Lenya web application
-#
-# LENYA_LIB
-# Folder containing all the library files needed by the Lenya CLI
-#
-# JAVA_HOME
-# Home of Java installation.
-#
-# JAVA_OPTIONS
-# Extra options to pass to the JVM
-#
-# JAVA_DEBUG_ARGS
-# The command line arguments for the internal JVM debugger
-#
-# JAVA_PROFILE_ARGS
-# The command line arguments for the internal JVM profiler
-#
-# JETTY_PORT
-# Override the default port for Jetty
-#
-# JETTY_ADMIN_PORT
-# The port where the jetty web administration should bind
-#
-
-
-usage()
-{
- echo "Usage: $0 (action)"
- echo "actions:"
- echo " cli Run Lenya from the command line"
- echo " servlet Run Lenya in a servlet container"
- echo " servlet-admin Run Lenya in a servlet container and turn on container web administration"
- echo " servlet-debug Run Lenya in a servlet container and turn on JVM remote debug"
- echo " servlet-profile Run Lenya in a servlet container and turn on JVM profiling"
- exit 1
-}
-
-#[ $# -gt 0 ] || usage
-
-DEFAULT_ACTION="servlet"
-ACTION=$1
-if [ -n "$ACTION" ]
-then
- shift
-else
- ACTION=$DEFAULT_ACTION
- echo "$0: executing default action '$ACTION', use -h to see other actions"
-fi
-ARGS="$*"
-
-# ----- Verify and Set Required Environment Variables -------------------------
-
-if [ "$JAVA_HOME" = "" ] ; then
- echo You must set JAVA_HOME to point at your Java Development Kit installation
- exit 1
-fi
-
-if [ "$JAVA_OPTIONS" = "" ] ; then
- JAVA_OPTIONS='-Xms32M -Xmx512M -Djava.awt.headless=true'
-fi
-
-if [ "$LENYA_HOME" = "" ] ; then
- LENYA_HOME='.'
- # TODO: Make it startable from any directory
- #LENYA_HOME=`dirname $0`
- #echo "LENYA_HOME: $LENYA_HOME"
-fi
-
-if [ "$LENYA_WEBAPP_HOME" = "" ] ; then
- STANDALONE_WEBAPP=../webapp
- if [ -d $STANDALONE_WEBAPP ] ; then
- # for standalone-webapp setup
- LENYA_WEBAPP_HOME=$STANDALONE_WEBAPP
- else
- # when in the build environment
- LENYA_WEBAPP_HOME="$LENYA_HOME/build/lenya/webapp"
- fi
-fi
-echo "$0: using $LENYA_WEBAPP_HOME as the webapp directory"
-
-if [ "$LENYA_LIB" = "" ] ; then
- LENYA_LIB="$LENYA_WEBAPP_HOME/WEB-INF/lib"
-fi
-
-
-# Set Jetty Port
-if [ -f local.build.properties ] ; then
- JETTY_PORT=`grep web.app.server.jetty.port $LENYA_HOME/local.build.properties | grep -v "#" | sed -e 's/web\.app\.server\.jetty\.port=//'`
-fi
-if [ "$JETTY_PORT" = "" ] ; then
- JETTY_PORT=`grep web.app.server.jetty.port $LENYA_HOME/build.properties | grep -v "#" | sed -e 's/web\.app\.server\.jetty\.port=//'`
-fi
-echo "INFO: Jetty Port is $JETTY_PORT"
-
-# Set Jetty Admin Port
-if [ -f local.build.properties ] ; then
- JETTY_ADMIN_PORT=`grep web.app.server.jetty.admin.port $LENYA_HOME/local.build.properties | grep -v "#" | sed -e 's/web\.app\.server\.jetty\.admin\.port=//'`
-fi
-if [ "$JETTY_ADMIN_PORT" = "" ] ; then
- JETTY_ADMIN_PORT=`grep web.app.server.jetty.admin.port $LENYA_HOME/build.properties | grep -v "#" | sed -e 's/web\.app\.server\.jetty\.admin\.port=//'`
-fi
-echo "INFO: Jetty Admin Port is $JETTY_ADMIN_PORT"
-
-if [ "$JAVA_DEBUG_ARGS" = "" ] ; then
- JAVA_DEBUG_ARGS='-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n'
-fi
-
-if [ "$JAVA_PROFILE_ARGS" = "" ] ; then
- JAVA_PROFILE_ARGS='-Xrunhprof:heap=all,cpu=samples,thread=y,depth=3'
-fi
-
-
-# ----- Set platform specific variables
-
-PATHSEP=":";
-case "`uname`" in
- CYGWIN*) PATHSEP=";" ;;
-esac
-
-# ----- Set Local Variables ( used to minimize cut/paste) ---------------------
-
-JAVA="$JAVA_HOME/bin/java"
-ENDORSED_LIBS="${LENYA_HOME}/externals/cocoon_2_1_x/lib/endorsed"
-ENDORSED="-Djava.endorsed.dirs=$ENDORSED_LIBS"
-PARSER=-Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser
-LOADER=Loader
-LOADER_LIB="${LENYA_HOME}/tools/loader"
-
-CLI=-Dloader.main.class=org.apache.lenya.Main
-CLI_LIBRARIES="-Dloader.jar.repositories=$LENYA_LIB"
-
-JETTY=-Dloader.main.class=org.mortbay.jetty.plus.Server
-JETTY_CONF="$LENYA_HOME/tools/jetty/conf"
-JETTY_MAIN="$JETTY_CONF/main.xml"
-JETTY_ADMIN="$JETTY_CONF/admin.xml"
-JETTY_WEBAPP="-Dwebapp=$LENYA_WEBAPP_HOME"
-JETTY_HOME="-Dhome=$LENYA_HOME"
-JETTY_PORT_ARGS="-Djetty.port=$JETTY_PORT"
-JETTY_ADMIN_ARGS="-Djetty.admin.port=$JETTY_ADMIN_PORT"
-JETTY_LIBRARIES="-Dloader.jar.repositories=$LENYA_HOME/tools/jetty/lib${PATHSEP}$LENYA_HOME/tools/jetty/extra/lib${PATHSEP}$LENYA_HOME/tools/jetty/extra/ext${PATHSEP}$LENYA_HOME/tools/jetty/ext${PATHSEP}$LENYA_HOME/tools/jetty/extra/resources${PATHSEP}${ENDORSED_LIBS}"
-JETTY_URI_CHARSET="-Dorg.mortbay.util.URI.charset=ISO-8859-1"
-
-# ----- Do the action ----------------------------------------------------------
-
-if [ -d build ]; then
- echo "INFO: build/lenya/webapp directory already exists."
-else
- if [ -f lenya.war ]; then
- echo "INFO: lenya.war will be unpacked ..."
- mkdir -p build/lenya/webapp
- cp lenya.war build/lenya/webapp/.
- cd build/lenya/webapp
- $JAVA_HOME/bin/jar -xf lenya.war
- cd ../../..
- mkdir -p build/lenya/webapp/WEB-INF/logs
- rm build/lenya/webapp/lenya.war
- else
- echo "INFO: No such war file lenya.war or build directory!"
- exit 1
- fi
-fi
-
-case "$ACTION" in
- cli)
- $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $CLI_LIBRARIES $CLI $LOADER $ARGS
- ;;
-
- servlet)
- $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY_URI_CHARSET $JETTY $LOADER $JETTY_MAIN
- ;;
-
- servlet-admin)
- $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS $JETTY_ADMIN_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY_URI_CHARSET $JETTY $LOADER $JETTY_MAIN $JETTY_ADMIN
- ;;
-
- servlet-debug)
- $JAVA $JAVA_OPTIONS $JAVA_DEBUG_ARGS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_PORT_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY_URI_CHARSET $JETTY $LOADER $JETTY_MAIN
- ;;
-
- servlet-profile)
- $JAVA $JAVA_OPTIONS $JAVA_PROFILE_ARGS -cp $LOADER_LIB $ENDORSED $PARSER $JETTY_ARGS $JETTY_LIBRARIES $JETTY_WEBAPP $JETTY_HOME $JETTY_URI_CHARSET $JETTY $LOADER $JETTY_MAIN
- ;;
-
- *)
- usage
- ;;
-esac
-
-exit 0
diff --git a/trunk/lib/commons-codec-1.3.jar b/trunk/lib/commons-codec-1.3.jar
deleted file mode 100644
index 957b675..0000000
--- a/trunk/lib/commons-codec-1.3.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/commons-validator-1.3.1.jar b/trunk/lib/commons-validator-1.3.1.jar
deleted file mode 100644
index 55b12b1..0000000
--- a/trunk/lib/commons-validator-1.3.1.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/excalibur-testcase-1.0.jar b/trunk/lib/excalibur-testcase-1.0.jar
deleted file mode 100644
index 90f651b..0000000
--- a/trunk/lib/excalibur-testcase-1.0.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/jackrabbit-1.0-LCR330244.jar b/trunk/lib/jackrabbit-1.0-LCR330244.jar
deleted file mode 100644
index 847b355..0000000
--- a/trunk/lib/jackrabbit-1.0-LCR330244.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/jackrabbit-commons-1.0-LCR330244.jar b/trunk/lib/jackrabbit-commons-1.0-LCR330244.jar
deleted file mode 100644
index e03e04a..0000000
--- a/trunk/lib/jackrabbit-commons-1.0-LCR330244.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/jcifs-mock.jar b/trunk/lib/jcifs-mock.jar
deleted file mode 100644
index 2a5fdd3..0000000
--- a/trunk/lib/jcifs-mock.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/jcr-1.0.jar b/trunk/lib/jcr-1.0.jar
deleted file mode 100644
index dcb71cf..0000000
--- a/trunk/lib/jcr-1.0.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/jing-20030619.jar b/trunk/lib/jing-20030619.jar
deleted file mode 100644
index 6acbfb0..0000000
--- a/trunk/lib/jing-20030619.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/junit-3.8.1.jar b/trunk/lib/junit-3.8.1.jar
deleted file mode 100644
index 674d71e..0000000
--- a/trunk/lib/junit-3.8.1.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/nekodtd-0.1.11.jar b/trunk/lib/nekodtd-0.1.11.jar
deleted file mode 100644
index 96e0c30..0000000
--- a/trunk/lib/nekodtd-0.1.11.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/nekopull-0.2.4.jar b/trunk/lib/nekopull-0.2.4.jar
deleted file mode 100644
index 49b7c28..0000000
--- a/trunk/lib/nekopull-0.2.4.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/websphinx-0.5.jar b/trunk/lib/websphinx-0.5.jar
deleted file mode 100644
index 0fefd94..0000000
--- a/trunk/lib/websphinx-0.5.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/xercesImpl-2.9.0.jar b/trunk/lib/xercesImpl-2.9.0.jar
deleted file mode 100644
index 50df930..0000000
--- a/trunk/lib/xercesImpl-2.9.0.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/xml-apis-1.3.04.jar b/trunk/lib/xml-apis-1.3.04.jar
deleted file mode 100644
index d42c0ea..0000000
--- a/trunk/lib/xml-apis-1.3.04.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/xml-forrest-r428652.jar b/trunk/lib/xml-forrest-r428652.jar
deleted file mode 100644
index 38ef09d..0000000
--- a/trunk/lib/xml-forrest-r428652.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/lib/xmlunit1.0.jar b/trunk/lib/xmlunit1.0.jar
deleted file mode 100644
index 6e8ed58..0000000
--- a/trunk/lib/xmlunit1.0.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/src/README_AC.txt b/trunk/src/README_AC.txt
deleted file mode 100644
index ccb0fec..0000000
--- a/trunk/src/README_AC.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-Access Control Specification
-
- * Possibility to deny permissions
-
-Terminology
-
- * An accreditable is either a user, a group, an IP range, or the world.
- * A credential is an assignment of a role to an accreditable.
-
-Names
-
- * We use the following names:
- o n - a node
- o parent(n) - the parent node of n
- o n.c1, ..., n.ci - the credentials of the node n
- o acc(c) - the accreditable which the credential refers to
- o role(c) - the role which the credential assignes to the accreditable
- o method(c) - the method of the credential
-
-Concept
-
- * Credential methods can be grant or deny.
- * The order of credentials at a node is important.
- * To find out if a certain accreditable a has a role r for the node n, use the following algorithm:
- o Search for the first matching credential, starting with the first credential of the node n.
- o If no credential of n matches the accreditable, continue with the parent node.
- o When a credential is found which assigns the role r to the accreditable a, return the method of the credential.
- o If no credential is found up to the top, return deny.
-
-Role resolving algorithm
-
- * while not matched:
- o for c : n.ci to n.c1:
- + if acc(c) = a and role(c) = r, return method(c)
- o n := parent(n)
- * return deny
-
-User interface
-
-The user interface has to allow the following operations:
-
- * add/remove credentials for users, groups, world
- * set the credential method
- * change credential order (move up/down)
-
-**************************************************************
-Examples:
-*********
-Like stated above the order of the credential is important.
-Credentials are builded from policies.
-Imaginge you are trying to access http://localhost:8888/default/introduction.html
-
-The defined policy (with highest priority) would be:
-config/ac/policies/introduction.html/subtree-policy.acml
-
-Imaginge you have defined:
-<policy xmlns="http://apache.org/cocoon/lenya/ac/1.0">
- <world>
- <role id="visit" method="deny"/>
- </world>
- <group id="editor">
- <role id="edit" method="grant"/>
- </group>
-</policy>
-
-Then you try to login in with user "lenya" who is in the editor group.
-However you will not be successful, because everybody always is world.
-Since the DENY of world is coming first nobody will now be able to see
-the page.
-
-Changing above policy to
-<policy xmlns="http://apache.org/cocoon/lenya/ac/1.0">
- <group id="editor">
- <role id="edit" method="grant"/>
- </group>
- <world>
- <role id="visit" method="deny"/>
- </world>
-</policy>
-
-Let all user of the group editor access the page.
-
-Best practise is to deny access early in a node tree of policies for e.g. WORLD.
\ No newline at end of file
diff --git a/trunk/src/README_MODULES.txt b/trunk/src/README_MODULES.txt
deleted file mode 100644
index ff6c150..0000000
--- a/trunk/src/README_MODULES.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-Module categories:
-==================
-
-The modules in Lenya are currently split up into the following categories:
-
-* modules-core
- This set of modules implements the core functionality of Lenya.
- Modules in the core will not have any dependencies outside of the core.
-
-
-* modules
- This is where most of the add-on functionality goes: support for specific
- editors, document types, the nifty new feature of the day, etc.
-
-
-* modules-optional
- The scratchpad. Modules in here do not necessarily have to work or even
- compile, nor have a stable API. (FIXME: should modules that require
- external code to be useful also be moved here, such as tinymce or
- fckeditor?
-
-
-* modules-legacy
- This is the place for modules that do not adhere to the programming
- conventions of the trunk, but are still needed as no updated version is
- available. For instance, modules that use the 1.2 way of handling usecases
- without using the usecase framework should go here. (FIXME: does that make
- the kupu module a candidate?)
-
-Directory Layout:
-=================
-
-Each module should adhere to the following directory layout (subdirectories
-if appropriate, take a look at the core modules if in doubt):
-
-mymodule/
- config/ configuration files
- module.xml module descriptor
- cocoon-xconf/ patches for cocoon.xconf:
- component-mycomponent.xconf
- usecase-myusecase.xconf
- usecases/
- myusecase.jx usecase view
- java/
- src/ Java source files
- lib/ Java libraries
- xslt/ XSLT stylesheets
- sitemap.xmap main module sitemap
-
-
-module.xml
-==========
-
-Each module must contain a description file config/module.xml:
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <!-- the ID *must* start with the package name of
- your custom Java code -->
- <id>org.myproject.lenya.modules.myeditor</id>
- <!-- build dependencies; see note below -->
- <depends module="org.apache.lenya.modules.usecase"/>
- <depends module="org.apache.lenya.modules.webdav"/>
- <!-- the Java package your module belongs to -->
-FIXME: why is this needed? afaiu it could be gleaned from the id...
- <package>org.myproject.lenya.modules</package>
- <!-- a version string -->
-FIXME: what does this do? just for information, or is there version
-management?
- <version>0.1-dev</version>
- <!-- a short name for your module -->
- <name>My Own Editor</name>
- <!-- the required lenya version -->
-FIXME: is this actually used?
- <lenya-version>2.0-dev</lenya-version>
- <!-- a detailed description of your module -->
- <description>
- This is my own editor.
- For more information, visit http://myproject.org/editor.
- </description>
-</module>
-
-NOTE: be careful to specify the depencies correctly. The <depends/> element
-is meant for java code dependencies only, i.e. issues that affect
-compilation. If a module merely links to another module's usecases in its
-views, that does not qualify as a dependency (although maybe it should at
-some point in the future).
-
-
-see also:
-=========
-
-Please refer to the online docs at
-http://lenya.apache.org/docs/1_4/reference/modules/index.html.
diff --git a/trunk/src/cocoon/local.blocks.properties b/trunk/src/cocoon/local.blocks.properties
deleted file mode 100644
index 14ce102..0000000
--- a/trunk/src/cocoon/local.blocks.properties
+++ /dev/null
@@ -1,190 +0,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.
-#
-
-#------------------------------------------------------------------------------------
-# Blocks properties version to make sure that local.blocks.properties is kept in sync
-# NOTE: Do NOT modify this number unless you are a Dev and want to modify this file
-# NOTE for Devs: Update this number if this file is being updated.
-# Also update the version number within src/targets/init-build.xml
-
-lenya.blocks.properties.version=426603
-lenya.version=2.0-dev
-
-#------------------------------------------------------------------------------#
-# Cocoon Blocks #
-#------------------------------------------------------------------------------#
-
-# Remove blocks from your cocoon distribution by setting the corresponding
-# include property to true or false. The blocks are included by default, i.e. if
-# no property was set.
-
-# NOTE: Don't modify this file directly but make a copy named
-# 'local.blocks.properties' and modify that. The build system will first load
-# 'local.blocks.properties' and properties are immutable in Ant.
-
-# NOTE: "[dependency]" indicates blocks that are required by other blocks.
-# Disabling batik, for example, will result in a RuntimeException when using
-# fop. Dependencies only needed for the block's samples are marked explicitely.
-# This latter information was introduced only short time ago, so do not expect
-# it to be complete.
-
-# NOTE: (to Cocoon committers): blocks.properties is generated from gump.xml
-# using "build generate-blocks.properties". Any changes to blocks definitions
-# must be made in gump.xml, not here.
-
-# All blocks -------------------------------------------------------------------
-
-# Use this property to exclude all blocks at once
-# exclude.all.blocks=true
-
-# Use this property to include all blocks at once
-# include.all.blocks=true
-
-
-# Stable blocks ----------------------------------------------------------------
-
-# Stable blocks are those that can be considered ready for production and
-# will contain components and API that will remain stable and where
-# developers are committed to back compatibility. In short, stuff that you
-# can depend on.
-
-#-----[dependency]: "authentication-fw" depends on "session-fw".
-#-----[dependency]: "authentication-fw" is needed by "portal", "portal-fw".
-include.block.authentication-fw=false
-#-----[dependency]: "batik" is needed by "fop", "tour".
-#include.block.batik=false
-include.block.bsf=false
-#include.block.chaperon=false
-#-----[dependency]: "databases" depends on "xsp".
-#-----[dependency]: "databases" is needed by "hsqldb", "jms", "ojb", "petstore", "repository", "xmldb".
-#include.block.databases=false
-#-----[dependency]: "fop" depends on "batik".
-#-----[dependency]: "fop" is needed by "tour".
-#include.block.fop=false
-#-----[dependency]: "hsqldb" depends on "databases".
-#-----[dependency]: "hsqldb" is needed by "jms", "ojb", "petstore".
-#include.block.hsqldb=false
-#include.block.html=false
-#-----[dependency]: "itext" depends on "xsp" (for samples).
-include.block.itext=false
-include.block.jfor=false
-include.block.jsp=false
-#-----[dependency]: "linkrewriter" depends on "xsp".
-#include.block.linkrewriter=false
-#-----[dependency]: "lucene" is needed by "querybean".
-include.block.lucene=true
-include.block.midi=false
-#include.block.naming=false
-#-----[dependency]: "ojb" depends on "databases" (for samples), "forms" (for samples), "hsqldb" (for samples).
-#-----[dependency]: "ojb" is needed by "javaflow", "portal", "querybean".
-include.block.ojb=false
-include.block.paranoid=false
-include.block.poi=false
-#-----[dependency]: "portal" depends on "authentication-fw", "cron", "forms", "ojb", "session-fw".
-#-----[dependency]: "portal" is needed by "faces".
-include.block.portal=false
-#include.block.profiler=false
-#-----[dependency]: "python" depends on "xsp".
-include.block.python=false
-#-----[dependency]: "session-fw" depends on "xsp".
-#-----[dependency]: "session-fw" is needed by "authentication-fw", "portal", "portal-fw".
-#include.block.session-fw=false
-#-----[dependency]: "velocity" is needed by "petstore".
-include.block.velocity=false
-include.block.web3=false
-#-----[dependency]: "xmldb" depends on "databases".
-# TODO: Including the xmldb block might cause a conflict with the patched xmldb libraries lib/xmldb-common-2003-09-02.jar and lib/xmldb-xupdate-2003-10-14.jar
-include.block.xmldb=false
-#-----[dependency]: "xsp" is needed by "databases", "itext", "linkrewriter", "python", "session-fw", "woody".
-#include.block.xsp=false
-
-# Deprecated blocks ------------------------------------------------------------
-
-# Although some of these blocks may have been stable, they are now deprecated
-# in favour of other blocks and therefore are excluded by default from the build.
-# For including one of them you have to set the exclude property into comment in
-# blocks.properties.
-
-include.block.php=false
-#-----[dependency]: "portal-fw" depends on "authentication-fw", "session-fw".
-include.block.portal-fw=false
-include.block.swf=false
-#-----[dependency]: "woody" depends on "xsp" (for samples).
-include.block.woody=false
-
-# Unstable blocks --------------------------------------------------------------
-
-# Unstable blocks are currently under development and do not guarantee that the
-# contracts they expose (API, xml schema, properties, behavior) will remain
-# constant in time. Developers are not committed to back-compatibility just yet.
-# This doesn't necessarily mean the blocks implementation is unstable or
-# the code can't be trusted for production, but use with care and watch
-# its development as things might change over time before they are marked
-# stable.
-
-#-----[dependency]: "ajax" is needed by "forms".
-#include.block.ajax=false
-#-----[dependency]: "apples" depends on "forms" (for samples).
-include.block.apples=false
-#-----[dependency]: "asciiart" is needed by "mail".
-include.block.asciiart=true
-include.block.axis=true
-#include.block.captcha=false
-#-----[dependency]: "cron" is needed by "jms", "portal".
-include.block.cron=true
-#include.block.deli=false
-#-----[dependency]: "eventcache" depends on "jms".
-#-----[dependency]: "eventcache" is needed by "repository".
-include.block.eventcache=false
-#-----[dependency]: "faces" depends on "portal", "taglib".
-include.block.faces=false
-#-----[dependency]: "forms" depends on "ajax".
-#-----[dependency]: "forms" is needed by "apples", "javaflow", "ojb", "petstore", "portal", "querybean", "tour".
-#include.block.forms=false
-#include.block.imageop=false
-#-----[dependency]: "javaflow" depends on "forms", "ojb".
-include.block.javaflow=false
-#include.block.jcr=false
-#-----[dependency]: "jms" depends on "cron", "databases" (for samples), "hsqldb".
-#-----[dependency]: "jms" is needed by "eventcache", "slide".
-include.block.jms=false
-include.block.linotype=false
-#-----[dependency]: "mail" depends on "asciiart".
-include.block.mail=true
-#-----[dependency]: "petstore" depends on "databases", "forms", "hsqldb", "velocity".
-include.block.petstore=false
-#include.block.proxy=false
-include.block.qdox=false
-#-----[dependency]: "querybean" depends on "forms" (for samples), "lucene", "ojb".
-#include.block.querybean=false
-#-----[dependency]: "repository" depends on "databases", "eventcache".
-#-----[dependency]: "repository" is needed by "slide", "webdav".
-include.block.repository=false
-#include.block.serializers=false
-#-----[dependency]: "slide" depends on "jms", "repository".
-include.block.slide=false
-#-----[dependency]: "slop" is needed by "tour".
-include.block.slop=false
-include.block.stx=false
-#-----[dependency]: "taglib" is needed by "faces".
-include.block.taglib=false
-#-----[dependency]: "tour" depends on "batik", "fop", "forms", "slop".
-include.block.tour=false
-#include.block.validation=false
-#-----[dependency]: "webdav" depends on "repository".
-include.block.webdav=false
-#include.block.xsltal=false
diff --git a/trunk/src/cocoon/local.build.properties b/trunk/src/cocoon/local.build.properties
deleted file mode 100644
index 46e74fa..0000000
--- a/trunk/src/cocoon/local.build.properties
+++ /dev/null
@@ -1,202 +0,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.
-#
-
-#------------------------------------------------------------------------------------
-# Build properties version to make sure that local.build.properties is kept in sync
-# NOTE: Do NOT modify this number unless you are a Dev and want to modify this file
-# NOTE for Devs: Update this number if this file is being updated.
-# Also update the version number within src/targets/init-build.xml
-
-lenya.build.properties.version=529161
-lenya.version=2.0-dev
-
-#----------------------------------------------
-# Cocoon Build Properties
-#----------------------------------------------
-
-# NOTE: don't modify this file directly but copy the properties you need
-# to modify over to a file named 'local.build.properties' and modify that.
-# The build system will override these properties with the ones in the
-# 'local.build.properties' file.
-
-# ---- Webapp ------------------------------------------------------------------
-
-exclude.webapp.documentation=true
-exclude.webapp.javadocs=true
-exclude.webapp.idldocs=true
-exclude.webapp.samples=true
-
-# ---- Build Exclusions --------------------------------------------------------
-
-exclude.deprecated=true
-exclude.documentation=true
-exclude.javadocs=true
-#include.sources-in-jars=true
-
-# ---- Configuration -----------------------------------------------------------
-
-#include.driver.oracle=true
-#include.driver.postgre=true
-#include.driver.odbc=true
-config.allow-reloads=false
-
-# TODO: Since externals/cocoon_2_1_x/src/webapp/WEB-INF/web.xml is true already this won't help ...
-config.enable-uploads=false
-#config.enable-instrumentation=true
-
-# ---- Validation --------------------------------------------------------------
-
-#exclude.validate.config=true
-exclude.validate.xdocs=true
-#exclude.validate.jars=true
-
-# ---- Forrest -----------------------------------------------------------------
-
-# set $FORREST_HOME and $PATH as instructed by Forrest
-
-# ---- Anteater ----------------------------------------------------------------
-
-anteater.home = /default-from-build.properties/anteater-0.9.16
-anteater.target.host = localhost
-anteater.target.port = 8888
-anteater.target.base.path = /
-anteater.option.haltonerror = true
-
-# disable some long-running tests by default
-# anteater.test.bug26186InternalRequestMemoryLeak.enabled = true
-
-# ---- JUnit -------------------------------------------------------------------
-
-junit.test.debugport=8000
-#junit.testcase=org.apache.cocoon.util.test.NetUtilsTestCase
-
-# ---- Build -------------------------------------------------------------------
-
-build.root=build
-build=${build.root}/${name}-${version}
-build.dest=${build}/classes
-build.mocks=${build}/mocks
-build.test=${build}/test
-build.test.output=${build.test}/output
-build.docs=${build}/docs
-build.docs.printer=${build}/printer-docs
-build.site=${build}/site
-build.xdocs=${build}/xdocs
-build.javadocs=${build}/javadocs
-build.context=${build}/documentation
-build.context.printer=${build}/printer-documentation
-build.blocks=${build}/blocks
-build.deprecated=${build}/deprecated
-build.samples=${build}/samples
-build.temp=${build}/temp
-build.mounttable=../../mount-table.xml
-
-build.docs.loglevel=ERROR
-build.docs.printer.loglevel=ERROR
-
-# ------ Webapp Build Properties -----------------------------------------------
-
-build.webapp=${build.root}/webapp
-build.webapp.webinf=${build.webapp}/WEB-INF
-build.webapp.classes=${build.webapp.webinf}/classes
-build.webapp.lib=${build.webapp.webinf}/lib
-build.webapp.samples=${build.webapp}/samples
-build.webapp.test-suite=${build.webapp}/test-suite
-build.webapp.docs=${build.webapp}/docs
-build.webapp.javadocs=${build.webapp}/api/java
-build.webapp.loglevel=INFO
-build.war=${build}/${name}.war
-
-# ------ Standalone-demo Build Properties --------------------------------------
-build.standalone.demo=${build.root}/standalone-demo
-
-# ---- Compilation -------------------------------------------------------------
-
-compiler=modern
-compiler.debug=on
-compiler.optimize=on
-compiler.deprecation=off
-compiler.nowarn=on
-source.vm=1.4
-
-
-# ------ System Properties -----------------------------------------------------
-
-# WARNING: you shouldn't need to modify anything below here since there is a
-# very high change of breaking the build system. Do it only if you know what
-# you're doing.
-
-packages=org.apache
-
-# Project descriptor
-gump.descriptor=gump.xml
-
-# Directory Layout
-src=src
-java=${src}/java
-mocks=${src}/mocks
-test=${src}/test
-resources=${src}/resources
-resources.styles=${resources}/styles
-resources.logos=${resources}/logos
-resources.javadoc=${resources}/javadoc
-documentation=${src}/documentation
-docs=${documentation}/xdocs
-images=${documentation}/images
-blocks=${src}${file.separator}blocks
-samples=${src}/samples
-webapp=${src}/webapp
-webapp.samples=${webapp}/samples
-webapp.test-suite=${webapp}/test-suite
-customconf=${src}/confpatch
-
-# Deprecated Stuff
-deprecated=${src}/deprecated
-deprecated.src=${deprecated}/java
-deprecated.conf=${deprecated}/conf
-
-# Tools
-tools=tools
-tools.lib=${tools}/lib
-tools.src=${tools}/src
-tools.tasks.src=${tools.src}/anttasks
-tools.tasks.dest=${tools}/anttasks
-tools.loader.src=${tools.src}/loader
-tools.loader.dest=${tools}/loader
-tools.jetty=${tools}/jetty
-
-# IDE
-ide.eclipse.outputdir=${build.root}/eclipse/classes
-ide.eclipse.export.libs=false
-
-# Libraries
-lib=lib
-lib.core=${lib}/core
-lib.endorsed=${lib}/endorsed
-lib.optional=${lib}/optional
-lib.local=${lib}/local
-
-# Distribution Directories
-dist.root=dist
-dist=${dist.root}/${name}-${version}
-dist.name=${name}-${version}
-dist.target=${dist.root}
-
-# Site Directory
-site=../cocoon-site/site/2.1
-
-# Legal
-legal=legal
diff --git a/trunk/src/confpatch/enable-uploads.xweb b/trunk/src/confpatch/enable-uploads.xweb
deleted file mode 100644
index e30b3b1..0000000
--- a/trunk/src/confpatch/enable-uploads.xweb
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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.
--->
-
-<!-- http://wiki.apache.org/cocoon/XPatchTaskUsage -->
-
-<xweb xpath="/web-app/servlet/init-param[param-name='enable-uploads']/param-value"
- if-prop="enable.uploads"
- remove="/web-app/servlet/init-param[param-name='enable-uploads']/param-value/text()"
->true</xweb>
diff --git a/trunk/src/confpatch/form-encoding.xweb b/trunk/src/confpatch/form-encoding.xweb
deleted file mode 100644
index 5d69445..0000000
--- a/trunk/src/confpatch/form-encoding.xweb
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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.
--->
-<xweb xpath="/web-app/servlet/init-param[param-name='form-encoding']/param-value"
- remove="/web-app/servlet/init-param[param-name='form-encoding']/param-value/text()"
->UTF-8</xweb>
\ No newline at end of file
diff --git a/trunk/src/confpatch/log4j-appender.xconf b/trunk/src/confpatch/log4j-appender.xconf
deleted file mode 100644
index 8927ab2..0000000
--- a/trunk/src/confpatch/log4j-appender.xconf
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/configuration" unless="/configuration/appender[@name='Chainsaw']" insert-after="appender">
-
- <!--+
- | See http://logging.apache.org/log4j/docs/chainsaw.html
- +-->
- <appender name="Chainsaw" class="org.apache.log4j.net.SocketAppender">
- <param name="remoteHost" value="localhost" />
- <param name="port" value="4445"/>
- <param name="locationInfo" value="true" />
- </appender>
-
-</xconf>
diff --git a/trunk/src/confpatch/log4j-appenderref.xconf b/trunk/src/confpatch/log4j-appenderref.xconf
deleted file mode 100644
index b12c9cb..0000000
--- a/trunk/src/confpatch/log4j-appenderref.xconf
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/configuration/root" unless="/configuration/root/appender-ref[@ref='Chainsaw'] or /configuration/root/node()[self::comment() and contains(., 'appender-ref ref="Chainsaw"')]" insert-after="appender-ref">
-
- <!--+
- | Uncomment to enable logging to Chainsaw.
- | See http://logging.apache.org/log4j/docs/chainsaw.html
- +-->
- <!--
- <appender-ref ref="Chainsaw" />
- -->
-</xconf>
diff --git a/trunk/src/confpatch/log4j-logger.xconf b/trunk/src/confpatch/log4j-logger.xconf
deleted file mode 100644
index e861fc6..0000000
--- a/trunk/src/confpatch/log4j-logger.xconf
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/configuration" unless="/configuration/logger[@name='org.mortbay.http.ContextLoader']" insert-after="appender">
-
- <logger name="org.mortbay.http.ContextLoader">
- <level value="warn"/>
- </logger>
-</xconf>
diff --git a/trunk/src/confpatch/logger-class.xweb b/trunk/src/confpatch/logger-class.xweb
deleted file mode 100644
index 28a5c1c..0000000
--- a/trunk/src/confpatch/logger-class.xweb
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-<xweb xpath="/web-app/servlet[servlet-name = 'Cocoon']"
- unless="init-param[param-name = 'logger-class' and
- normalize-space(param-value) = 'org.apache.avalon.excalibur.logger.Log4JLoggerManager']"
- insert-after="init-param[position() = last()]">
- <init-param>
- <param-name>logger-class</param-name>
- <param-value>org.apache.avalon.excalibur.logger.Log4JLoggerManager</param-value>
- </init-param>
- <init-param>
- <param-name>log4j-config</param-name>
- <param-value>/WEB-INF/log4j.xconf</param-value>
- </init-param>
-</xweb>
\ No newline at end of file
diff --git a/trunk/src/confpatch/logkit-categories.xconf b/trunk/src/confpatch/logkit-categories.xconf
deleted file mode 100644
index 70da51a..0000000
--- a/trunk/src/confpatch/logkit-categories.xconf
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/logkit/categories" unless="category[@name='lenya']">
- <category name="lenya" log-level="INFO">
- <log-target id-ref="lenya"/>
- <log-target id-ref="error"/>
- </category>
-</xconf>
diff --git a/trunk/src/confpatch/logkit-targets.xconf b/trunk/src/confpatch/logkit-targets.xconf
deleted file mode 100644
index cef080f..0000000
--- a/trunk/src/confpatch/logkit-targets.xconf
+++ /dev/null
@@ -1,27 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/logkit/targets" unless="cocoon[@id='lenya']">
- <cocoon id="lenya">
- <filename>${context-root}/WEB-INF/logs/lenya.log</filename>
- <format type="cocoon">
- %7.7{priority} %{time} [%{category}] (%{uri}) %{thread}/%{class:short}: %{message}\n%{throwable}
- </format>
- <append>false</append>
- </cocoon>
-</xconf>
diff --git a/trunk/src/confpatch/overwrite-uploads.xweb b/trunk/src/confpatch/overwrite-uploads.xweb
deleted file mode 100644
index 4c40eda..0000000
--- a/trunk/src/confpatch/overwrite-uploads.xweb
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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.
--->
-<xweb xpath="/web-app/servlet/init-param[param-name='overwrite-uploads']/param-value"
- remove="/web-app/servlet/init-param[param-name='overwrite-uploads']/param-value/text()"
->allow</xweb>
\ No newline at end of file
diff --git a/trunk/src/confpatch/session-listener.xweb b/trunk/src/confpatch/session-listener.xweb
deleted file mode 100644
index bc6f785..0000000
--- a/trunk/src/confpatch/session-listener.xweb
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<xweb xpath="/web-app" unless="listener" insert-before="node()[1]">
-
- <listener>
- <!--
- - Listen for new sessions and store the objects in a HashMap
- -->
- <listener-class>org.apache.lenya.util.SessionListener</listener-class>
- </listener>
-
-</xweb>
diff --git a/trunk/src/confpatch/upload-max-size.xweb b/trunk/src/confpatch/upload-max-size.xweb
deleted file mode 100644
index 80ada86..0000000
--- a/trunk/src/confpatch/upload-max-size.xweb
+++ /dev/null
@@ -1,21 +0,0 @@
-<?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.
--->
-
-<xweb xpath="/web-app/servlet/init-param[param-name='upload-max-size']/param-value"
- remove="/web-app/servlet/init-param[param-name='upload-max-size']/param-value/text()"
->10000000</xweb>
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/metadata/ConfigurableElementSet.java b/trunk/src/impl/java/org/apache/lenya/cms/metadata/ConfigurableElementSet.java
deleted file mode 100644
index 77cd67c..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/metadata/ConfigurableElementSet.java
+++ /dev/null
@@ -1,113 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-
-/**
- * Avalon-based element set.
- */
-public class ConfigurableElementSet extends AbstractLogEnabled implements ElementSet, Configurable,
- ThreadSafe, Initializable, Serviceable {
-
- private String namespaceUri;
- private Map elements = new HashMap();
-
- public void configure(Configuration config) throws ConfigurationException {
-
- this.namespaceUri = config.getAttribute("name");
-
- Configuration[] attributeConfigs = config.getChildren("element");
- for (int i = 0; i < attributeConfigs.length; i++) {
- String name = attributeConfigs[i].getAttribute("name");
- boolean isMultiple = attributeConfigs[i].getAttributeAsBoolean("multiple", false);
- boolean isEditable = attributeConfigs[i].getAttributeAsBoolean("editable", false);
- String actionOnCopy = attributeConfigs[i].getAttribute("onCopy", "copy");
- ElementImpl element = new ElementImpl(name, isMultiple, isEditable);
- int action;
- if (actionOnCopy.equalsIgnoreCase("copy")) {
- action = Element.ONCOPY_COPY;
- }
- else if (actionOnCopy.equalsIgnoreCase("ignore")) {
- action = Element.ONCOPY_IGNORE;
- }
- else if (actionOnCopy.equalsIgnoreCase("delete")) {
- action = Element.ONCOPY_DELETE;
- }
- else {
- throw new ConfigurationException("The action [" + actionOnCopy + "] is not supported.");
- }
- try {
- element.setActionOnCopy(action);
- } catch (MetaDataException e) {
- throw new RuntimeException(e);
- }
- this.elements.put(name, element);
- }
-
- }
-
- public Element[] getElements() {
- Collection values = this.elements.values();
- return (Element[]) values.toArray(new Element[values.size()]);
- }
-
- public Element getElement(String name) {
- return (Element) this.elements.get(name);
- }
-
- public String getNamespaceUri() {
- return this.namespaceUri;
- }
-
- public boolean containsElement(String name) {
- return this.elements.keySet().contains(name);
- }
-
- public void initialize() throws Exception {
- MetaDataRegistry registry = null;
- try {
- registry = (MetaDataRegistry) this.manager.lookup(MetaDataRegistry.ROLE);
- registry.register(getNamespaceUri(), this);
- }
- finally {
- if (registry != null) {
- this.manager.release(registry);
- }
- }
- }
-
- private ServiceManager manager;
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/metadata/ElementImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/metadata/ElementImpl.java
deleted file mode 100644
index 0b81712..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/metadata/ElementImpl.java
+++ /dev/null
@@ -1,84 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata;
-
-/**
- * Element implementation.
- */
-public class ElementImpl implements Element {
-
- private String name;
- private boolean multiple;
- private String description = "";
- private boolean editable;
-
- /**
- * Ctor.
- * @param name The name.
- * @param isMultiple if the element can have multiple values.
- * @param isEditable if the element can be edited.
- */
- public ElementImpl(String name, boolean isMultiple, boolean isEditable) {
- this.name = name;
- this.multiple = isMultiple;
- this.editable = isEditable;
- }
-
- /**
- * Ctor.
- * @param name The name.
- * @param isMultiple if the element can have multiple values.
- * @param isEditable if the element can be edited.
- * @param description The description of the element.
- */
- public ElementImpl(String name, boolean isMultiple, boolean isEditable, String description) {
- this(name, isMultiple, isEditable);
- this.description = description;
- }
-
- public String getName() {
- return this.name;
- }
-
- public boolean isMultiple() {
- return this.multiple;
- }
-
- public String getDescription() {
- return this.description;
- }
-
- public boolean isEditable() {
- return this.editable;
- }
-
- private int actionOnCopy;
-
- public int getActionOnCopy() {
- return this.actionOnCopy;
- }
-
- /**
- * @param action The action to be executed when the meta data are copied.
- * @throws MetaDataException if the action is not supported.
- */
- public void setActionOnCopy(int action) throws MetaDataException {
- this.actionOnCopy = action;
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/metadata/MetaDataRegistryImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/metadata/MetaDataRegistryImpl.java
deleted file mode 100644
index 20a1d41..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/metadata/MetaDataRegistryImpl.java
+++ /dev/null
@@ -1,60 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.thread.ThreadSafe;
-
-/**
- * Meta data registry implementation.
- */
-public class MetaDataRegistryImpl extends AbstractLogEnabled implements MetaDataRegistry,
- ThreadSafe {
-
- public ElementSet getElementSet(String namespaceUri) throws MetaDataException {
- if (!isRegistered(namespaceUri)) {
- throw new MetaDataException("The namespace URI [" + namespaceUri
- + "] is not registered.");
- }
- return (ElementSet) this.namespace2set.get(namespaceUri);
- }
-
- public boolean isRegistered(String namespaceUri) throws MetaDataException {
- return this.namespace2set.containsKey(namespaceUri);
- }
-
- private Map namespace2set = new HashMap();
-
- public void register(String namespaceUri, ElementSet elementSet) throws MetaDataException {
- if (this.namespace2set.containsKey(namespaceUri)) {
- throw new MetaDataException("The namespace [" + namespaceUri
- + "] is already registered.");
- }
- this.namespace2set.put(namespaceUri, elementSet);
- }
-
- public String[] getNamespaceUris() throws MetaDataException {
- Set keys = this.namespace2set.keySet();
- return (String[]) keys.toArray(new String[keys.size()]);
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/module/ModuleManagerImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/module/ModuleManagerImpl.java
deleted file mode 100644
index 3385b02..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/module/ModuleManagerImpl.java
+++ /dev/null
@@ -1,74 +0,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.
- *
- */
-package org.apache.lenya.cms.module;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.thread.ThreadSafe;
-
-/**
- * Module manager implementation.
- */
-public class ModuleManagerImpl extends AbstractLogEnabled implements ModuleManager, ThreadSafe,
- Configurable {
-
- public String getBaseURI(String shortcut) throws ModuleException {
- if (!this.module2src.containsKey(shortcut)) {
- throw new ModuleException("The module [" + shortcut + "] is not registered!");
- }
-
- String baseUri;
- if (this.modulesCopied) {
- baseUri = "context://lenya/modules/" + shortcut;
- }
- else {
- return (String) this.module2src.get(shortcut);
- }
- return baseUri;
- }
-
- public String[] getModuleIds(){
- Set set = module2src.keySet();
- return (String[]) set.toArray(new String[set.size()]);
- }
-
- private boolean modulesCopied = false;
- private Map module2src = new HashMap();
-
- public void configure(Configuration config) throws ConfigurationException {
- Configuration modulesConfig = config.getChild("modules");
- this.modulesCopied = modulesConfig.getAttributeAsBoolean("copy");
-
- Configuration[] modules = modulesConfig.getChildren("module");
- for (int i = 0; i < modules.length; i++) {
- String shortcut = modules[i].getAttribute("shortcut");
- String src = modules[i].getAttribute("src");
- String uri = new File(src).toURI().toString();
- this.module2src.put(shortcut, uri);
- }
-
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/publication/AreaImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/publication/AreaImpl.java
deleted file mode 100644
index d3f80c6..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/publication/AreaImpl.java
+++ /dev/null
@@ -1,143 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.NodeFactory;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteManager;
-import org.apache.lenya.cms.site.SiteNode;
-import org.apache.lenya.cms.site.SiteStructure;
-
-/**
- * Area implementation.
- */
-public class AreaImpl implements Area {
-
- private String name;
- private Publication pub;
- private DocumentFactory factory;
- private NodeFactory nodeFactory;
- private ServiceManager manager;
-
- /**
- * @param manager The service manager.
- * @param factory The factory.
- * @param pub The publication.
- * @param name The area name.
- */
- public AreaImpl(ServiceManager manager, DocumentFactory factory, Publication pub, String name) {
- this.manager = manager;
- this.factory = factory;
- this.pub = pub;
- this.name = name;
- }
-
- public boolean contains(String uuid, String language) {
- // check site structure first (performance)
- if (getSite().containsByUuid(uuid, language)) {
- return true;
- } else {
- String sourceUri = DocumentImpl.getSourceURI(pub, name, uuid, language);
- try {
- Node node = (Node) getPublication().getSession().getRepositoryItem(
- getNodeFactory(), sourceUri);
- return node.exists();
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- protected NodeFactory getNodeFactory() {
- if (this.nodeFactory == null) {
- try {
- this.nodeFactory = (NodeFactory) this.manager.lookup(NodeFactory.ROLE);
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- }
- }
- return this.nodeFactory;
- }
-
- public Document getDocument(String uuid, String language) throws PublicationException {
- return this.factory.get(getPublication(), getName(), uuid, language);
- }
-
- public String getName() {
- return this.name;
- }
-
- public Publication getPublication() {
- return this.pub;
- }
-
- private SiteStructure site;
-
- public SiteStructure getSite() {
- if (this.site == null) {
- SiteManager siteManager = null;
- ServiceSelector selector = null;
- try {
- selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
- siteManager = (SiteManager) selector.select(getPublication().getSiteManagerHint());
- this.site = siteManager.getSiteStructure(this.factory, getPublication(), getName());
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- this.manager.release(selector);
- }
- }
- }
- return this.site;
- }
-
- public String toString() {
- return getPublication().getId() + ":" + getName();
- }
-
- public Document[] getDocuments() {
- SiteNode[] nodes = getSite().getNodes();
- List docs = new ArrayList();
- for (int i = 0; i < nodes.length; i++) {
- if (nodes[i].getUuid() != null) {
- String[] langs = nodes[i].getLanguages();
- for (int l = 0; l < langs.length; l++) {
- try {
- docs.add(nodes[i].getLink(langs[l]).getDocument());
- } catch (SiteException e) {
- throw new RuntimeException(e);
- }
- }
- }
- }
- return (Document[]) docs.toArray(new Document[docs.size()]);
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentFactoryBuilderImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentFactoryBuilderImpl.java
deleted file mode 100644
index f1e5431..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentFactoryBuilderImpl.java
+++ /dev/null
@@ -1,43 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * Document factory builder implementation.
- */
-public class DocumentFactoryBuilderImpl extends AbstractLogEnabled implements ThreadSafe,
- DocumentFactoryBuilder, Serviceable {
-
- public DocumentFactory createDocumentFactory(Session session) {
- return new DocumentFactoryImpl(session, this.manager, getLogger());
- }
-
- protected ServiceManager manager;
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentFactoryImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentFactoryImpl.java
deleted file mode 100644
index 37b3b2f..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentFactoryImpl.java
+++ /dev/null
@@ -1,355 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import java.util.Arrays;
-import java.util.StringTokenizer;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryItem;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.util.Assert;
-
-/**
- * A DocumentIdentityMap avoids the multiple instanciation of a document object.
- *
- * @version $Id: DocumentIdentityMap.java 264153 2005-08-29 15:11:14Z andreas $
- */
-public class DocumentFactoryImpl extends AbstractLogEnabled implements DocumentFactory {
-
- private Session session;
- protected ServiceManager manager;
-
- /**
- * @return The session.
- */
- public Session getSession() {
- return this.session;
- }
-
- /**
- * Ctor.
- * @param session The session to use.
- * @param manager The service manager.
- * @param logger The logger to use.
- */
- public DocumentFactoryImpl(Session session, ServiceManager manager, Logger logger) {
- this.session = session;
- this.manager = manager;
- ContainerUtil.enableLogging(this, logger);
- }
-
- /**
- * Returns a document.
- * @param publication The publication.
- * @param area The area.
- * @param uuid The document UUID.
- * @param language The language.
- * @return A document.
- * @throws DocumentBuildException if an error occurs.
- */
- public Document get(Publication publication, String area, String uuid, String language)
- throws DocumentBuildException {
- return get(publication, area, uuid, language, -1);
- }
-
- public Document get(Publication publication, String area, String uuid, String language,
- int revision) throws DocumentBuildException {
- if (getLogger().isDebugEnabled())
- getLogger().debug(
- "DocumentIdentityMap::get() called on publication [" + publication.getId()
- + "], area [" + area + "], UUID [" + uuid + "], language [" + language
- + "]");
-
- String key = getKey(publication, area, uuid, language, revision);
-
- if (getLogger().isDebugEnabled())
- getLogger().debug(
- "DocumentIdentityMap::get() got key [" + key + "] from DocumentFactory");
-
- try {
- return (Document) getSession().getRepositoryItem(this, key);
- } catch (RepositoryException e) {
- throw new DocumentBuildException(e);
- }
- }
-
- /**
- * Returns the document identified by a certain web application URL.
- * @param webappUrl The web application URL.
- * @return A document.
- * @throws DocumentBuildException if an error occurs.
- */
- public Document getFromURL(String webappUrl) throws DocumentBuildException {
- String key = getKey(webappUrl);
- try {
- return (Document) getSession().getRepositoryItem(this, key);
- } catch (RepositoryException e) {
- throw new DocumentBuildException(e);
- }
- }
-
- /**
- * Builds a clone of a document for another language.
- * @param document The document to clone.
- * @param language The language of the target document.
- * @return A document.
- * @throws DocumentBuildException if an error occurs.
- */
- public Document getLanguageVersion(Document document, String language)
- throws DocumentBuildException {
- return get(document.getPublication(), document.getArea(), document.getUUID(), language);
- }
-
- /**
- * Builds a clone of a document for another area.
- * @param document The document to clone.
- * @param area The area of the target document.
- * @return A document.
- * @throws DocumentBuildException if an error occurs.
- */
- public Document getAreaVersion(Document document, String area) throws DocumentBuildException {
- return get(document.getPublication(), area, document.getUUID(), document.getLanguage());
- }
-
- /**
- * Builds a document for the default language.
- * @param publication The publication.
- * @param area The area.
- * @param documentId The document ID.
- * @return A document.
- * @throws DocumentBuildException if an error occurs.
- */
- public Document get(Publication publication, String area, String documentId)
- throws DocumentBuildException {
- return get(publication, area, documentId, publication.getDefaultLanguage());
- }
-
- /**
- * Checks if a string represents a valid document ID.
- * @param id The string.
- * @return A boolean value.
- */
- public boolean isValidDocumentId(String id) {
-
- if (!id.startsWith("/")) {
- return false;
- }
-
- String[] snippets = id.split("/");
-
- if (snippets.length < 2) {
- return false;
- }
-
- for (int i = 1; i < snippets.length; i++) {
- if (!snippets[i].matches("[a-zA-Z0-9\\-]+")) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Checks if a webapp URL represents a document.
- * @param webappUrl A web application URL.
- * @return A boolean value.
- * @throws DocumentBuildException if an error occurs.
- */
- public boolean isDocument(String webappUrl) throws DocumentBuildException {
- Assert.notNull("webapp URL", webappUrl);
- PublicationManager pubMgr = getPubManager();
- try {
- URLInformation info = new URLInformation(webappUrl);
- String pubId = info.getPublicationId();
- if (pubId != null && Arrays.asList(pubMgr.getPublicationIds()).contains(pubId)) {
- Publication pub = pubMgr.getPublication(this, pubId);
- DocumentBuilder builder = pub.getDocumentBuilder();
- return builder.isDocument(this, webappUrl);
- } else {
- return false;
- }
- } catch (PublicationException e) {
- throw new DocumentBuildException(e);
- }
- }
-
- /**
- * Builds a document key.
- * @param publication The publication.
- * @param area The area.
- * @param uuid The document UUID.
- * @param language The language.
- * @param revision
- * @return A key.
- */
- public String getKey(Publication publication, String area, String uuid, String language, int revision) {
- Assert.notNull("publication", publication);
- Assert.notNull("area", area);
- Assert.notNull("uuid", uuid);
- Assert.notNull("language", language);
- return publication.getId() + ":" + area + ":" + uuid + ":" + language + ":" + revision;
- }
-
- /**
- * Builds a document key.
- * @param webappUrl The web application URL.
- * @return A key.
- */
- public String getKey(String webappUrl) {
- Assert.notNull("webapp URL", webappUrl);
- try {
- if (!isDocument(webappUrl)) {
- throw new RuntimeException("No document for URL [" + webappUrl + "] found.");
- }
- DocumentLocator locator = getLocator(webappUrl);
- Publication publication = getPublication(locator.getPublicationId());
- String area = locator.getArea();
- String uuid = publication.getArea(area).getSite().getNode(locator.getPath()).getUuid();
- return getKey(publication, area, uuid, locator.getLanguage(), -1);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- protected DocumentLocator getLocator(String webappUrl) {
- DocumentLocator locator;
- try {
- Publication publication = PublicationUtil.getPublicationFromUrl(this.manager, this,
- webappUrl);
- DocumentBuilder builder = publication.getDocumentBuilder();
- locator = builder.getLocator(this, webappUrl);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return locator;
- }
-
- /**
- * @see org.apache.lenya.transaction.IdentifiableFactory#build(org.apache.lenya.transaction.IdentityMap,
- * java.lang.String)
- */
- public RepositoryItem buildItem(Session session, String key) throws RepositoryException {
- if (getLogger().isDebugEnabled())
- getLogger().debug("DocumentFactory::build() called with key [" + key + "]");
-
- StringTokenizer tokenizer = new StringTokenizer(key, ":");
- String publicationId = tokenizer.nextToken();
- String area = tokenizer.nextToken();
- String uuid = tokenizer.nextToken();
- String language = tokenizer.nextToken();
- String revisionString = tokenizer.nextToken();
- int revision = Integer.valueOf(revisionString).intValue();
-
- Document document;
- try {
- Publication publication = getPublication(publicationId);
- DocumentBuilder builder = publication.getDocumentBuilder();
- DocumentIdentifier identifier = new DocumentIdentifier(publicationId, area, uuid,
- language);
- document = buildDocument(this, identifier, revision, builder);
- } catch (Exception e) {
- throw new RepositoryException(e);
- }
- if (getLogger().isDebugEnabled())
- getLogger().debug("DocumentFactory::build() done.");
-
- return document;
- }
-
- protected Document buildDocument(DocumentFactory map, DocumentIdentifier identifier,
- int revision, DocumentBuilder builder) throws DocumentBuildException {
-
- DocumentImpl document = createDocument(map, identifier, revision, builder);
- ContainerUtil.enableLogging(document, getLogger());
- return document;
- }
-
- /**
- * Creates a new document object. Override this method to create specific document objects,
- * e.g., for different document IDs.
- * @param map The identity map.
- * @param identifier The identifier.
- * @param revision The revision or -1 for the latest revision.
- * @param builder The document builder.
- * @return A document.
- * @throws DocumentBuildException when something went wrong.
- */
- protected DocumentImpl createDocument(DocumentFactory map, DocumentIdentifier identifier,
- int revision, DocumentBuilder builder) throws DocumentBuildException {
- return new DocumentImpl(this.manager, map, identifier, revision, getLogger());
- }
-
- public Document get(DocumentIdentifier identifier) throws DocumentBuildException {
- try {
- Publication pub = getPublication(identifier.getPublicationId());
- return get(pub, identifier.getArea(), identifier.getUUID(), identifier.getLanguage());
- } catch (PublicationException e) {
- throw new DocumentBuildException(e);
- }
- }
-
- public String getItemType() {
- return Document.TRANSACTIONABLE_TYPE;
- }
-
- public Document get(DocumentLocator locator) throws DocumentBuildException {
- try {
- Publication pub = getPublication(locator.getPublicationId());
- SiteStructure site = pub.getArea(locator.getArea()).getSite();
- String uuid = site.getNode(locator.getPath()).getUuid();
- return get(pub, locator.getArea(), uuid, locator.getLanguage());
- } catch (PublicationException e) {
- throw new DocumentBuildException(e);
- }
- }
-
- public Publication getPublication(String id) throws PublicationException {
- return getPubManager().getPublication(this, id);
- }
-
- public Publication[] getPublications() {
- return getPubManager().getPublications(this);
- }
-
- private PublicationManager pubManager;
-
- protected PublicationManager getPubManager() {
- if (this.pubManager == null) {
- try {
- this.pubManager = (PublicationManager) this.manager.lookup(PublicationManager.ROLE);
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- }
- }
- return this.pubManager;
- }
-
- public boolean existsPublication(String id) {
- return Arrays.asList(getPubManager().getPublicationIds()).contains(id);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java
deleted file mode 100644
index f7c25a8..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java
+++ /dev/null
@@ -1,688 +0,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.
- *
- */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.cocoon.source.SourceUtil;
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.metadata.MetaDataException;
-import org.apache.lenya.cms.publication.util.DocumentVisitor;
-import org.apache.lenya.cms.repository.ContentHolder;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.NodeFactory;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.cms.site.Link;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.util.Assert;
-
-/**
- * A typical CMS document.
- * @version $Id$
- */
-public class DocumentImpl extends AbstractLogEnabled implements Document {
-
- private DocumentIdentifier identifier;
- private DocumentFactory factory;
- protected ServiceManager manager;
- private int revision = -1;
-
- /**
- * The meta data namespace.
- */
- public static final String METADATA_NAMESPACE = "http://apache.org/lenya/metadata/document/1.0";
-
- /**
- * The name of the resource type attribute. A resource has a resource type; this information can
- * be used e.g. for different rendering of different types.
- */
- protected static final String METADATA_RESOURCE_TYPE = "resourceType";
-
- /**
- * The name of the mime type attribute.
- */
- protected static final String METADATA_MIME_TYPE = "mimeType";
-
- /**
- * The name of the content type attribute. Any content managed by Lenya has a type; this
- * information can be used e.g. to provide an appropriate management interface.
- */
- protected static final String METADATA_CONTENT_TYPE = "contentType";
-
- /**
- * The number of seconds from the request that a document can be cached before it expires
- */
- protected static final String METADATA_EXPIRES = "expires";
-
- /**
- * The extension to use for the document source.
- */
- protected static final String METADATA_EXTENSION = "extension";
-
- /**
- * Creates a new instance of DefaultDocument.
- * @param manager The service manager.
- * @param map The identity map the document belongs to.
- * @param identifier The identifier.
- * @param revision The revision number or -1 if the latest revision should be used.
- * @param _logger a logger
- */
- protected DocumentImpl(ServiceManager manager, DocumentFactory map,
- DocumentIdentifier identifier, int revision, Logger _logger) {
-
- ContainerUtil.enableLogging(this, _logger);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- "DefaultDocument() creating new instance with id [" + identifier.getUUID()
- + "], language [" + identifier.getLanguage() + "]");
- }
-
- if (identifier.getUUID() == null) {
- throw new IllegalArgumentException("The UUID must not be null!");
- }
-
- this.manager = manager;
- this.identifier = identifier;
- this.factory = map;
- this.revision = revision;
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- "DefaultDocument() done building instance with _id [" + identifier.getUUID()
- + "], _language [" + identifier.getLanguage() + "]");
- }
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getExpires()
- */
- public Date getExpires() throws DocumentException {
- Date expires = null;
- long secs = 0;
-
- MetaData metaData = null;
- String expiresMeta = null;
- try {
- metaData = this.getMetaData(METADATA_NAMESPACE);
- expiresMeta = metaData.getFirstValue("expires");
- } catch (MetaDataException e) {
- throw new DocumentException(e);
- }
- if (expiresMeta != null) {
- secs = Long.parseLong(expiresMeta);
- } else {
- secs = -1;
- }
-
- if (secs != -1) {
- Date date = new Date();
- date.setTime(date.getTime() + secs * 1000l);
- expires = date;
- } else {
- expires = this.getResourceType().getExpires();
- }
-
- return expires;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getName()
- */
- public String getName() {
- try {
- return getLink().getNode().getName();
- } catch (DocumentException e) {
- throw new RuntimeException(e);
- }
- }
-
- private Publication publication;
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getPublication()
- */
- public Publication getPublication() {
- if (this.publication == null) {
- try {
- this.publication = getFactory().getPublication(getIdentifier().getPublicationId());
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- }
- return this.publication;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getLastModified()
- */
- public long getLastModified() throws DocumentException {
- try {
- return getRepositoryNode().getLastModified();
- } catch (RepositoryException e) {
- throw new DocumentException(e);
- }
- }
-
- public File getFile() {
- return getPublication().getPathMapper().getFile(getPublication(), getArea(), getUUID(),
- getLanguage());
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getLanguage()
- */
- public String getLanguage() {
- return this.identifier.getLanguage();
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getLanguages()
- */
- public String[] getLanguages() throws DocumentException {
-
- List documentLanguages = new ArrayList();
- String[] allLanguages = getPublication().getLanguages();
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Number of languages of this publication: " + allLanguages.length);
- }
-
- for (int i = 0; i < allLanguages.length; i++) {
- if (existsTranslation(allLanguages[i])) {
- documentLanguages.add(allLanguages[i]);
- }
- }
-
- return (String[]) documentLanguages.toArray(new String[documentLanguages.size()]);
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getArea()
- */
- public String getArea() {
- return this.identifier.getArea();
- }
-
- private String extension = null;
- private String defaultExtension = "html";
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getExtension()
- */
- public String getExtension() {
- if (extension == null) {
- String sourceExtension = getSourceExtension();
- if (sourceExtension.equals("xml") || sourceExtension.equals("")) {
- getLogger().info("Default extension will be used: " + defaultExtension);
- return defaultExtension;
- } else {
- return sourceExtension;
- }
-
- }
- return this.extension;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getUUID()
- */
- public String getUUID() {
- return getIdentifier().getUUID();
- }
-
- private String defaultSourceExtension = "xml";
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getSourceExtension()
- */
- public String getSourceExtension() {
- String sourceExtension;
- try {
- sourceExtension = getMetaData(METADATA_NAMESPACE).getFirstValue(METADATA_EXTENSION);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- if (sourceExtension == null) {
- getLogger().warn(
- "No source extension for document [" + this + "]. The extension \""
- + defaultSourceExtension + "\" will be used as default!");
- sourceExtension = defaultSourceExtension;
- }
- return sourceExtension;
- }
-
- /**
- * Sets the extension of the file in the URL.
- * @param _extension A string.
- */
- protected void setExtension(String _extension) {
- checkWritability();
- assert _extension != null;
- Assert.isTrue("Extension doesn't start with a dot", !_extension.startsWith("."));
- this.extension = _extension;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#exists()
- */
- public boolean exists() throws DocumentException {
- try {
- return getRepositoryNode().exists();
- } catch (RepositoryException e) {
- throw new DocumentException(e);
- }
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#existsInAnyLanguage()
- */
- public boolean existsInAnyLanguage() throws DocumentException {
- String[] languages = getLanguages();
-
- if (languages.length > 0) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- "Document (" + this + ") exists in at least one language: "
- + languages.length);
- }
- String[] allLanguages = getPublication().getLanguages();
- if (languages.length == allLanguages.length)
- // TODO: This is not entirely true, because the publication
- // could assume the
- // languages EN and DE, but the document could exist for the
- // languages DE and FR!
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- "Document (" + this
- + ") exists even in all languages of this publication");
- }
- return true;
- } else {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Document (" + this + ") does NOT exist in any language");
- }
- return false;
- }
-
- }
-
- public DocumentIdentifier getIdentifier() {
- return this.identifier;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object object) {
- if (getClass().isInstance(object)) {
- DocumentImpl document = (DocumentImpl) object;
- return document.getIdentifier().equals(getIdentifier());
- }
- return false;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
-
- String key = getPublication().getId() + ":" + getPublication().getServletContext() + ":"
- + getArea() + ":" + getUUID() + ":" + getLanguage();
-
- return key.hashCode();
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return getIdentifier().toString();
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getFactory()
- */
- public DocumentFactory getFactory() {
- return this.factory;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getCanonicalWebappURL()
- */
- public String getCanonicalWebappURL() {
- return "/" + getPublication().getId() + "/" + getArea() + getCanonicalDocumentURL();
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getCanonicalDocumentURL()
- */
- public String getCanonicalDocumentURL() {
- try {
- DocumentBuilder builder = getPublication().getDocumentBuilder();
- String webappUrl = builder.buildCanonicalUrl(getFactory(), getLocator());
- String prefix = "/" + getPublication().getId() + "/" + getArea();
- return webappUrl.substring(prefix.length());
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#accept(org.apache.lenya.cms.publication.util.DocumentVisitor)
- */
- public void accept(DocumentVisitor visitor) throws PublicationException {
- visitor.visitDocument(this);
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#delete()
- */
- public void delete() throws DocumentException {
- if (hasLink()) {
- throw new DocumentException("Can't delete document [" + this
- + "], it's still referenced in the site structure.");
- }
- try {
- getRepositoryNode().delete();
- } catch (Exception e) {
- throw new DocumentException(e);
- }
- }
-
- protected static final String IDENTIFIABLE_TYPE = "document";
-
- private ResourceType resourceType;
-
- /**
- * Convenience method to read the document's resource type from the meta-data.
- * @see Document#getResourceType()
- */
- public ResourceType getResourceType() throws DocumentException {
- if (this.resourceType == null) {
- ServiceSelector selector = null;
- try {
- String name = getMetaData(METADATA_NAMESPACE).getFirstValue(METADATA_RESOURCE_TYPE);
- if (name == null) {
- throw new DocumentException("No resource type defined for document [" + this
- + "]!");
- }
- selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
- this.resourceType = (ResourceType) selector.select(name);
- } catch (Exception e) {
- throw new DocumentException(e);
- }
- }
- return this.resourceType;
- }
-
- public MetaData getMetaData(String namespaceUri) throws MetaDataException {
- return getContentHolder().getMetaData(namespaceUri);
- }
-
- public String[] getMetaDataNamespaceUris() throws MetaDataException {
- return getContentHolder().getMetaDataNamespaceUris();
- }
-
- public String getMimeType() throws DocumentException {
- try {
- String mimeType = getMetaData(METADATA_NAMESPACE).getFirstValue(METADATA_MIME_TYPE);
- if (mimeType == null) {
- mimeType = "";
- }
- return mimeType;
- } catch (MetaDataException e) {
- throw new DocumentException(e);
- }
- }
-
- public long getContentLength() throws DocumentException {
- try {
- return getContentHolder().getContentLength();
- } catch (RepositoryException e) {
- throw new DocumentException(e);
- }
- }
-
- public void setMimeType(String mimeType) throws DocumentException {
- checkWritability();
- try {
- getMetaData(METADATA_NAMESPACE).setValue(METADATA_MIME_TYPE, mimeType);
- } catch (MetaDataException e) {
- throw new DocumentException(e);
- }
- }
-
- public DocumentLocator getLocator() {
- SiteStructure structure = area().getSite();
- if (!structure.containsByUuid(getUUID(), getLanguage())) {
- throw new RuntimeException("The document [" + this
- + "] is not referenced in the site structure.");
- }
- try {
- return DocumentLocator.getLocator(getPublication().getId(), getArea(), structure
- .getByUuid(getUUID(), getLanguage()).getNode().getPath(), getLanguage());
- } catch (SiteException e) {
- throw new RuntimeException(e);
- }
- }
-
- public String getPath() throws DocumentException {
- return getLink().getNode().getPath();
- }
-
- public boolean existsAreaVersion(String area) {
- String sourceUri = getSourceURI(getPublication(), area, getUUID(), getLanguage());
- try {
- return SourceUtil.exists(sourceUri, this.manager);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public boolean existsTranslation(String language) {
- return area().contains(getUUID(), language);
- }
-
- public Document getAreaVersion(String area) throws DocumentException {
- try {
- return getFactory().get(getPublication(), area, getUUID(), getLanguage());
- } catch (DocumentBuildException e) {
- throw new DocumentException(e);
- }
- }
-
- public Document getTranslation(String language) throws DocumentException {
- try {
- return getFactory().get(getPublication(), getArea(), getUUID(), language);
- } catch (DocumentBuildException e) {
- throw new DocumentException(e);
- }
- }
-
- private Node repositoryNode;
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getRepositoryNode()
- */
- public Node getRepositoryNode() {
- if (this.repositoryNode == null) {
- this.repositoryNode = getRepositoryNode(this.manager, getFactory(), getSourceURI());
- }
- return this.repositoryNode;
- }
-
- protected ContentHolder getContentHolder() {
- Node node = getRepositoryNode();
- if (isRevisionSpecified()) {
- try {
- return node.getHistory().getRevision(revision);
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- } else {
- return node;
- }
- }
-
- protected static Node getRepositoryNode(ServiceManager manager, DocumentFactory docFactory,
- String sourceUri) {
- Session session = docFactory.getSession();
- NodeFactory factory = null;
- try {
- factory = (NodeFactory) manager.lookup(NodeFactory.ROLE);
- return (Node) session.getRepositoryItem(factory, sourceUri);
- } catch (Exception e) {
- throw new RuntimeException("Creating repository node failed: ", e);
- } finally {
- if (factory != null) {
- manager.release(factory);
- }
- }
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Document#getSourceURI()
- */
- public String getSourceURI() {
- return getSourceURI(getPublication(), getArea(), getUUID(), getLanguage());
- }
-
- protected static String getSourceURI(Publication pub, String area, String uuid, String language) {
- String path = pub.getPathMapper().getPath(uuid, language);
- return pub.getSourceURI() + "/content/" + area + "/" + path;
- }
-
- public boolean existsVersion(String area, String language) {
- String sourceUri = getSourceURI(getPublication(), area, getUUID(), language);
- try {
- return SourceUtil.exists(sourceUri, this.manager);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public Document getVersion(String area, String language) throws DocumentException {
- try {
- return getFactory().get(getPublication(), area, getUUID(), language);
- } catch (DocumentBuildException e) {
- throw new DocumentException(e);
- }
- }
-
- public Link getLink() throws DocumentException {
- SiteStructure structure = area().getSite();
- try {
- if (structure.containsByUuid(getUUID(), getLanguage())) {
- return structure.getByUuid(getUUID(), getLanguage());
- } else {
- throw new DocumentException("The document [" + this
- + "] is not referenced in the site structure [" + structure + "].");
- }
- } catch (Exception e) {
- throw new DocumentException(e);
- }
- }
-
- public boolean hasLink() {
- return area().getSite().containsByUuid(getUUID(), getLanguage());
- }
-
- public Area area() {
- try {
- return getPublication().getArea(getArea());
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void setResourceType(ResourceType resourceType) {
- checkWritability();
- Assert.notNull("resource type", resourceType);
- try {
- MetaData meta = getMetaData(DocumentImpl.METADATA_NAMESPACE);
- meta.setValue(DocumentImpl.METADATA_RESOURCE_TYPE, resourceType.getName());
- } catch (MetaDataException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void setSourceExtension(String extension) {
- checkWritability();
- Assert.notNull("extension", extension);
- Assert.isTrue("extension doesn't start with a dot", !extension.startsWith("."));
- try {
- MetaData meta = getMetaData(DocumentImpl.METADATA_NAMESPACE);
- meta.setValue(DocumentImpl.METADATA_EXTENSION, extension);
- } catch (MetaDataException e) {
- throw new RuntimeException(e);
- }
- }
-
- public OutputStream getOutputStream() {
- checkWritability();
- try {
- return getRepositoryNode().getOutputStream();
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
-
- protected void checkWritability() {
- if (isRevisionSpecified()) {
- throw new UnsupportedOperationException();
- }
- }
-
- protected boolean isRevisionSpecified() {
- return this.revision != -1;
- }
-
- public InputStream getInputStream() {
- try {
- return getRepositoryNode().getInputStream();
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
-
- public Session getSession() {
- return getFactory().getSession();
- }
-
- public int getRevisionNumber() {
- if (!isRevisionSpecified()) {
- throw new UnsupportedOperationException(
- "This is not a particular revision of the document [" + this + "].");
- }
- return this.revision;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java
deleted file mode 100644
index 65c811b..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java
+++ /dev/null
@@ -1,971 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-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 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.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.io.output.ByteArrayOutputStream;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.metadata.MetaDataException;
-import org.apache.lenya.cms.publication.util.DocumentSet;
-import org.apache.lenya.cms.publication.util.DocumentVisitor;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.UUIDGenerator;
-import org.apache.lenya.cms.site.Link;
-import org.apache.lenya.cms.site.NodeIterator;
-import org.apache.lenya.cms.site.NodeSet;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteManager;
-import org.apache.lenya.cms.site.SiteNode;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.site.SiteUtil;
-import org.apache.lenya.util.Assert;
-
-/**
- * DocumentManager implementation.
- *
- * @version $Id$
- */
-public class DocumentManagerImpl extends AbstractLogEnabled implements DocumentManager,
- Serviceable, Contextualizable {
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentManager#add(org.apache.lenya.cms.publication.Document,
- * java.lang.String, java.lang.String, java.lang.String,
- * java.lang.String, java.lang.String, boolean)
- */
- public Document add(Document sourceDocument, String area, String path, String language,
- String extension, String navigationTitle, boolean visibleInNav)
- throws DocumentBuildException, PublicationException {
-
- Document document = add(sourceDocument.getFactory(), sourceDocument.getResourceType(),
- sourceDocument.getInputStream(), sourceDocument.getPublication(), area, path,
- language, extension, navigationTitle, visibleInNav, sourceDocument.getMimeType());
-
- copyMetaData(sourceDocument, document);
- return document;
- }
-
- /**
- * Copies meta data from one document to another. If the destination
- * document is a different area version, the meta data are duplicated (i.e.,
- * onCopy = delete is neglected).
- * @param source
- * @param destination
- * @throws PublicationException
- */
- protected void copyMetaData(Document source, Document destination) throws PublicationException {
-
- boolean duplicate = source.getUUID().equals(destination.getUUID())
- && source.getLanguage().equals(destination.getLanguage())
- && !source.getArea().equals(destination.getArea());
-
- try {
- String[] uris = source.getMetaDataNamespaceUris();
- for (int i = 0; i < uris.length; i++) {
- if (duplicate) {
- destination.getMetaData(uris[i]).forcedReplaceBy(source.getMetaData(uris[i]));
- } else {
- destination.getMetaData(uris[i]).replaceBy(source.getMetaData(uris[i]));
- }
- }
- } catch (MetaDataException e) {
- throw new PublicationException(e);
- }
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentManager#add(org.apache.lenya.cms.publication.DocumentFactory,
- * org.apache.lenya.cms.publication.ResourceType, java.lang.String,
- * org.apache.lenya.cms.publication.Publication, java.lang.String,
- * java.lang.String, java.lang.String, java.lang.String,
- * java.lang.String, boolean)
- */
- public Document add(DocumentFactory factory, ResourceType documentType,
- String initialContentsURI, Publication pub, String area, String path, String language,
- String extension, String navigationTitle, boolean visibleInNav)
- throws DocumentBuildException, DocumentException, PublicationException {
-
- Area areaObj = pub.getArea(area);
- SiteStructure site = areaObj.getSite();
- if (site.contains(path) && site.getNode(path).hasLink(language)) {
- throw new DocumentException("The link [" + path + ":" + language
- + "] is already contained in site [" + site + "]");
- }
-
- Document document = add(factory, documentType, initialContentsURI, pub, area, language,
- extension);
-
- addToSiteManager(path, document, navigationTitle, visibleInNav);
- return document;
- }
-
- protected Document add(DocumentFactory factory, ResourceType documentType,
- InputStream initialContentsStream, Publication pub, String area, String path,
- String language, String extension, String navigationTitle, boolean visibleInNav, String mimeType)
- throws DocumentBuildException, DocumentException, PublicationException {
-
- Area areaObj = pub.getArea(area);
- SiteStructure site = areaObj.getSite();
- if (site.contains(path) && site.getNode(path).hasLink(language)) {
- throw new DocumentException("The link [" + path + ":" + language
- + "] is already contained in site [" + site + "]");
- }
-
- Document document = add(factory, documentType, initialContentsStream, pub, area, language,
- extension, mimeType);
-
- addToSiteManager(path, document, navigationTitle, visibleInNav);
- return document;
- }
-
- public Document add(DocumentFactory factory, ResourceType documentType,
- String initialContentsURI, Publication pub, String area, String language,
- String extension) throws DocumentBuildException, DocumentException,
- PublicationException {
-
- String uuid = generateUUID();
- SourceResolver resolver = null;
- Source source = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
- source = resolver.resolveURI(initialContentsURI);
- return add(factory, documentType, uuid, source.getInputStream(), pub, area, language,
- extension, getMimeType(source));
- } catch (Exception e) {
- throw new PublicationException(e);
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- this.manager.release(resolver);
- }
- }
- }
-
- protected String getMimeType(Source source) {
- String mimeType = source.getMimeType();
- if (mimeType == null) {
- mimeType = "";
- }
- return mimeType;
- }
-
- protected Document add(DocumentFactory factory, ResourceType documentType,
- InputStream initialContentsStream, Publication pub, String area, String language,
- String extension, String mimeType) throws DocumentBuildException, DocumentException,
- PublicationException {
-
- String uuid = generateUUID();
- return add(factory, documentType, uuid, initialContentsStream, pub, area, language,
- extension, mimeType);
- }
-
- protected Document add(DocumentFactory factory, ResourceType documentType, String uuid,
- InputStream stream, Publication pub, String area, String language, String extension, String mimeType)
- throws DocumentBuildException {
- try {
-
- if (exists(factory, pub, area, uuid, language)) {
- throw new DocumentBuildException("The document [" + pub.getId() + ":" + area + ":"
- + uuid + ":" + language + "] already exists!");
- }
-
- Document document = factory.get(pub, area, uuid, language);
- Node node = document.getRepositoryNode();
- node.lock();
-
- document.setResourceType(documentType);
- document.setSourceExtension(extension);
- document.setMimeType(mimeType);
-
- // Write Lenya-internal meta-data
- MetaData lenyaMetaData = document.getMetaData(DocumentImpl.METADATA_NAMESPACE);
- lenyaMetaData.setValue(DocumentImpl.METADATA_CONTENT_TYPE, "xml");
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Create");
- getLogger().debug(" document: [" + document + "]");
- }
-
- create(stream, document);
- return document;
- } catch (Exception e) {
- throw new DocumentBuildException("call to creator for new document failed", e);
- }
- }
-
- protected String generateUUID() throws DocumentBuildException {
- String uuid;
- UUIDGenerator generator = null;
- try {
-
- generator = (UUIDGenerator) this.manager.lookup(UUIDGenerator.ROLE);
- uuid = generator.nextUUID();
-
- } catch (Exception e) {
- throw new DocumentBuildException("call to creator for new document failed", e);
- } finally {
- if (generator != null) {
- this.manager.release(generator);
- }
- }
- return uuid;
- }
-
- protected void create(InputStream stream, Document document) throws Exception {
-
- // Read initial contents as DOM
- if (getLogger().isDebugEnabled())
- getLogger().debug(
- "DefaultCreator::create(), ready to read initial contents from URI [" + stream
- + "]");
-
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
- copy(resolver, stream, document);
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- }
- }
-
- protected void copy(SourceResolver resolver, InputStream sourceInputStream, Document destination)
- throws IOException {
-
- boolean useBuffer = true;
-
- OutputStream destOutputStream = null;
- try {
- destOutputStream = destination.getOutputStream();
-
- if (useBuffer) {
- final ByteArrayOutputStream sourceBos = new ByteArrayOutputStream();
- IOUtils.copy(sourceInputStream, sourceBos);
- IOUtils.write(sourceBos.toByteArray(), destOutputStream);
- } else {
- IOUtils.copy(sourceInputStream, destOutputStream);
- }
- } finally {
- if (destOutputStream != null) {
- destOutputStream.flush();
- destOutputStream.close();
- }
- if (sourceInputStream != null) {
- sourceInputStream.close();
- }
- }
- }
-
- protected void addToSiteManager(String path, Document document, String navigationTitle,
- boolean visibleInNav) throws PublicationException {
- addToSiteManager(path, document, navigationTitle, visibleInNav, null);
- }
-
- protected void addToSiteManager(String path, Document document, String navigationTitle,
- boolean visibleInNav, String followingSiblingPath) throws PublicationException {
- SiteStructure site = document.area().getSite();
- if (!site.contains(path) && followingSiblingPath != null) {
- site.add(path, followingSiblingPath);
- }
- site.add(path, document);
- document.getLink().setLabel(navigationTitle);
- document.getLink().getNode().setVisible(visibleInNav);
- }
-
- /**
- * Template method to copy a document. Override
- * {@link #copyDocumentSource(Document, Document)} to implement access to a
- * custom repository.
- * @see org.apache.lenya.cms.publication.DocumentManager#copy(org.apache.lenya.cms.publication.Document,
- * org.apache.lenya.cms.publication.DocumentLocator)
- */
- public void copy(Document sourceDoc, DocumentLocator destination) throws PublicationException {
-
- if (!destination.getPublicationId().equals(sourceDoc.getPublication().getId())) {
- throw new PublicationException("Can't copy to a different publication!");
- }
-
- SiteStructure destSite = sourceDoc.getPublication().getArea(destination.getArea())
- .getSite();
- String destPath = destination.getPath();
- if (destSite.contains(destination.getPath(), destination.getLanguage())) {
- Document destDoc = destSite.getNode(destPath).getLink(destination.getLanguage())
- .getDocument();
- copyDocumentSource(sourceDoc, destDoc);
- copyInSiteStructure(sourceDoc, destDoc, destPath);
- } else {
- add(sourceDoc, destination.getArea(), destPath, destination.getLanguage(), sourceDoc
- .getExtension(), sourceDoc.getLink().getLabel(), sourceDoc.getLink().getNode()
- .isVisible());
- }
-
- }
-
- protected void copyInSiteStructure(Document sourceDoc, Document destDoc, String destPath)
- throws PublicationException, DocumentException, SiteException {
-
- String destArea = destDoc.getArea();
-
- SiteStructure destSite = sourceDoc.getPublication().getArea(destArea).getSite();
-
- if (sourceDoc.hasLink()) {
- if (destDoc.hasLink()) {
- Link srcLink = sourceDoc.getLink();
- Link destLink = destDoc.getLink();
- destLink.setLabel(srcLink.getLabel());
- destLink.getNode().setVisible(srcLink.getNode().isVisible());
- } else {
- String label = sourceDoc.getLink().getLabel();
- boolean visible = sourceDoc.getLink().getNode().isVisible();
- if (destSite.contains(sourceDoc.getLink().getNode().getPath())) {
- addToSiteManager(destPath, destDoc, label, visible);
- } else {
-
- String followingSiblingPath = null;
-
- if (sourceDoc.getPath().equals(destPath)) {
- SiteStructure sourceSite = sourceDoc.area().getSite();
-
- SiteNode[] sourceSiblings;
- SiteNode sourceNode = sourceDoc.getLink().getNode();
- if (sourceNode.isTopLevel()) {
- sourceSiblings = sourceSite.getTopLevelNodes();
- } else if (sourceNode.getParent() != null) {
- sourceSiblings = sourceNode.getParent().getChildren();
- } else {
- sourceSiblings = new SiteNode[1];
- sourceSiblings[0] = sourceNode;
- }
-
- final int sourcePos = Arrays.asList(sourceSiblings).indexOf(sourceNode);
-
- int pos = sourcePos;
- while (followingSiblingPath == null && pos < sourceSiblings.length) {
- String siblingPath = sourceSiblings[pos].getPath();
- if (destSite.contains(siblingPath)) {
- followingSiblingPath = siblingPath;
- }
- pos++;
- }
- }
-
- if (followingSiblingPath == null) {
- addToSiteManager(destPath, destDoc, label, visible);
- } else {
- addToSiteManager(destPath, destDoc, label, visible, followingSiblingPath);
- }
- }
- }
- }
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentManager#delete(org.apache.lenya.cms.publication.Document)
- */
- public void delete(Document document) throws PublicationException {
- if (!document.exists()) {
- throw new PublicationException("Document [" + document + "] does not exist!");
- }
-
- if (document.hasLink()) {
- document.getLink().delete();
- }
-
- document.delete();
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentManager#move(org.apache.lenya.cms.publication.Document,
- * org.apache.lenya.cms.publication.DocumentLocator)
- */
- public void move(Document sourceDocument, DocumentLocator destination)
- throws PublicationException {
-
- if (!destination.getArea().equals(sourceDocument.getArea())) {
- throw new PublicationException("Can't move to a different area!");
- }
-
- SiteStructure site = sourceDocument.area().getSite();
- if (site.contains(destination.getPath())) {
- throw new PublicationException("The path [" + destination
- + "] is already contained in this publication!");
- }
-
- String label = sourceDocument.getLink().getLabel();
- boolean visible = sourceDocument.getLink().getNode().isVisible();
- sourceDocument.getLink().delete();
-
- site.add(destination.getPath(), sourceDocument);
- sourceDocument.getLink().setLabel(label);
- sourceDocument.getLink().getNode().setVisible(visible);
-
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentManager#copyToArea(org.apache.lenya.cms.publication.Document,
- * java.lang.String)
- */
- public void copyToArea(Document sourceDoc, String destinationArea) throws PublicationException {
- String language = sourceDoc.getLanguage();
- copyToVersion(sourceDoc, destinationArea, language);
- }
-
- protected void copyToVersion(Document sourceDoc, String destinationArea, String language)
- throws DocumentException, DocumentBuildException, PublicationException, SiteException {
-
- Document destDoc;
- if (sourceDoc.existsAreaVersion(destinationArea)) {
- destDoc = sourceDoc.getAreaVersion(destinationArea);
- copyDocumentSource(sourceDoc, destDoc);
- } else {
- destDoc = addVersion(sourceDoc, destinationArea, language);
- }
-
- if (sourceDoc.hasLink()) {
- copyInSiteStructure(sourceDoc, destDoc, sourceDoc.getPath());
- }
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentManager#copyToArea(org.apache.lenya.cms.publication.util.DocumentSet,
- * java.lang.String)
- */
- public void copyToArea(DocumentSet documentSet, String destinationArea)
- throws PublicationException {
- Document[] documents = documentSet.getDocuments();
- for (int i = 0; i < documents.length; i++) {
- copyToArea(documents[i], destinationArea);
- }
- }
-
- protected ServiceManager manager;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager _manager) throws ServiceException {
- this.manager = _manager;
- }
-
- private Context context;
-
- /**
- * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
- */
- public void contextualize(Context _context) throws ContextException {
- this.context = _context;
- }
-
- /**
- * @return The Avalon context.
- */
- protected Context getContext() {
- return this.context;
- }
-
- public void moveAll(Area sourceArea, String sourcePath, Area targetArea, String targetPath)
- throws PublicationException {
- SiteStructure site = sourceArea.getSite();
-
- SiteNode root = site.getNode(sourcePath);
- List subsite = preOrder(root);
-
- for (Iterator n = subsite.iterator(); n.hasNext();) {
- SiteNode node = (SiteNode) n.next();
- String subPath = node.getPath().substring(sourcePath.length());
- targetArea.getSite().add(targetPath + subPath);
- }
- Collections.reverse(subsite);
- for (Iterator n = subsite.iterator(); n.hasNext();) {
- SiteNode node = (SiteNode) n.next();
- String subPath = node.getPath().substring(sourcePath.length());
- moveAllLanguageVersions(sourceArea, sourcePath + subPath, targetArea, targetPath
- + subPath);
- }
- }
-
- protected List preOrder(SiteNode node) {
- List list = new ArrayList();
- list.add(node);
- SiteNode[] children = node.getChildren();
- for (int i = 0; i < children.length; i++) {
- list.addAll(preOrder(children[i]));
- }
- return list;
- }
-
- public void moveAllLanguageVersions(Area sourceArea, String sourcePath, Area targetArea,
- String targetPath) throws PublicationException {
-
- SiteNode sourceNode = sourceArea.getSite().getNode(sourcePath);
- String[] languages = sourceNode.getLanguages();
- for (int i = 0; i < languages.length; i++) {
- Link sourceLink = sourceNode.getLink(languages[i]);
- String label = sourceLink.getLabel();
- Document sourceDoc = sourceLink.getDocument();
- sourceLink.delete();
-
- Document targetDoc;
- if (sourceArea.getName().equals(targetArea.getName())) {
- targetDoc = sourceDoc;
- } else {
- targetDoc = addVersion(sourceDoc, targetArea.getName(), sourceDoc.getLanguage());
- copyRevisions(sourceDoc, targetDoc);
- sourceDoc.delete();
- }
-
- Link link = targetArea.getSite().add(targetPath, targetDoc);
- link.setLabel(label);
- Assert.isTrue("label set", targetDoc.getLink().getLabel().equals(label));
- }
- SiteNode targetNode = targetArea.getSite().getNode(targetPath);
- targetNode.setVisible(sourceNode.isVisible());
- }
-
- protected void copyRevisions(Document sourceDoc, Document targetDoc) throws PublicationException {
- try {
- Node targetNode = targetDoc.getRepositoryNode();
- targetNode.copyRevisionsFrom(sourceDoc.getRepositoryNode());
- } catch (Exception e) {
- throw new PublicationException(e);
- }
- }
-
- public void copyAll(Area sourceArea, String sourcePath, Area targetArea, String targetPath)
- throws PublicationException {
-
- SiteStructure site = sourceArea.getSite();
- SiteNode root = site.getNode(sourcePath);
-
- List preOrder = preOrder(root);
- for (Iterator i = preOrder.iterator(); i.hasNext(); ) {
- SiteNode node = (SiteNode) i.next();
- String nodeSourcePath = node.getPath();
- String nodeTargetPath = targetPath + nodeSourcePath.substring(sourcePath.length());
- copyAllLanguageVersions(sourceArea, nodeSourcePath, targetArea, nodeTargetPath);
- }
- }
-
- public void copyAllLanguageVersions(Area sourceArea, String sourcePath, Area targetArea,
- String targetPath) throws PublicationException {
- Publication pub = sourceArea.getPublication();
-
- SiteNode sourceNode = sourceArea.getSite().getNode(sourcePath);
- String[] languages = sourceNode.getLanguages();
-
- Document targetDoc = null;
-
- for (int i = 0; i < languages.length; i++) {
- Document sourceVersion = sourceNode.getLink(languages[i]).getDocument();
- DocumentLocator targetLocator = DocumentLocator.getLocator(pub.getId(), targetArea
- .getName(), targetPath, languages[i]);
- if (targetDoc == null) {
- copy(sourceVersion, targetLocator.getLanguageVersion(languages[i]));
- targetDoc = targetArea.getSite().getNode(targetPath).getLink(languages[i])
- .getDocument();
- } else {
- targetDoc = addVersion(targetDoc, targetLocator.getArea(), languages[i]);
- addToSiteManager(targetLocator.getPath(), targetDoc, sourceVersion.getLink()
- .getLabel(), sourceVersion.getLink().getNode().isVisible());
- copyDocumentSource(sourceVersion, targetDoc);
- }
- }
- }
-
- /**
- * Copies a document source.
- * @param sourceDocument The source document.
- * @param destinationDocument The destination document.
- * @throws PublicationException when something went wrong.
- */
- public void copyDocumentSource(Document sourceDocument, Document destinationDocument)
- throws PublicationException {
- copyContent(sourceDocument, destinationDocument);
- copyMetaData(sourceDocument, destinationDocument);
- }
-
- protected void copyContent(Document sourceDocument, Document destinationDocument)
- throws PublicationException {
- boolean useBuffer = true;
-
- OutputStream destOutputStream = null;
- InputStream sourceInputStream = null;
- try {
- try {
- sourceInputStream = sourceDocument.getInputStream();
- destOutputStream = destinationDocument.getOutputStream();
-
- if (useBuffer) {
- final ByteArrayOutputStream sourceBos = new ByteArrayOutputStream();
- IOUtils.copy(sourceInputStream, sourceBos);
- IOUtils.write(sourceBos.toByteArray(), destOutputStream);
- } else {
- IOUtils.copy(sourceInputStream, destOutputStream);
- }
- } finally {
- if (destOutputStream != null) {
- destOutputStream.flush();
- destOutputStream.close();
- }
- if (sourceInputStream != null) {
- sourceInputStream.close();
- }
- }
- } catch (Exception e) {
- throw new PublicationException(e);
- }
- }
-
- /**
- * Abstract base class for document visitors which operate on a source and
- * target document.
- */
- public abstract class SourceTargetVisitor implements DocumentVisitor {
-
- private DocumentLocator rootSource;
- private DocumentLocator rootTarget;
- private DocumentManager manager;
-
- /**
- * Ctor.
- * @param manager The document manager.
- * @param source The root source.
- * @param target The root target.
- */
- public SourceTargetVisitor(DocumentManager manager, Document source, DocumentLocator target) {
- this.manager = manager;
- this.rootSource = source.getLocator();
- this.rootTarget = target;
- }
-
- /**
- * @return the root source
- */
- protected DocumentLocator getRootSource() {
- return rootSource;
- }
-
- /**
- * @return the root target
- */
- protected DocumentLocator getRootTarget() {
- return rootTarget;
- }
-
- /**
- * @return the document manager
- */
- protected DocumentManager getDocumentManager() {
- return this.manager;
- }
-
- /**
- * Returns the target corresponding to a source relatively to the root
- * target document.
- * @param source The source.
- * @return A document.
- * @throws DocumentBuildException if the target could not be built.
- */
- protected DocumentLocator getTarget(Document source) throws DocumentBuildException {
- DocumentLocator sourceLocator = source.getLocator();
- String rootSourcePath = getRootSource().getPath();
- if (sourceLocator.getPath().equals(rootSourcePath)) {
- return rootTarget;
- } else {
- String relativePath = sourceLocator.getPath().substring(rootSourcePath.length());
- return rootTarget.getDescendant(relativePath);
- }
- }
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentManager#deleteAll(org.apache.lenya.cms.publication.Document)
- */
- public void deleteAll(Document document) throws PublicationException {
-
- SiteManager siteManager = null;
- ServiceSelector selector = null;
- try {
- selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
- siteManager = (SiteManager) selector.select(document.getPublication()
- .getSiteManagerHint());
-
- NodeSet subsite = SiteUtil.getSubSite(this.manager, document.getLink().getNode());
- for (NodeIterator i = subsite.descending(); i.hasNext();) {
- SiteNode node = i.next();
- String[] languages = node.getLanguages();
- for (int l = 0; l < languages.length; l++) {
- Document doc = node.getLink(languages[l]).getDocument();
- delete(doc);
- }
- }
- } catch (ServiceException e) {
- throw new PublicationException(e);
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- this.manager.release(selector);
- }
- }
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentManager#deleteAllLanguageVersions(org.apache.lenya.cms.publication.Document)
- */
- public void deleteAllLanguageVersions(Document document) throws PublicationException {
- DocumentFactory identityMap = document.getFactory();
- String[] languages = document.getLanguages();
- for (int i = 0; i < languages.length; i++) {
- DocumentLocator version = document.getLocator().getLanguageVersion(languages[i]);
- delete(identityMap.get(version));
- }
- }
-
- /**
- * Visitor to delete documents.
- */
- public class DeleteVisitor implements DocumentVisitor {
-
- private DocumentManager manager;
-
- /**
- * Ctor.
- * @param manager The document manager.
- */
- public DeleteVisitor(DocumentManager manager) {
- this.manager = manager;
- }
-
- protected DocumentManager getDocumentManager() {
- return this.manager;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.util.DocumentVisitor#visitDocument(org.apache.lenya.cms.publication.Document)
- */
- public void visitDocument(Document document) throws PublicationException {
- getDocumentManager().deleteAllLanguageVersions(document);
- }
-
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentManager#delete(org.apache.lenya.cms.publication.util.DocumentSet)
- */
- public void delete(DocumentSet documents) throws PublicationException {
-
- if (documents.isEmpty()) {
- return;
- }
-
- SiteManager siteManager = null;
- ServiceSelector selector = null;
- try {
- selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
- Publication pub = documents.getDocuments()[0].getPublication();
- siteManager = (SiteManager) selector.select(pub.getSiteManagerHint());
-
- DocumentSet set = new DocumentSet(documents.getDocuments());
- sortAscending(set);
- set.reverse();
-
- DocumentVisitor visitor = new DeleteVisitor(this);
- set.visit(visitor);
- } catch (ServiceException e) {
- throw new PublicationException(e);
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- this.manager.release(selector);
- }
- }
-
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentManager#move(org.apache.lenya.cms.publication.util.DocumentSet,
- * org.apache.lenya.cms.publication.util.DocumentSet)
- */
- public void move(DocumentSet sources, DocumentSet destinations) throws PublicationException {
- copy(sources, destinations);
- delete(sources);
- /*
- * Document[] sourceDocs = sources.getDocuments(); Document[] targetDocs =
- * destinations.getDocuments();
- *
- * if (sourceDocs.length != targetDocs.length) { throw new
- * PublicationException( "The number of source and destination documents
- * must be equal!"); }
- *
- * Map source2target = new HashMap(); for (int i = 0; i <
- * sourceDocs.length; i++) { source2target.put(sourceDocs[i],
- * targetDocs[i]); }
- *
- * DocumentSet sortedSources = new DocumentSet(sourceDocs);
- * SiteUtil.sortAscending(this.manager, sortedSources); Document[]
- * sortedSourceDocs = sortedSources.getDocuments();
- *
- * for (int i = 0; i < sortedSourceDocs.length; i++) {
- * move(sortedSourceDocs[i], (Document)
- * source2target.get(sortedSourceDocs[i])); }
- */
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentManager#copy(org.apache.lenya.cms.publication.util.DocumentSet,
- * org.apache.lenya.cms.publication.util.DocumentSet)
- */
- public void copy(DocumentSet sources, DocumentSet destinations) throws PublicationException {
- Document[] sourceDocs = sources.getDocuments();
- Document[] targetDocs = destinations.getDocuments();
-
- if (sourceDocs.length != targetDocs.length) {
- throw new PublicationException(
- "The number of source and destination documents must be equal!");
- }
-
- Map source2target = new HashMap();
- for (int i = 0; i < sourceDocs.length; i++) {
- source2target.put(sourceDocs[i], targetDocs[i]);
- }
-
- DocumentSet sortedSources = new DocumentSet(sourceDocs);
- sortAscending(sortedSources);
- Document[] sortedSourceDocs = sortedSources.getDocuments();
-
- for (int i = 0; i < sortedSourceDocs.length; i++) {
- copy(sortedSourceDocs[i], ((Document) source2target.get(sortedSourceDocs[i]))
- .getLocator());
- }
- }
-
- protected void sortAscending(DocumentSet set) throws PublicationException {
-
- if (!set.isEmpty()) {
-
- Document[] docs = set.getDocuments();
- int n = docs.length;
-
- Publication pub = docs[0].getPublication();
- SiteManager siteManager = null;
- ServiceSelector selector = null;
- try {
- selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
- siteManager = (SiteManager) selector.select(pub.getSiteManagerHint());
-
- Set nodes = new HashSet();
- for (int i = 0; i < docs.length; i++) {
- nodes.add(docs[i].getLink().getNode());
- }
-
- SiteNode[] ascending = siteManager.sortAscending((SiteNode[]) nodes
- .toArray(new SiteNode[nodes.size()]));
-
- set.clear();
- for (int i = 0; i < ascending.length; i++) {
- for (int d = 0; d < docs.length; d++) {
- if (docs[d].getPath().equals(ascending[i].getPath())) {
- set.add(docs[d]);
- }
- }
- }
-
- if (set.getDocuments().length != n) {
- throw new IllegalStateException("Number of documents has changed!");
- }
-
- } catch (final ServiceException e) {
- throw new PublicationException(e);
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- this.manager.release(selector);
- }
- }
- }
- }
-
- public Document addVersion(Document sourceDocument, String area, String language,
- boolean addToSiteStructure) throws DocumentBuildException, PublicationException {
- Document document = addVersion(sourceDocument, area, language);
-
- if (addToSiteStructure && sourceDocument.hasLink()) {
- String path = sourceDocument.getPath();
- boolean visible = sourceDocument.getLink().getNode().isVisible();
- addToSiteManager(path, document, sourceDocument.getLink().getLabel(), visible);
- }
-
- return document;
- }
-
- public Document addVersion(Document sourceDocument, String area, String language)
- throws DocumentBuildException, DocumentException, PublicationException {
- Document document = add(sourceDocument.getFactory(), sourceDocument.getResourceType(),
- sourceDocument.getUUID(), sourceDocument.getInputStream(), sourceDocument
- .getPublication(), area, language, sourceDocument.getSourceExtension(),
- sourceDocument.getMimeType());
- copyMetaData(sourceDocument, document);
-
- return document;
- }
-
- public boolean exists(DocumentFactory factory, Publication pub, String area, String uuid,
- String language) throws PublicationException {
- String sourceUri = DocumentImpl.getSourceURI(pub, area, uuid, language);
- try {
- Node node = DocumentImpl.getRepositoryNode(this.manager, factory, sourceUri);
- return node.exists();
- } catch (RepositoryException e) {
- throw new PublicationException(e);
- }
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java b/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java
deleted file mode 100644
index 81858f7..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java
+++ /dev/null
@@ -1,563 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * A publication's configuration. Keep in sync with
- * src/resources/build/publication.rng!
- */
-public class PublicationConfiguration extends AbstractLogEnabled implements Publication {
-
- private String id;
- private String name;
- private File servletContext;
- private DocumentIdToPathMapper mapper = null;
- private ArrayList languages = new ArrayList();
- private String defaultLanguage = null;
- private String breadcrumbprefix = null;
- private String instantiatorHint = null;
- private String contentDir = null;
-
- private boolean isConfigLoaded = false;
-
- /**
- * <code>CONFIGURATION_FILE</code> The publication configuration file
- */
- public static final String CONFIGURATION_FILE = CONFIGURATION_PATH + File.separator
- + "publication.xml";
-
- private static final String CONFIGURATION_NAMESPACE = "http://apache.org/cocoon/lenya/publication/1.1";
-
- // properties marked with "*" are currently not parsed by this class.
- private static final String ELEMENT_NAME = "name";
- private static final String ELEMENT_DESCRIPTION = "description"; // *
- private static final String ELEMENT_LONGDESC = "longdesc"; // *
- private static final String ELEMENT_VERSION = "version"; // *
- private static final String ELEMENT_LENYA_VERSION = "lenya-version"; // *
- private static final String ELEMENT_LENYA_REVISION = "lenya-revision"; // *
- private static final String ELEMENT_COCOON_VERSION = "cocoon-version"; // *
- private static final String ELEMENT_LANGUAGES = "languages";
- private static final String ELEMENT_LANGUAGE = "language";
- private static final String ATTRIBUTE_DEFAULT_LANGUAGE = "default";
- private static final String ELEMENT_TEMPLATE = "template";
- private static final String ATTRIBUTE_ID = "id";
- private static final String ELEMENT_TEMPLATE_INSTANTIATOR = "template-instantiator";
- private static final String ATTRIBUTE_NAME = "name";
- private static final String ELEMENT_PATH_MAPPER = "path-mapper";
- private static final String ELEMENT_DOCUMENT_BUILDER = "document-builder";
- private static final String ELEMENT_SITE_MANAGER = "site-manager";
- private static final String ELEMENT_RESOURCE_TYPES = "resource-types";// *
- private static final String ELEMENT_RESOURCE_TYPE = "resource-type";// *
- private static final String ATTRIBUTE_WORKFLOW = "workflow";
- private static final String ELEMENT_MODULES = "modules";// *
- private static final String ELEMENT_MODULE = "module";// *
- private static final String ELEMENT_BREADCRUMB_PREFIX = "breadcrumb-prefix";
- private static final String ELEMENT_CONTENT_DIR = "content-dir";
- private static final String ATTRIBUTE_SRC = "src";
- private static final String ELEMENT_PROXIES = "proxies";
- private static final String ELEMENT_PROXY = "proxy";
- private static final String ATTRIBUTE_AREA = "area";
- private static final String ATTRIBUTE_URL = "url";
- private static final String ATTRIBUTE_SSL = "ssl";
-
- /**
- * Creates a new instance of Publication
- * @param _id the publication id
- * @param servletContextPath the servlet context of this publication
- * @throws PublicationException if there was a problem reading the config
- * file
- */
- protected PublicationConfiguration(String _id, String servletContextPath)
- throws PublicationException {
- this.id = _id;
- this.servletContext = new File(servletContextPath);
- }
-
- /**
- * Loads the configuration.
- */
- protected void loadConfiguration() {
-
- if (isConfigLoaded) {
- return;
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Loading configuration for publication [" + getId() + "]");
- }
-
- File configFile = getConfigurationFile();
-
- if (!configFile.exists()) {
- getLogger().error(
- "Config file [" + configFile.getAbsolutePath() + "] does not exist: ",
- new RuntimeException());
- throw new RuntimeException("The configuration file [" + configFile
- + "] does not exist!");
- } else {
- getLogger().debug("Configuration file [" + configFile + "] exists.");
- }
-
- final boolean ENABLE_XML_NAMESPACES = true;
- DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder(ENABLE_XML_NAMESPACES);
-
- Configuration config;
-
- String pathMapperClassName = null;
-
- try {
- config = builder.buildFromFile(configFile);
-
- this.name = config.getChild(ELEMENT_NAME).getValue();
-
- try {
- // one sanity check for the proper namespace. we should really
- // do that for every element,
- // but since ELEMENT_PATH_MAPPER is mandatory, this should catch
- // most cases of forgotten namespace.
- if (config.getChild(ELEMENT_PATH_MAPPER).getNamespace() != CONFIGURATION_NAMESPACE) {
- getLogger().warn(
- "Deprecated configuration: the publication configuration elements in "
- + configFile + " must be in the " + CONFIGURATION_NAMESPACE
- + " namespace."
- + " See webapp/lenya/resources/schemas/publication.xml.");
- }
- pathMapperClassName = config.getChild(ELEMENT_PATH_MAPPER).getValue();
- Class pathMapperClass = Class.forName(pathMapperClassName);
- this.mapper = (DocumentIdToPathMapper) pathMapperClass.newInstance();
- } catch (final ClassNotFoundException e) {
- throw new PublicationException("Cannot instantiate documentToPathMapper: ["
- + pathMapperClassName + "]", e);
- }
-
- Configuration documentBuilderConfiguration = config.getChild(ELEMENT_DOCUMENT_BUILDER,
- false);
- if (documentBuilderConfiguration != null) {
- this.documentBuilderHint = documentBuilderConfiguration
- .getAttribute(ATTRIBUTE_NAME);
- }
-
- Configuration[] _languages = config.getChild(ELEMENT_LANGUAGES).getChildren(
- ELEMENT_LANGUAGE);
- for (int i = 0; i < _languages.length; i++) {
- Configuration languageConfig = _languages[i];
- String language = languageConfig.getValue();
- this.languages.add(language);
- if (languageConfig.getAttribute(ATTRIBUTE_DEFAULT_LANGUAGE, null) != null) {
- this.defaultLanguage = language;
- }
- }
-
- Configuration siteManagerConfiguration = config.getChild(ELEMENT_SITE_MANAGER, false);
- if (siteManagerConfiguration != null) {
- this.siteManagerName = siteManagerConfiguration.getAttribute(ATTRIBUTE_NAME);
- }
-
- Configuration proxiesConfig = config.getChild(ELEMENT_PROXIES);
- Configuration[] proxyConfigs = proxiesConfig.getChildren(ELEMENT_PROXY);
- for (int i = 0; i < proxyConfigs.length; i++) {
- String url = proxyConfigs[i].getAttribute(ATTRIBUTE_URL);
- String ssl = proxyConfigs[i].getAttribute(ATTRIBUTE_SSL);
- String area = proxyConfigs[i].getAttribute(ATTRIBUTE_AREA);
-
- Proxy proxy = new Proxy();
- proxy.setUrl(url);
-
- Object key = getProxyKey(area, Boolean.valueOf(ssl).booleanValue());
- this.areaSsl2proxy.put(key, proxy);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- "Adding proxy: [" + proxy + "] for area=[" + area + "] SSL=[" + ssl
- + "]");
- }
- }
-
- Configuration templateConfig = config.getChild(ELEMENT_TEMPLATE, false);
- // FIXME: this is a hack. For some reason, the old code seems to
- // imply that a publication
- // can have multiple templates. This is not the case. All this code
- // should use a simple string
- // rather than arrays at some point. For now, the old array is kept,
- // to avoid having to deal
- // with all kinds of NPEs that keep cropping up...
- if (templateConfig == null) {
- this.templates = new String[0]; // ugh. empty array to keep the
- // legacy code from breaking.
- } else {
- this.templates = new String[1];
- this.templates[0] = templateConfig.getAttribute(ATTRIBUTE_ID);
- }
-
- Configuration templateInstantiatorConfig = config.getChild(
- ELEMENT_TEMPLATE_INSTANTIATOR, false);
- if (templateInstantiatorConfig != null) {
- this.instantiatorHint = templateInstantiatorConfig
- .getAttribute(PublicationConfiguration.ATTRIBUTE_NAME);
- }
-
- Configuration contentDirConfig = config.getChild(ELEMENT_CONTENT_DIR, false);
- if (contentDirConfig != null) {
- this.contentDir = contentDirConfig.getAttribute(ATTRIBUTE_SRC);
- getLogger().info(
- "Content directory loaded from pub configuration: " + this.contentDir);
- } else {
- getLogger().info("No content directory specified within pub configuration!");
- }
-
- Configuration resourceTypeConfig = config.getChild(ELEMENT_RESOURCE_TYPES);
- if (resourceTypeConfig != null) {
- Configuration[] resourceTypeConfigs = resourceTypeConfig
- .getChildren(ELEMENT_RESOURCE_TYPE);
- for (int i = 0; i < resourceTypeConfigs.length; i++) {
- String name = resourceTypeConfigs[i].getAttribute(ATTRIBUTE_NAME);
- this.resourceTypes.add(name);
-
- String workflow = resourceTypeConfigs[i].getAttribute(ATTRIBUTE_WORKFLOW, null);
- if (workflow != null) {
- this.resourceType2workflow.put(name, workflow);
- }
- }
- }
-
- } catch (final Exception e) {
- throw new RuntimeException("Problem with config file: " + configFile.getAbsolutePath(),
- e);
- }
-
- this.breadcrumbprefix = config.getChild(ELEMENT_BREADCRUMB_PREFIX).getValue("");
-
- isConfigLoaded = true;
- }
-
- /**
- * @return The configuration file ({@link #CONFIGURATION_FILE}).
- */
- protected File getConfigurationFile() {
- File configFile = new File(getDirectory(), CONFIGURATION_FILE);
- return configFile;
- }
-
- /**
- * Returns the publication ID.
- * @return A string value.
- */
- public String getId() {
- return this.id;
- }
-
- /**
- * Returns the servlet context this publication belongs to (usually, the
- * <code>webapps/lenya</code> directory).
- * @return A <code>File</code> object.
- */
- public File getServletContext() {
- return this.servletContext;
- }
-
- /**
- * Returns the publication directory.
- * @return A <code>File</code> object.
- */
- public File getDirectory() {
- return new File(getServletContext(), PUBLICATION_PREFIX + File.separator + getId());
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#getContentDirectory(String)
- */
- public File getContentDirectory(String area) {
- return new File(getContentDir(), area);
- }
-
- /**
- * Set the path mapper
- * @param _mapper The path mapper
- */
- public void setPathMapper(DefaultDocumentIdToPathMapper _mapper) {
- assert _mapper != null;
- this.mapper = _mapper;
- }
-
- /**
- * Returns the path mapper.
- * @return a <code>DocumentIdToPathMapper</code>
- */
- public DocumentIdToPathMapper getPathMapper() {
- if (this.mapper == null) {
- loadConfiguration();
- }
- return this.mapper;
- }
-
- /**
- * Get the default language
- * @return the default language
- */
- public String getDefaultLanguage() {
- if (this.defaultLanguage == null) {
- loadConfiguration();
- }
- return this.defaultLanguage;
- }
-
- /**
- * Set the default language
- * @param language the default language
- */
- public void setDefaultLanguage(String language) {
- this.defaultLanguage = language;
- }
-
- /**
- * Get all available languages for this publication
- * @return an <code>Array</code> of languages
- */
- public String[] getLanguages() {
- loadConfiguration();
- return (String[]) this.languages.toArray(new String[this.languages.size()]);
- }
-
- /**
- * Get the breadcrumb prefix. It can be used as a prefix if a publication is
- * part of a larger site
- * @return the breadcrumb prefix
- */
- public String getBreadcrumbPrefix() {
- loadConfiguration();
- return this.breadcrumbprefix;
- }
-
- private String documentBuilderHint;
-
- /**
- * Returns the document builder of this instance.
- * @return A document builder.
- */
- public String getDocumentBuilderHint() {
- loadConfiguration();
- return this.documentBuilderHint;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object object) {
- boolean equals = false;
-
- if (getClass().isInstance(object)) {
- Publication publication = (Publication) object;
- equals = getId().equals(publication.getId())
- && getServletContext().equals(publication.getServletContext());
- }
-
- return equals;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- String key = getServletContext() + ":" + getId();
- return key.hashCode();
- }
-
- private Map areaSsl2proxy = new HashMap();
-
- /**
- * Generates a hash key for a area-SSL combination.
- * @param area The area.
- * @param isSslProtected If the proxy is assigned for SSL-protected pages.
- * @return An object.
- */
- protected Object getProxyKey(String area, boolean isSslProtected) {
- return area + ":" + isSslProtected;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#getProxy(org.apache.lenya.cms.publication.Document,
- * boolean)
- */
- public Proxy getProxy(Document document, boolean isSslProtected) {
- Proxy proxy = getProxy(document.getArea(), isSslProtected);
-
- if (getLogger().isDebugEnabled()) {
- getLogger()
- .debug("Resolving proxy for [" + document + "] SSL=[" + isSslProtected + "]");
- getLogger().debug("Resolved proxy: [" + proxy + "]");
- }
-
- return proxy;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#getProxy(java.lang.String,
- * boolean)
- */
- public Proxy getProxy(String area, boolean isSslProtected) {
- loadConfiguration();
- Object key = getProxyKey(area, isSslProtected);
- Proxy proxy = (Proxy) this.areaSsl2proxy.get(key);
- return proxy;
- }
-
- /**
- * @param area The area.
- * @param isSslProtected If the proxy is for SSL-protected URLs.
- * @param proxy The proxy to set.
- */
- protected void setProxy(String area, boolean isSslProtected, Proxy proxy) {
- Object key = getProxyKey(area, isSslProtected);
- this.areaSsl2proxy.put(key, proxy);
- }
-
- private String siteManagerName;
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#exists()
- */
- public boolean exists() {
- return getConfigurationFile().exists();
- }
-
- private String[] templates;
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#getTemplateIds()
- */
- public String[] getTemplateIds() {
- loadConfiguration();
- List list = Arrays.asList(this.templates);
- return (String[]) list.toArray(new String[list.size()]);
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#getSiteManagerHint()
- */
- public String getSiteManagerHint() {
- loadConfiguration();
- return this.siteManagerName;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#getInstantiatorHint()
- */
- public String getInstantiatorHint() {
- loadConfiguration();
- return this.instantiatorHint;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#getContentDir()
- */
- public String getContentDir() {
- loadConfiguration();
- if (this.contentDir == null) {
- this.contentDir = new File(getDirectory(), CONTENT_PATH).getAbsolutePath();
- }
- return this.contentDir;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#getSourceURI()
- */
- public String getSourceURI() {
- return Node.LENYA_PROTOCOL + PUBLICATION_PREFIX_URI + "/" + this.id;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#getContentURI(java.lang.String)
- */
- public String getContentURI(String area) {
- return getSourceURI() + "/" + CONTENT_PATH + "/" + area;
- }
-
- private Map resourceType2workflow = new HashMap();
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#getWorkflowSchema(org.apache.lenya.cms.publication.ResourceType)
- */
- public String getWorkflowSchema(ResourceType resourceType) {
- String workflow = (String) this.resourceType2workflow.get(resourceType.getName());
- return workflow;
- }
-
- private List resourceTypes = new ArrayList();
-
- /**
- * @see org.apache.lenya.cms.publication.Publication#getResourceTypeNames()
- */
- public String[] getResourceTypeNames() {
- loadConfiguration();
- return (String[]) this.resourceTypes.toArray(new String[this.resourceTypes.size()]);
- }
-
- public String toString() {
- return getId();
- }
-
- public Area getArea(String name) throws PublicationException {
- throw new IllegalStateException("Not implemented!");
- }
-
- private String[] areas;
-
- public String[] getAreaNames() {
- // TODO: make this more generic.
- if (this.areas == null) {
- List list = new ArrayList();
- list.add(Publication.AUTHORING_AREA);
- list.add(Publication.LIVE_AREA);
- list.add(Publication.STAGING_AREA);
- list.add(Publication.TRASH_AREA);
- list.add(Publication.ARCHIVE_AREA);
- this.areas = (String[]) list.toArray(new String[list.size()]);
- }
- return this.areas;
- }
-
- public DocumentFactory getFactory() {
- throw new IllegalStateException("Not implemented!");
- }
-
- public DocumentBuilder getDocumentBuilder() {
- return null;
- }
-
- public String getName() {
- loadConfiguration();
- return this.name;
- }
-
- public Session getSession() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationFactory.java b/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationFactory.java
deleted file mode 100644
index 5df7101..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationFactory.java
+++ /dev/null
@@ -1,52 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryItem;
-import org.apache.lenya.cms.repository.RepositoryItemFactory;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * Publication factory.
- */
-public class PublicationFactory implements RepositoryItemFactory {
-
- private ServiceManager manager;
- private PublicationConfiguration config;
-
- /**
- * @param manager The service manager.
- * @param config The publication configuration.
- */
- public PublicationFactory(ServiceManager manager, PublicationConfiguration config) {
- this.manager = manager;
- this.config = config;
- }
-
- public RepositoryItem buildItem(Session session, String key) throws RepositoryException {
- DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
- return new PublicationImpl(this.manager, factory, config);
- }
-
- public String getItemType() {
- return Publication.ITEM_TYPE;
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationImpl.java
deleted file mode 100644
index ae61927..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationImpl.java
+++ /dev/null
@@ -1,262 +0,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.
- *
- */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * A publication.
- * @version $Id$
- */
-public class PublicationImpl extends AbstractLogEnabled implements Publication {
-
- private PublicationConfiguration delegate;
- protected ServiceManager manager;
- private DocumentFactory factory;
-
- protected PublicationImpl(ServiceManager manager, DocumentFactory factory,
- PublicationConfiguration delegate) {
- this.delegate = delegate;
- this.manager = manager;
- this.factory = factory;
- }
-
- public boolean exists() {
- return delegate.exists();
- }
-
- public String getBreadcrumbPrefix() {
- return delegate.getBreadcrumbPrefix();
- }
-
- public String getContentDir() {
- return delegate.getContentDir();
- }
-
- public File getContentDirectory(String area) {
- return delegate.getContentDirectory(area);
- }
-
- public String getContentURI(String area) {
- return delegate.getContentURI(area);
- }
-
- public String getDefaultLanguage() {
- return delegate.getDefaultLanguage();
- }
-
- public File getDirectory() {
- return delegate.getDirectory();
- }
-
- private DocumentBuilder documentBuilder;
-
- public DocumentBuilder getDocumentBuilder() {
- if (this.documentBuilder == null) {
- ServiceSelector selector = null;
- try {
- selector = (ServiceSelector) this.manager.lookup(DocumentBuilder.ROLE + "Selector");
- this.documentBuilder = (DocumentBuilder) selector.select(delegate.getDocumentBuilderHint());
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- return this.documentBuilder;
- }
-
- public String getId() {
- return delegate.getId();
- }
-
- public String getInstantiatorHint() {
- return delegate.getInstantiatorHint();
- }
-
- public String[] getLanguages() {
- return delegate.getLanguages();
- }
-
- public DocumentIdToPathMapper getPathMapper() {
- return delegate.getPathMapper();
- }
-
- public Proxy getProxy(Document document, boolean isSslProtected) {
- return getProxy(document.getArea(), isSslProtected);
- }
-
- public Proxy getProxy(String area, boolean isSslProtected) {
- Proxy proxy = delegate.getProxy(area, isSslProtected);
- if (proxy == null) {
- String url = getDefaultProxyUrl(area);
- proxy = new Proxy();
- proxy.setUrl(url);
- this.delegate.setProxy(area, isSslProtected, proxy);
- }
- return proxy;
- }
-
- private String contextPath;
-
- protected String getContextPath() {
- if (this.contextPath == null) {
- ContextUtility context = null;
- try {
- context = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
- this.contextPath = context.getRequest().getContextPath();
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- }
- finally {
- if (context != null) {
- this.manager.release(context);
- }
- }
- }
- return this.contextPath;
- }
-
- /**
- * @param area The area.
- * @return The proxy URL if no proxy is declared in {@link PublicationConfiguration#CONFIGURATION_FILE}.
- */
- protected String getDefaultProxyUrl(String area) {
- return getContextPath() + "/" + getId() + "/" + area;
- }
-
- private List allResourceTypes;
-
- protected String getFirstTemplateId() {
- String[] templateIds = getTemplateIds();
- if (templateIds.length > 0) {
- return templateIds[0];
- } else {
- return null;
- }
- }
-
- public String[] getResourceTypeNames() {
- if (this.allResourceTypes == null) {
- this.allResourceTypes = new ArrayList();
- this.allResourceTypes.addAll(Arrays.asList(this.delegate.getResourceTypeNames()));
- String templateId = getFirstTemplateId();
- if (templateId != null) {
- try {
- Publication template = getFactory().getPublication(templateId);
- String[] templateTypes = template.getResourceTypeNames();
- this.allResourceTypes.addAll(Arrays.asList(templateTypes));
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- }
- }
- return (String[]) this.allResourceTypes.toArray(new String[this.allResourceTypes.size()]);
- }
-
- public File getServletContext() {
- return delegate.getServletContext();
- }
-
- public String getSiteManagerHint() {
- return delegate.getSiteManagerHint();
- }
-
- public String getSourceURI() {
- return delegate.getSourceURI();
- }
-
- public String[] getTemplateIds() {
- return delegate.getTemplateIds();
- }
-
- public String getWorkflowSchema(ResourceType resourceType) {
- String schema = this.delegate.getWorkflowSchema(resourceType);
- if (schema == null && getTemplateIds().length > 0) {
- String templateId = getFirstTemplateId();
- try {
- Publication template = getFactory().getPublication(templateId);
- schema = template.getWorkflowSchema(resourceType);
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- }
- return schema;
- }
-
- public void setDefaultLanguage(String language) {
- delegate.setDefaultLanguage(language);
- }
-
- public void setPathMapper(DefaultDocumentIdToPathMapper mapper) {
- delegate.setPathMapper(mapper);
- }
-
- private Map areas = new HashMap();
-
- public Area getArea(String name) throws PublicationException {
- if (!this.areas.containsKey(name)) {
- Area area = new AreaImpl(this.manager, this.factory, this, name);
- this.areas.put(name, area);
- }
- return (Area) this.areas.get(name);
- }
-
- public String[] getAreaNames() {
- return delegate.getAreaNames();
- }
-
- public DocumentFactory getFactory() {
- return this.factory;
- }
-
- public boolean equals(Object obj) {
- if (!getClass().isInstance(obj)) {
- return false;
- }
- return ((Publication) obj).getId().equals(getId());
- }
-
- public int hashCode() {
- return getId().hashCode();
- }
-
- public String toString() {
- return getId();
- }
-
- public String getName() {
- return delegate.getName();
- }
-
- public Session getSession() {
- return getFactory().getSession();
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationManagerImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationManagerImpl.java
deleted file mode 100644
index 6a8f29a..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/publication/PublicationManagerImpl.java
+++ /dev/null
@@ -1,165 +0,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.
- *
- */
-
-/* $Id: PublicationFactory.java 177927 2005-05-23 05:32:20Z gregor $ */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.SourceUtil;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.util.Assert;
-
-/**
- * Factory for creating publication objects.
- */
-public final class PublicationManagerImpl extends AbstractLogEnabled implements PublicationManager,
- Serviceable, Initializable, ThreadSafe {
-
- /**
- * Create a new <code>PublicationFactory</code>.
- */
- public PublicationManagerImpl() {
- }
-
- private Map id2config;
-
- protected synchronized Map getId2config() throws PublicationException {
- if (this.id2config == null) {
- this.id2config = new HashMap();
- File servletContext = new File(this.servletContextPath);
- File publicationsDirectory = new File(servletContext, Publication.PUBLICATION_PREFIX);
- File[] publicationDirectories = publicationsDirectory.listFiles(new FileFilter() {
- public boolean accept(File file) {
- File configFile = new File(file, PublicationConfiguration.CONFIGURATION_FILE);
- return configFile.exists();
- }
- });
- for (int i = 0; i < publicationDirectories.length; i++) {
- String id = publicationDirectories[i].getName();
- addPublication(id);
- }
- }
- return this.id2config;
- }
-
- public Publication getPublication(DocumentFactory factory, String id)
- throws PublicationException {
-
- Assert.notNull("publication ID", id);
- Map id2config = getId2config();
- if (!id2config.containsKey(id)) {
- throw new PublicationException("The publication [" + id + "] does not exist.");
- }
-
- PublicationConfiguration config = (PublicationConfiguration) id2config.get(id);
- PublicationFactory pubFactory = new PublicationFactory(this.manager, config);
- try {
- return (Publication) factory.getSession().getRepositoryItem(pubFactory, id);
- } catch (RepositoryException e) {
- throw new PublicationException(e);
- }
- }
-
- public Publication[] getPublications(DocumentFactory factory) {
- List publications = new ArrayList();
-
- try {
- Map id2config = getId2config();
- for (Iterator i = id2config.keySet().iterator(); i.hasNext();) {
- String publicationId = (String) i.next();
- Publication publication = getPublication(factory, publicationId);
- publications.add(publication);
- }
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- return (Publication[]) publications.toArray(new Publication[publications.size()]);
- }
-
- public String[] getPublicationIds() {
- Set ids;
- try {
- ids = getId2config().keySet();
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- return (String[]) ids.toArray(new String[ids.size()]);
- }
-
- private String servletContextPath;
-
- private ServiceManager manager;
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
- public void initialize() throws Exception {
- SourceResolver resolver = null;
- Source source = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
- source = resolver.resolveURI("context:///");
- this.servletContextPath = SourceUtil.getFile(source).getCanonicalPath();
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- this.manager.release(resolver);
- }
- }
- }
-
- public void addPublication(String pubId) throws PublicationException {
- Map id2config = getId2config();
- if (id2config.containsKey(pubId)) {
- throw new PublicationException("The publication [" + pubId + "] already exists.");
- }
- PublicationConfiguration config = new PublicationConfiguration(pubId,
- this.servletContextPath);
- ContainerUtil.enableLogging(config, getLogger());
- id2config.put(pubId, config);
- }
-
- protected String getServletContextPath() {
- return this.servletContextPath;
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeImpl.java
deleted file mode 100644
index 8a9039e..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeImpl.java
+++ /dev/null
@@ -1,255 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.avalon.framework.configuration.Configurable;
-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.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.util.Assert;
-import org.apache.lenya.xml.Schema;
-
-/**
- * Resource type.
- *
- * @version $Id:$
- */
-public class ResourceTypeImpl extends AbstractLogEnabled implements Configurable, ThreadSafe,
- ResourceType, Serviceable {
-
- /**
- * The default sample name.
- */
- public static final String DEFAULT_SAMPLE_NAME = "Default Sample";
-
- protected static final String ATTRIBUTE_URI = "uri";
- protected static final String ATTRIBUTE_NAME = "name";
- protected static final String ELEMENT_SCHEMA = "schema";
- protected static final String ATTRIBUTE_NAMESPACE = "namespace";
- protected static final String ELEMENT_REWRITE_ATTRIBUTE = "link-attribute";
- protected static final String ATTRIBUTE_XPATH = "xpath";
- protected static final String ELEMENT_SAMPLES = "samples";
- protected static final String ELEMENT_SAMPLE = "sample";
- protected static final String ATTRIBUTE_MIME_TYPE = "mime-type";
- protected static final String ELEMENT_FORMAT = "format";
- protected static final String ELEMENT_EXPIRES = "expires";
- protected static final String ATTRIBUTE_SECONDS = "seconds";
-
- private Schema schema = null;
- private String[] linkAttributeXPaths;
- private Map samples;
- private String samplesUri = null;
- private Map formats = new HashMap();
- private long expires = 0;
- private String name;
- private ServiceManager manager;
-
- /**
- * A format.
- */
- public static class Format {
- private String uri;
- /**
- * @param uri The uri.
- */
- public Format(String uri) {
- Assert.notNull("uri", uri);
- this.uri = uri;
- }
- /**
- * @return The uri.
- */
- public String getURI() {
- return this.uri;
- }
- }
-
-
- /**
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration config) throws ConfigurationException {
-
- try {
-
- Configuration schemaConf = config.getChild(ELEMENT_SCHEMA, false);
-
- if (schemaConf != null) {
- String uri = schemaConf.getAttribute(ATTRIBUTE_URI);
- String language = schemaConf.getAttribute(ATTRIBUTE_NAMESPACE);
- this.schema = new Schema(language, uri);
- }
-
- // determine the sample content locations.
- Configuration samplesFileConf = config.getChild(ELEMENT_SAMPLES, false);
- if (samplesFileConf != null) {
- this.samplesUri = samplesFileConf.getAttribute(ATTRIBUTE_URI);
- }
- else {
- this.samples = loadSamples(config);
- }
-
-
- Configuration[] rewriteAttributeConfigs = config.getChildren(ELEMENT_REWRITE_ATTRIBUTE);
- List xPaths = new ArrayList();
- for (int i = 0; i < rewriteAttributeConfigs.length; i++) {
- String xPath = rewriteAttributeConfigs[i].getAttribute(ATTRIBUTE_XPATH);
- xPaths.add(xPath);
- }
- this.linkAttributeXPaths = (String[]) xPaths.toArray(new String[xPaths.size()]);
-
- Configuration[] formatConfigs = config.getChildren(ELEMENT_FORMAT);
- for (int i = 0; i < formatConfigs.length; i++) {
- String name = formatConfigs[i].getAttribute(ATTRIBUTE_NAME);
- String uri = formatConfigs[i].getAttribute(ATTRIBUTE_URI);
- this.formats.put(name, new Format(uri));
- }
-
- Configuration expiresConf = config.getChild(ELEMENT_EXPIRES, false);
- if (expiresConf != null) {
- this.expires = expiresConf.getAttributeAsLong(ATTRIBUTE_SECONDS);
- }
-
- } catch (Exception e) {
- throw new ConfigurationException("Configuring resource type failed: ", e);
- }
-
- }
-
- protected Map loadSamples(Configuration samplesParentConfig) throws ConfigurationException {
- Configuration[] samplesConf = samplesParentConfig.getChildren(ELEMENT_SAMPLE);
- Map samples = new LinkedHashMap();
- for (int i = 0; i < samplesConf.length; i++) {
- String name = samplesConf[i].getAttribute(ATTRIBUTE_NAME, DEFAULT_SAMPLE_NAME);
- String mimeType = samplesConf[i].getAttribute(ATTRIBUTE_MIME_TYPE);
- String uri = samplesConf[i].getAttribute(ATTRIBUTE_URI);
- samples.put(name, new Sample(name, mimeType, uri));
- }
- return samples;
- }
-
- protected Configuration readConfiguration(String uri) throws ConfigurationException {
- Configuration config;
- DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
- SourceResolver resolver = null;
- Source source = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
- source = resolver.resolveURI(uri);
- config = builder.build(source.getInputStream());
- }
- catch (Exception e) {
- throw new ConfigurationException("Loading samples from URI [" + uri + "] failed: ", e);
- }
- finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- this.manager.release(resolver);
- }
- }
- return config;
- }
-
- public Date getExpires() {
- Date date = new Date();
- date.setTime(date.getTime() + this.expires * 1000l);
- return date;
- }
-
- public Schema getSchema() {
- return this.schema;
- }
-
- public String[] getLinkAttributeXPaths() {
- return this.linkAttributeXPaths;
- }
-
- protected Map getSamples() {
- if (this.samplesUri == null) {
- return this.samples;
- }
- else {
- try {
- Configuration samplesConfig = readConfiguration(this.samplesUri);
- return loadSamples(samplesConfig);
- } catch (ConfigurationException e) {
- throw new RuntimeException(e);
- }
-
- }
- }
-
- public String[] getSampleNames() {
- Set names = getSamples().keySet();
- return (String[]) names.toArray(new String[names.size()]);
- }
-
- public Sample getSample(String name) {
- Map samples = getSamples();
- if (!samples.containsKey(name)) {
- throw new IllegalArgumentException("No sample with name [" + name + "] found.");
- }
- return (Sample) samples.get(name);
- }
-
- public void setName(String name) {
- Assert.notNull("name", name);
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String[] getFormats() {
- Set names = this.formats.keySet();
- return (String[]) names.toArray(new String[names.size()]);
- }
-
- public String getFormatURI(String format) {
-
- if (!this.formats.containsKey(format)) {
- throw new RuntimeException("The resource type [" + getName()
- + "] does not support the format [" + format + "].");
- }
-
- return ((Format) this.formats.get(format)).getURI();
- }
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeSelector.java b/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeSelector.java
deleted file mode 100644
index 666c4f1..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeSelector.java
+++ /dev/null
@@ -1,40 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import org.apache.avalon.framework.component.Component;
-import org.apache.avalon.framework.component.ComponentException;
-import org.apache.cocoon.components.ExtendedComponentSelector;
-
-/**
- * Specifis selector for resource types.
- */
-public class ResourceTypeSelector extends ExtendedComponentSelector{
-
- /**
- * @see org.apache.cocoon.components.ExtendedComponentSelector#select(java.lang.Object)
- */
- public Component select(Object hint) throws ComponentException {
- ResourceType type = (ResourceType) super.select(hint);
- if (type != null) {
- type.setName((String) hint);
- }
- return (Component) type;
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/repository/AxisUUIDGenerator.java b/trunk/src/impl/java/org/apache/lenya/cms/repository/AxisUUIDGenerator.java
deleted file mode 100644
index dd075fe..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/repository/AxisUUIDGenerator.java
+++ /dev/null
@@ -1,43 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.axis.components.uuid.UUIDGen;
-import org.apache.axis.components.uuid.UUIDGenFactory;
-
-/**
- * UUID generator based on Apache Axis.
- */
-public class AxisUUIDGenerator extends AbstractLogEnabled implements UUIDGenerator, ThreadSafe {
-
- private UUIDGen delegate;
-
- protected UUIDGen getDelegate() {
- if (this.delegate == null) {
- this.delegate = UUIDGenFactory.getUUIDGen();
- }
- return this.delegate;
- }
-
- public String nextUUID() {
- return getDelegate().nextUUID();
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java b/trunk/src/impl/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java
deleted file mode 100644
index 71d5531..0000000
--- a/trunk/src/impl/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java
+++ /dev/null
@@ -1,116 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.cms.observation.RepositoryEvent;
-import org.apache.lenya.cms.observation.RepositoryListener;
-import org.apache.lenya.transaction.IdentityMap;
-import org.apache.lenya.transaction.IdentityMapImpl;
-import org.apache.lenya.transaction.Lock;
-import org.apache.lenya.transaction.Lockable;
-import org.apache.lenya.transaction.TransactionException;
-import org.apache.lenya.transaction.Transactionable;
-
-/**
- * Shared item store implementation.
- */
-public class SharedItemStoreImpl extends AbstractLogEnabled implements SharedItemStore, ThreadSafe {
-
- private IdentityMap map;
-
- protected synchronized IdentityMap getIdentityMap() {
- if (this.map == null) {
- this.map = new IdentityMapImpl(getLogger());
- }
- return this.map;
- }
-
- public void addListener(RepositoryListener listener) throws RepositoryException {
- throw new IllegalStateException("Operation not permitted.");
- }
-
- public void commit() throws RepositoryException {
- throw new IllegalStateException("Operation not permitted.");
- }
-
- public void enqueueEvent(RepositoryEvent event) {
- throw new IllegalStateException("Operation not permitted.");
- }
-
- public Identity getIdentity() {
- throw new IllegalStateException("Operation not permitted.");
- }
-
- public RepositoryItem getRepositoryItem(RepositoryItemFactory factory, String key)
- throws RepositoryException {
- RepositoryItemFactoryWrapper wrapper = new RepositoryItemFactoryWrapper(factory, this);
- return (RepositoryItem) getIdentityMap().get(wrapper, key);
- }
-
- public boolean isListenerRegistered(RepositoryListener listener) {
- return false;
- }
-
- public boolean isModifiable() {
- return false;
- }
-
- public void rollback() throws RepositoryException {
- throw new IllegalStateException("Operation not permitted.");
- }
-
- public void setIdentity(Identity identity) {
- throw new IllegalStateException("Operation not permitted.");
- }
-
- public Lock createLock(Lockable lockable, int version) throws TransactionException {
- throw new IllegalStateException("Operation not permitted.");
- }
-
- public boolean isDirty(Transactionable transactionable) {
- return false;
- }
-
- public void registerDirty(Transactionable object) throws TransactionException {
- throw new IllegalStateException("Operation not permitted.");
- }
-
- public void registerNew(Transactionable object) throws TransactionException {
- throw new IllegalStateException("Operation not permitted.");
- }
-
- public void registerRemoved(Transactionable object) throws TransactionException {
- throw new IllegalStateException("Operation not permitted.");
- }
-
- public void removeLock(Lockable lockable) throws TransactionException {
- throw new IllegalStateException("Operation not permitted.");
- }
-
- public synchronized void clear() {
- this.map = null;
- }
-
- public String getId() {
- return getClass().getName();
- }
-
-}
diff --git a/trunk/src/impl/java/org/apache/lenya/lenya.roles b/trunk/src/impl/java/org/apache/lenya/lenya.roles
deleted file mode 100644
index d8666ae..0000000
--- a/trunk/src/impl/java/org/apache/lenya/lenya.roles
+++ /dev/null
@@ -1,186 +0,0 @@
-<?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.
--->
-<!--
- This file contains the role definitions for Lenya-specific Avalon services.
- A role is the interface for an Avalon service.
-
- The name of the role usually corresponds to the class name of the interface,
- and is used for looking up a class implementing that interface.
-
- The relation between a role and implementations for that role may be
- one-to-one or one-to-many.
-
- For a one-to-one relationship, the entry in this file can be sufficient
- to completely specify this role, by setting the "default-class" for that
- role. This is the class name of the implementation.
-
- For a one-to-many relationship, the entry in this file refers to an
- ExtendedComponentSelector, meaning that the list of available
- implementations for that role are retrieved via a selector.
- This requires additional configuration in the Cocoon service
- configuration file (cocoon.xconf).
-
- If a service requires configuration parameters, these can be specified
- in the Cocoon service configuration file (cocoon.xconf) as an arbitrary
- XML snippet which is then automatically passed to the service's
- configure() method at initialization.
-
- $Id$
- -->
-
-<!DOCTYPE role-list [
-<!ELEMENT role-list (role+)>
-<!ELEMENT role (hint*)>
-<!ELEMENT hint EMPTY>
-<!ATTLIST role name CDATA #REQUIRED
- shorthand CDATA #REQUIRED
- default-class CDATA #IMPLIED
->
-<!ATTLIST hint shorthand CDATA #REQUIRED
- class CDATA #REQUIRED
->
-]>
-
-<role-list>
-
- <role name="org.apache.lenya.ac.AuthorizerSelector"
- shorthand="authorizers"
- default-class="org.apache.cocoon.components.ExtendedComponentSelector">
- <hint shorthand="policy" class="org.apache.lenya.ac.impl.PolicyAuthorizer"/>
- <hint shorthand="workflow" class="org.apache.lenya.cms.ac.workflow.WorkflowAuthorizer"/>
- <hint shorthand="usecase" class="org.apache.lenya.cms.ac.usecase.UsecaseAuthorizer"/>
- </role>
-
- <role name="org.apache.lenya.ac.PolicyManagerSelector"
- shorthand="policy-managers"
- default-class="org.apache.cocoon.components.ExtendedComponentSelector">
- <hint shorthand="file" class="org.apache.lenya.ac.file.FilePolicyManager"/>
- <hint shorthand="sitemap" class="org.apache.lenya.cms.ac.sitemap.SitemapPolicyManager"/>
- </role>
-
- <role name="org.apache.lenya.ac.AccessController"
- shorthand="access-controller"
- default-class="org.apache.lenya.ac.impl.BypassableAccessController"/>
-
- <role name="org.apache.lenya.ac.AccessControllerResolverSelector"
- shorthand="access-controller-resolvers"
- default-class="org.apache.cocoon.components.ExtendedComponentSelector">
- <hint shorthand="composable" class="org.apache.lenya.ac.ComposableAccessControllerResolver"/>
- <hint shorthand="configurable" class="org.apache.lenya.ac.ConfigurableAccessControllerResolver"/>
- <hint shorthand="publication" class="org.apache.lenya.cms.ac.PublicationAccessControllerResolver"/>
- </role>
-
- <role name="org.apache.lenya.ac.Authenticator"
- shorthand="authenticator"
- default-class="org.apache.lenya.ac.impl.UserAuthenticator"/>
-
- <role name="org.apache.lenya.ac.cache.SourceCache"
- shorthand="sourcecache"
- default-class="org.apache.lenya.ac.cache.SourceCacheImpl"/>
-
- <role name="org.apache.lenya.cms.publication.templating.PublicationTemplateManager"
- shorthand="publication-template-manager"
- default-class="org.apache.lenya.cms.publication.templating.PublicationTemplateManagerImpl"/>
-
- <role name="org.apache.lenya.cms.usecase.Operation"
- shorthand="operation"
- default-class="org.apache.lenya.cms.usecase.AbstractOperation"/>
-
- <role name="org.apache.lenya.cms.usecase.UsecaseSelector"
- shorthand="usecases"
- default-class="org.apache.lenya.cms.usecase.impl.UsecaseSelector"/>
-
- <role name="org.apache.lenya.cms.cocoon.flow.FlowHelper"
- shorthand="flowhelper"
- default-class="org.apache.lenya.cms.cocoon.flow.FlowHelperImpl"/>
-
- <role name="org.apache.lenya.workflow.WorkflowManager"
- shorthand="workflow-manager"
- default-class="org.apache.lenya.workflow.impl.WorkflowManagerImpl"/>
-
- <role name="org.apache.lenya.cms.site.usecases.LinkRewriter"
- shorthand="link-rewriter"
- default-class="org.apache.lenya.cms.site.usecases.LinkRewriterImpl"/>
-
- <role name="org.apache.lenya.cms.publication.DocumentManager"
- shorthand="document-manager"
- default-class="org.apache.lenya.cms.publication.DocumentManagerImpl"/>
-
- <role name="org.apache.lenya.cms.publication.DocumentTypeBuilder"
- shorthand="document-type-builder"
- default-class="org.apache.lenya.cms.publication.DocumentTypeBuilderImpl"/>
-
- <role name="org.apache.lenya.cms.publication.ResourcesManager"
- shorthand="resources-manager"
- default-class="org.apache.lenya.cms.publication.DefaultResourcesManager"/>
-
- <role name="org.apache.lenya.cms.site.SiteManagerSelector"
- shorthand="site-managers"
- default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
-
- <role name="org.apache.lenya.cms.publication.DocumentBuilderSelector"
- shorthand="document-builders"
- default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
-
- <role name="org.apache.lenya.cms.publication.templating.InstantiatorSelector"
- shorthand="template-instantiators"
- default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
-
- <role name="org.apache.lenya.cms.usecase.gui.GUIManager"
- shorthand="gui-manager"
- default-class="org.apache.lenya.cms.usecase.gui.impl.GUIManagerImpl"/>
-
- <role name="org.apache.lenya.cms.publication.ResourceTypeSelector"
- shorthand="resource-types"
- default-class="org.apache.lenya.cms.publication.ResourceTypeSelector"/>
-
- <role name="org.apache.lenya.cms.metadata.ElementSetSelector"
- shorthand="meta-data"
- default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
-
- <role name="org.apache.lenya.cms.repository.RepositoryManager"
- shorthand="repository-manager"
- default-class="org.apache.lenya.cms.repository.RepositoryManagerImpl"/>
-
- <role name="org.apache.lenya.cms.publication.PublicationManager"
- shorthand="publication-manager"
- default-class="org.apache.lenya.cms.publication.PublicationManagerImpl"/>
-
- <role name="org.apache.lenya.cms.repo.avalon.RepositoryFactory"
- shorthand="repository-factory"
- default-class="org.apache.lenya.cms.repo.avalon.RepositoryFactoryImpl"/>
-
-<!-- RGE: inserted roles used by the Lucene2 block -->
-
- <!-- default indexer -->
- <role name="org.apache.cocoon.components.search.components.Indexer/default" shorthand="default_indexer"
-default-class="org.apache.cocoon.components.search.components.impl.DefaultIndexerImpl"/>
-
- <!-- parallel indexer -->
- <role name="org.apache.cocoon.components.search.components.Indexer/parallel" shorthand="parallel_indexer"
-default-class="org.apache.cocoon.components.search.components.impl.ParallelIndexerImpl"/>
-
- <!-- analyzer manager -->
- <role name="org.apache.cocoon.components.search.components.AnalyzerManager" shorthand="analyzer_manager"
-default-class="org.apache.cocoon.components.search.components.impl.AnalyzerManagerImpl"/>
-
- <!-- index manager -->
- <role name="org.apache.cocoon.components.search.components.IndexManager" shorthand="index_manager"
-default-class="org.apache.cocoon.components.search.components.impl.IndexManagerImpl"/>
-
-</role-list>
diff --git a/trunk/src/impl/test/anteater/tests.xml b/trunk/src/impl/test/anteater/tests.xml
deleted file mode 100644
index e3fa051..0000000
--- a/trunk/src/impl/test/anteater/tests.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<!DOCTYPE project [
- <!ENTITY default SYSTEM "../../webapp/lenya/pubs/default/test/anteater/tests.xml">
-]>
-
-<project name="Lenya Anteater Tests" default="tests">
-
- <taskdef resource="META-INF/Anteater.tasks"/>
- <typedef resource="META-INF/Anteater.types"/>
-
- <property name="default.port" value="8888"/>
- <property name="default.haltonerror" value="true"/>
-
- <target name="tests"
- depends="
- pubs.default
- "/>
-
- &default;
-
-</project>
\ No newline at end of file
diff --git a/trunk/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java b/trunk/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java
deleted file mode 100644
index ab9a462..0000000
--- a/trunk/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java
+++ /dev/null
@@ -1,203 +0,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.
- *
- */
-
-/* $Id: AccessControlTest.java 408702 2006-05-22 16:03:49Z andreas $ */
-
-package org.apache.lenya.ac.impl;
-
-import java.io.File;
-
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccessControllerResolver;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.file.FileAccreditableManager;
-import org.apache.lenya.cms.LenyaTestCase;
-import org.apache.lenya.cms.ac.PublicationAccessControllerResolver;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.cms.repository.SessionImpl;
-
-/**
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class AbstractAccessControlTest extends LenyaTestCase {
-
- protected static final String TEST_PUB_ID = "test";
- private ServiceSelector accessControllerResolverSelector;
- private AccessControllerResolver accessControllerResolver;
- private DefaultAccessController accessController;
-
- protected org.apache.lenya.cms.repository.Session login(String userId)
- throws AccessControlException {
-
- Session session = new SessionImpl(null, true, getManager(), getLogger());
-
- DefaultAccessController ac = getAccessController(session, TEST_PUB_ID);
- AccreditableManager acMgr = ac.getAccreditableManager();
- User user = acMgr.getUserManager().getUser(userId);
-
- if (user == null) {
- throw new AccessControlException("The user [" + userId + "] does not exist!");
- }
-
- ac.setupIdentity(getRequest());
-
- org.apache.cocoon.environment.Session cocoonSession = getRequest().getSession();
- Identity identity = (Identity) cocoonSession.getAttribute(Identity.class.getName());
-
- if (!identity.contains(user)) {
- User oldUser = identity.getUser();
- if (oldUser != null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Removing user [" + oldUser + "] from identity.");
- }
- identity.removeIdentifiable(oldUser);
- }
- identity.addIdentifiable(user);
- }
-
- ac.authorize(getRequest());
-
- Accreditable[] accrs = identity.getAccreditables();
- for (int i = 0; i < accrs.length; i++) {
- getLogger().info("Accreditable: " + accrs[i]);
- }
-
- session.setIdentity(identity);
- return session;
- }
-
- protected DefaultAccessController getAccessController() {
- return getAccessController(getSession(), TEST_PUB_ID);
- }
-
- protected DefaultAccessController getAccessController(Session session, String pubId) {
- DefaultAccessController controller;
- try {
- this.accessControllerResolverSelector = (ServiceSelector) getManager().lookup(
- AccessControllerResolver.ROLE + "Selector");
- assertNotNull(this.accessControllerResolverSelector);
-
- this.accessControllerResolver = (AccessControllerResolver) this.accessControllerResolverSelector
- .select(AccessControllerResolver.DEFAULT_RESOLVER);
-
- assertNotNull(this.accessControllerResolver);
- getLogger().info(
- "Using access controller resolver: ["
- + this.accessControllerResolver.getClass() + "]");
-
- Publication pub = getPublication(session, pubId);
- getLogger().info("Resolve access controller");
- getLogger().info(
- "Publication directory: [" + pub.getDirectory().getAbsolutePath() + "]");
-
- String url = "/" + pubId + "/authoring/index.html";
- controller = (DefaultAccessController) ((PublicationAccessControllerResolver) this.accessControllerResolver)
- .resolveAccessController(url);
-
- assertNotNull(controller);
- getLogger().info("Resolved access controller: [" + controller.getClass() + "]");
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return controller;
- }
-
- /**
- * The teardown method for JUnit
- * @exception Exception if an error occurs
- */
- public void tearDown() throws Exception {
-
- if (this.accessControllerResolverSelector != null) {
- if (this.accessControllerResolver != null) {
- if (this.accessController != null) {
- this.accessControllerResolver.release(this.accessController);
- }
- this.accessControllerResolverSelector.release(this.accessControllerResolver);
- }
- getManager().release(this.accessControllerResolverSelector);
- }
- super.tearDown();
- }
-
- protected static final String USERNAME = "lenya";
-
- /**
- * Returns the policy manager.
- * @return A policy manager.
- */
- protected PolicyManager getPolicyManager() {
- return getAccessController().getPolicyManager();
- }
-
- /**
- * Returns the accreditable manager.
- * @return An accreditable manager.
- */
- protected AccreditableManager getAccreditableManager() {
- return getAccessController().getAccreditableManager();
- }
-
- protected File getAccreditablesDirectory() throws AccessControlException {
- FileAccreditableManager accrMgr = (FileAccreditableManager) getAccreditableManager();
- return accrMgr.getConfigurationDirectory();
- }
-
- protected DocumentFactory getFactory() {
- return DocumentUtil.createDocumentFactory(getManager(), getSession());
- }
-
- protected DocumentFactory getFactory(Session session) {
- return DocumentUtil.createDocumentFactory(getManager(), session);
- }
-
- private Session session;
-
- protected Session getSession() {
- if (this.session == null) {
- try {
- this.session = login("lenya");
- } catch (AccessControlException e) {
- throw new RuntimeException(e);
- }
- }
- return this.session;
- }
-
- protected Publication getPublication(Session session, String pubId) throws PublicationException {
- return getFactory(session).getPublication(pubId);
- }
-
- protected Publication getPublication(String id) throws PublicationException {
- return getFactory().getPublication(id);
- }
-
- protected Identity getIdentity() {
- return getSession().getIdentity();
- }
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/AbstractExcaliburTest.java b/trunk/src/impl/test/org/apache/lenya/cms/AbstractExcaliburTest.java
deleted file mode 100644
index 5431c6d..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/AbstractExcaliburTest.java
+++ /dev/null
@@ -1,54 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms;
-
-import java.io.InputStream;
-
-import org.apache.avalon.excalibur.testcase.ExcaliburTestCase;
-
-/**
- * Abstract base class for excalibur tests
- */
-public abstract class AbstractExcaliburTest extends ExcaliburTestCase {
-
- /**
- * <code>CONFIGURATION</code> The path to the configuration
- */
- public static final String CONFIGURATION = "/" +
- AbstractExcaliburTest.class.getPackage().getName().replace('.', '/') + "/lenya.xtest";
-
- /**
- * @param test The test.
- */
- public AbstractExcaliburTest(String test) {
- super(test);
- }
-
- /**
- * @see org.apache.avalon.excalibur.testcase.ExcaliburTestCase#prepare()
- */
- protected void prepare() throws Exception {
- System.out.println(CONFIGURATION);
- InputStream stream = AbstractExcaliburTest.class.getResourceAsStream(CONFIGURATION);
- prepare(stream);
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/LenyaTestCase.java b/trunk/src/impl/test/org/apache/lenya/cms/LenyaTestCase.java
deleted file mode 100644
index baea69f..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/LenyaTestCase.java
+++ /dev/null
@@ -1,171 +0,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.
- *
- */
-package org.apache.lenya.cms;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.context.DefaultContext;
-import org.apache.cocoon.Constants;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.core.container.ContainerTestCase;
-import org.apache.cocoon.environment.Context;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.commandline.CommandLineContext;
-import org.apache.cocoon.environment.commandline.CommandLineRequest;
-import org.apache.cocoon.environment.mock.MockEnvironment;
-import org.apache.cocoon.util.IOUtils;
-import org.apache.commons.lang.SystemUtils;
-import org.apache.excalibur.source.SourceResolver;
-
-/**
- * Base class for Lenya tests which need the context information.
- */
-public class LenyaTestCase extends ContainerTestCase {
-
- protected DefaultContext context;
-
- protected void addContext(DefaultContext context) {
- super.addContext(context);
-
- this.context = context;
-
- String tempPath = System.getProperty("tempDir", "build/lenya/temp");
- String contextRoot = System.getProperty("contextRoot", "build/lenya/webapp");
- getLogger().info("Adding context root entry [" + contextRoot + "]");
-
- File contextRootDir = new File(contextRoot);
- context.put("context-root", contextRootDir);
-
- String testPath = System.getProperty("testPath", "build/test");
- File testRootDir = new File(testPath);
- context.put("test-path", testRootDir);
-
- Context envContext = new CommandLineContext(contextRoot);
- ContainerUtil.enableLogging(envContext, getLogger());
- context.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, envContext);
-
- File tempDir = new File(tempPath);
-
- File workDir = new File(tempDir, "work");
- context.put("work-directory", workDir);
-
- File cacheDir = new File(tempDir, "cache");
- context.put(Constants.CONTEXT_CACHE_DIR, cacheDir);
-
- File uploadDir = new File(tempDir, "upload");
- context.put(Constants.CONTEXT_UPLOAD_DIR, uploadDir);
-
- context.put(Constants.CONTEXT_CLASS_LOADER, LenyaTestCase.class.getClassLoader());
- context.put(Constants.CONTEXT_CLASSPATH, getClassPath(contextRoot));
- // context.put(Constants.CONTEXT_CONFIG_URL, conf.toURL());
- context.put(Constants.CONTEXT_DEFAULT_ENCODING, "ISO-8859-1");
- }
-
- private Request request = null;
-
- protected Request getRequest() {
- return this.request;
- }
-
- protected void prepare() throws Exception {
- File testPath = new File("build/test");
- final String resourceName = LenyaTestCase.class.getName().replace('.', '/') + ".xtest";
- File resourceFile = new File(testPath, resourceName.replace('/', File.separatorChar));
-
- if (resourceFile.isFile()) {
- getLogger().debug("Loading resource " + resourceFile.getAbsolutePath());
- prepare(new FileInputStream(resourceFile));
- } else {
- getLogger().debug("Resource not found " + resourceName);
- }
-
- SourceResolver resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);
- MockEnvironment env = new MockEnvironment(resolver);
-
- String pathInfo = getWebappUrl();
-
- this.request = new CommandLineRequest(env,
- "",
- "",
- pathInfo,
- new HashMap(),
- getRequestParameters());
- context.put("object-model.request", this.request);
-
- Map objectModel = new HashMap();
- objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
- Context envContext = (Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
- objectModel.put(ObjectModelHelper.CONTEXT_OBJECT, envContext);
- context.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectModel);
-
- }
-
- protected String getWebappUrl() {
- return "/test/authoring/index.html";
- }
-
- protected Map getRequestParameters() {
- return new HashMap();
- }
-
- /**
- * This builds the important ClassPath used by this class. It does so in a neutral way. It
- * iterates in alphabetical order through every file in the lib directory and adds it to the
- * classpath.
- *
- * Also, we add the files to the ClassLoader for the Cocoon system. In order to protect
- * ourselves from skitzofrantic classloaders, we need to work with a known one.
- *
- * @param context The context path
- * @return a <code>String</code> value
- */
- protected String getClassPath(final String context) {
- StringBuffer buildClassPath = new StringBuffer();
-
- String classDir = context + "/WEB-INF/classes";
- buildClassPath.append(classDir);
-
- File root = new File(context + "/WEB-INF/lib");
- if (root.isDirectory()) {
- File[] libraries = root.listFiles();
- Arrays.sort(libraries);
- for (int i = 0; i < libraries.length; i++) {
- if (libraries[i].getAbsolutePath().endsWith(".jar")) {
- buildClassPath.append(File.pathSeparatorChar)
- .append(IOUtils.getFullFilename(libraries[i]));
- }
- }
- }
-
- buildClassPath.append(File.pathSeparatorChar).append(SystemUtils.JAVA_CLASS_PATH);
-
- // Extra class path is necessary for non-classloader-aware java compilers to compile XSPs
- // buildClassPath.append(File.pathSeparatorChar)
- // .append(getExtraClassPath(context));
-
- getLogger().info("Context classpath: " + buildClassPath);
- return buildClassPath.toString();
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/cocoon/generation/TestProxyGeneratorServlet.java b/trunk/src/impl/test/org/apache/lenya/cms/cocoon/generation/TestProxyGeneratorServlet.java
deleted file mode 100644
index 3db7121..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/cocoon/generation/TestProxyGeneratorServlet.java
+++ /dev/null
@@ -1,214 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.generation;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Enumeration;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-
-/**
- * Proxy Generator Servlet Test
- */
-public class TestProxyGeneratorServlet extends HttpServlet {
- /**
- * Initialize, given a servlet configuration
- * @param config The configuration
- * @throws ServletException if an error occurs
- */
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
- }
-
- /**
- * Get a request
- * @param request The request to get
- * @param response The response to put it in
- * @throws IOException if an IO error occurs
- * @throws ServletException if an error occurs
- */
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- response.setContentType("text/xml");
-
- PrintWriter writer = response.getWriter();
- writer.print("<?xml version=\"1.0\"?>");
- writer.print("<servlet class=\"" + this.getClass().getName() + "\">");
- writer.print("<request method=\"GET\">");
- writer.print(getRequestInfo(request));
- writer.print(getParameters(request));
- writer.print(getSession(request));
- writer.print(getCookies(request));
- writer.print("</request>");
- writer.print("</servlet>");
- }
-
- /**
- * Do a POST using the request and store the response in the response object
- * @param request The request
- * @param response The response
- * @throws ServletException if an error occurs
- * @throws IOException if an IO error occurs
- */
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- response.setContentType("text/xml");
-
- PrintWriter writer = response.getWriter();
- writer.print("<?xml version=\"1.0\"?>");
- writer.print("<servlet class=\"" + this.getClass().getName() + "\">");
- writer.print("<request method=\"POST\">");
- writer.print(getRequestInfo(request));
- writer.print(getParameters(request));
- writer.print(getSession(request));
- writer.print(getCookies(request));
- writer.print("</request>");
- writer.print("</servlet>");
- }
-
- /**
- * Return the information about a request: URI, Server name and port
- * @param request The request
- * @return The information (as XML)
- */
- public String getRequestInfo(HttpServletRequest request) {
- StringBuffer sb = new StringBuffer("");
- sb.append("<URI>" + request.getRequestURI() + "</URI>");
- sb.append("<servername>" + request.getServerName() + "</servername>");
- sb.append("<serverport>" + request.getServerPort() + "</serverport>");
-
- return sb.toString();
- }
-
- /**
- * Get all parameters from a request
- * @param request The request
- * @return The parameters (as XML)
- */
- public String getParameters(HttpServletRequest request) {
- StringBuffer sb = new StringBuffer("");
- Enumeration parameters = request.getParameterNames();
- boolean hasParameters = parameters.hasMoreElements();
-
- if (hasParameters) {
- sb.append("<parameters>");
- }
-
- while (parameters.hasMoreElements()) {
- String name = (String) parameters.nextElement();
- String[] values = request.getParameterValues(name);
- sb.append("<parameter name=\"" + name + "\">");
-
- for (int i = 0; i < values.length; i++) {
- sb.append("<value>" + values[i] + "</value>");
- }
-
- sb.append("</parameter>");
- }
-
- if (hasParameters) {
- sb.append("</parameters>");
- }
-
- return sb.toString();
- }
-
- /**
- * Get all session attributes of a request
- * @param request The request
- * @return The session attributes (in XML)
- */
- public String getSession(HttpServletRequest request) {
- StringBuffer sb = new StringBuffer("");
-
- //HttpSession session=request.getSession(true);
- HttpSession session = request.getSession(false);
-
- if (session != null) {
- sb.append("<session>");
-
- Enumeration attributes = session.getAttributeNames();
-
- if (!attributes.hasMoreElements()) {
- sb.append("<noattributes/>");
- }
-
- while (attributes.hasMoreElements()) {
- String attributeName = (String) attributes.nextElement();
- sb.append("<attribute name=\"" + attributeName + "\">");
- sb.append("" + session.getAttribute(attributeName));
- sb.append("</attribute>");
- }
-
- sb.append("</session>");
- } else {
- sb.append("<nosession/>");
- }
-
- return sb.toString();
- }
-
- /**
- * Return all cookies of a request
- * @param request The request
- * @return The cookies (as XML)
- */
- public String getCookies(HttpServletRequest request) {
- StringBuffer sb = new StringBuffer("");
-
- Cookie[] cookies = request.getCookies();
-
- if (cookies != null) {
- if (cookies.length > 0) {
- sb.append("<cookies>");
-
- for (int i = 0; i < cookies.length; i++) {
- sb.append("<cookie>");
- sb.append("<comment>" + cookies[i].getComment() + "</comment>");
- sb.append("<domain>" + cookies[i].getDomain() + "</domain>");
- sb.append("<maxage>" + cookies[i].getMaxAge() + "</maxage>");
- sb.append("<name>" + cookies[i].getName() + "</name>");
- sb.append("<path>" + cookies[i].getPath() + "</path>");
- sb.append("<secure>" + cookies[i].getSecure() + "</secure>");
- sb.append("<value>" + cookies[i].getValue() + "</value>");
- sb.append("<version>" + cookies[i].getVersion() + "</version>");
- sb.append("</cookie>");
- }
-
- sb.append("</cookies>");
- } else {
- sb.append("<nocookies/>");
- }
- } else {
- sb.append("<nocookies/>");
- }
-
- return sb.toString();
- }
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/metadata/MetaDataTest.java b/trunk/src/impl/test/org/apache/lenya/cms/metadata/MetaDataTest.java
deleted file mode 100644
index e26e9b8..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/metadata/MetaDataTest.java
+++ /dev/null
@@ -1,188 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata;
-
-import java.util.Map;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.metadata.dublincore.DublinCore;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * Meta data test.
- */
-public class MetaDataTest extends AbstractAccessControlTest {
-
- /**
- * Tests the meta data.
- * @throws Exception
- */
- public void testMetaData() throws Exception {
-
- Publication publication = getPublication("test");
- Document doc = publication.getArea("authoring").getSite().getNode("/index").getLink("en").getDocument();
-
- String namespaceUri = "foobar";
- Exception e = null;
- try {
- doc.getMetaData(namespaceUri);
- } catch (Exception e1) {
- e = e1;
- }
- assertNotNull(e);
-
- namespaceUri = DublinCore.DC_NAMESPACE;
- MetaData dc = doc.getMetaData(namespaceUri);
-
- doc.getRepositoryNode().lock();
-
- checkSetTitle(dc);
- checkRemoveAllValues(dc);
-
- }
-
- protected void checkSetTitle(MetaData dc) throws MetaDataException {
- Exception e = null;
- try {
- dc.setValue("foo", "bar");
- } catch (Exception e1) {
- e = e1;
- }
- assertNotNull(e);
- dc.setValue("title", "This is the title");
-
- e = null;
- // addValue() should throw an exception because a value is already set
- try {
- dc.addValue("title", "bar");
- } catch (Exception e1) {
- e = e1;
- }
- assertNotNull(e);
-
- }
-
- String NAMESPACE = "http://apache.org/lenya/test/metadata";
-
- protected void checkOnCopy(Publication pub) throws Exception {
- MetaDataRegistry registry = null;
- try {
- registry = (MetaDataRegistry) getManager().lookup(MetaDataRegistry.ROLE);
- ElementSet set = new TestElementSet();
- registry.register(NAMESPACE, set);
- }
- finally {
- getManager().release(registry);
- }
-
- DocumentFactory factory = getFactory();
- Document source = factory.get(pub, Publication.AUTHORING_AREA, "/index", "en");
- Document target = factory.get(pub, Publication.AUTHORING_AREA, "/index", "en");
-
- MetaData sourceMeta = source.getMetaData(NAMESPACE);
- sourceMeta.setValue("copy", "sourceCopy");
- sourceMeta.setValue("ignore", "sourceIgnore");
- sourceMeta.setValue("delete", "sourceDelete");
-
- MetaData targetMeta = target.getMetaData(NAMESPACE);
- targetMeta.setValue("ignore", "targetIgnore");
- targetMeta.setValue("delete", "targetDelete");
-
- targetMeta.replaceBy(sourceMeta);
-
- assertTrue(targetMeta.getValues("copy").length == 1);
- assertEquals(sourceMeta.getValues("copy"), targetMeta.getValues("copy"));
-
- assertTrue(targetMeta.getValues("ignore").length == 1);
- assertEquals(targetMeta.getFirstValue("ignore"), "targetIgnore");
-
- assertTrue(targetMeta.getValues("delete").length == 0);
- }
-
- protected void checkRemoveAllValues(MetaData dc) throws MetaDataException {
- dc.removeAllValues("title");
- assertTrue(dc.getValues("title").length == 0);
- }
-
- protected class TestElement implements Element {
-
- private String name;
- private int actionOnCopy;
-
- protected TestElement(String name, int actionOnCopy) {
- this.name = name;
- this.actionOnCopy = actionOnCopy;
- }
-
- public int getActionOnCopy() {
- return actionOnCopy;
- }
-
- public String getDescription() {
- return "";
- }
-
- public String getName() {
- return name;
- }
-
- public boolean isEditable() {
- return false;
- }
-
- public boolean isMultiple() {
- return false;
- }
-
- }
-
- protected class TestElementSet implements ElementSet {
-
- private Element[] elements = { new TestElement("copy", Element.ONCOPY_COPY),
- new TestElement("ignore", Element.ONCOPY_IGNORE),
- new TestElement("delete", Element.ONCOPY_DELETE) };
-
- private Map name2element;
-
- protected TestElementSet() {
- for (int i = 0; i < elements.length; i++) {
- this.name2element.put(elements[i].getName(), elements[i]);
- }
- }
-
- public boolean containsElement(String name) {
- return true;
- }
-
- public Element getElement(String name) throws MetaDataException {
- return (Element) this.name2element.get(name);
- }
-
- public Element[] getElements() {
- return elements;
- }
-
- public String getNamespaceUri() {
- return NAMESPACE;
- }
-
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java b/trunk/src/impl/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java
deleted file mode 100644
index 3db9f45..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/publication/DefaultDocumentBuilderTest.java
+++ /dev/null
@@ -1,38 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-/**
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class DefaultDocumentBuilderTest extends DefaultDocumentTest {
-
- /**
- * @throws PublicationException
- * @see org.apache.lenya.cms.publication.DefaultDocumentTest#getDocument(DocumentTestSet)
- */
- protected Document getDocument(DocumentTestSet set) throws PublicationException {
- Publication pub = getPublication("test");
- return getFactory().getFromURL("/" + pub.getId() + "/" + set.getArea() + set.getUrl());
- }
-}
\ No newline at end of file
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java b/trunk/src/impl/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java
deleted file mode 100644
index cd025a9..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/publication/DefaultDocumentTest.java
+++ /dev/null
@@ -1,155 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-
-/**
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class DefaultDocumentTest extends AbstractAccessControlTest {
-
- protected static final DocumentTestSet[] testSets = {
- new DocumentTestSet("/index.html", "/index", Publication.AUTHORING_AREA, "en", "html"),
- new DocumentTestSet("/index_de.html", "/index", Publication.AUTHORING_AREA, "de",
- "html") };
-
- /**
- * Tests a document test set.
- * @param testSet The test set.
- * @throws PublicationException
- */
- protected void doDocumentTest(DocumentTestSet testSet) throws PublicationException {
- Document document = getDocument(testSet);
- getLogger().info("UUID: " + document.getUUID());
- getLogger().info("Area: " + document.getArea());
- getLogger().info("Language: " + document.getLanguage());
- getLogger().info("Document URL: " + document.getCanonicalDocumentURL());
- getLogger().info("Complete URL: " + document.getCanonicalWebappURL());
- getLogger().info("Extension: " + document.getExtension());
-
- Publication publication = getPublication("test");
- assertEquals(document.getPublication(), publication);
- assertEquals(document.getPath(), testSet.getPath());
- assertEquals(document.getArea(), testSet.getArea());
- assertEquals(document.getLanguage(), testSet.getLanguage());
- assertEquals(document.getCanonicalDocumentURL(), testSet.getUrl());
- assertEquals(document.getCanonicalWebappURL(), "/" + publication.getId() + "/"
- + document.getArea() + testSet.getUrl());
- assertEquals(document.getExtension(), testSet.getExtension());
-
- getLogger().info("-----------------------------------------------");
- }
-
- /**
- * Tests the default document.
- * @throws PublicationException
- */
- public void testDefaultDocument() throws PublicationException {
- for (int i = 0; i < testSets.length; i++) {
- doDocumentTest(testSets[i]);
- }
- }
-
- /**
- * Returns the test document for a given test set.
- * @param testSet A document test set.
- * @return A document.
- * @throws PublicationException
- */
- protected Document getDocument(DocumentTestSet testSet) throws PublicationException {
-
- Publication pub = getPublication("test");
- String uuid = pub.getArea(testSet.getArea()).getSite().getNode(testSet.getPath()).getUuid();
- DocumentIdentifier id = new DocumentIdentifier(pub.getId(), testSet.getArea(), uuid, testSet
- .getLanguage());
- DocumentImpl document = new DocumentImpl(getManager(), getFactory(), id, -1, getLogger());
- document.setExtension(testSet.getExtension());
-
- return document;
- }
-
- /**
- * Utility class to store test data for a document.
- */
- protected static class DocumentTestSet {
- private String url;
- private String path;
- private String extension;
- private String area;
- private String language;
-
- /**
- * Ctor.
- * @param _url The url.
- * @param _path The path.
- * @param _area The area.
- * @param _language The language.
- * @param _extension The extension.
- */
- public DocumentTestSet(String _url, String _path, String _area, String _language,
- String _extension) {
- this.url = _url;
- this.path = _path;
- this.area = _area;
- this.language = _language;
- this.extension = _extension;
- }
-
- /**
- * @return The area.
- */
- public String getArea() {
- return this.area;
- }
-
- /**
- * @return The extension.
- */
- public String getExtension() {
- return this.extension;
- }
-
- /**
- * @return The path.
- */
- public String getPath() {
- return this.path;
- }
-
- /**
- * @return The language.
- */
- public String getLanguage() {
- return this.language;
- }
-
- /**
- * @return The URL.
- */
- public String getUrl() {
- return this.url;
- }
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/publication/DocumentFactoryTest.java b/trunk/src/impl/test/org/apache/lenya/cms/publication/DocumentFactoryTest.java
deleted file mode 100644
index 5c8275f..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/publication/DocumentFactoryTest.java
+++ /dev/null
@@ -1,50 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * Document factory test.
- */
-public class DocumentFactoryTest extends AbstractAccessControlTest {
-
- /**
- * Tests the meta data.
- * @throws Exception
- */
- public void testDocumentFactory() throws Exception {
- Session session = RepositoryUtil.getSession(getManager(), getRequest());
- DocumentFactory factoryA = DocumentUtil.createDocumentFactory(getManager(), session);
-
- Publication publication = getPublication("test");
-
- Document docA1 = factoryA.get(publication, Publication.AUTHORING_AREA, "/index", "en");
- Document docA2 = factoryA.get(publication, Publication.AUTHORING_AREA, "/index", "en");
- assertSame(docA1, docA2);
-
- DocumentFactory factoryB = DocumentUtil.createDocumentFactory(getManager(), session);
-
- Document docB1 = factoryB.get(publication, Publication.AUTHORING_AREA, "/index", "en");
-
- assertSame(docA1, docB1);
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/publication/DocumentLocatorTest.java b/trunk/src/impl/test/org/apache/lenya/cms/publication/DocumentLocatorTest.java
deleted file mode 100644
index c98d536..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/publication/DocumentLocatorTest.java
+++ /dev/null
@@ -1,61 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import junit.framework.TestCase;
-
-/**
- *
- */
-public class DocumentLocatorTest extends TestCase {
-
- /**
- *
- */
- public void testDocumentLocator() {
-
- String pubId = "pub";
- String area = "area";
- String area2 = "area2";
- String languageDe = "de";
- String languageEn = "en";
-
- DocumentLocator root = DocumentLocator.getLocator(pubId, area, "", languageDe);
- DocumentLocator foo = DocumentLocator.getLocator(pubId, area, "/foo", languageDe);
- DocumentLocator fooBar = DocumentLocator.getLocator(pubId, area, "/foo/bar", languageDe);
- DocumentLocator fooBarBaz = DocumentLocator.getLocator(pubId, area, "/foo/bar/baz", languageDe);
-
- DocumentLocator fooEn = DocumentLocator.getLocator(pubId, area, "/foo", languageEn);
- DocumentLocator foo2 = DocumentLocator.getLocator(pubId, area2, "/foo", languageDe);
-
- assertEquals(foo.getParent(), root);
- assertEquals(fooBar.getParent(), foo);
- assertEquals(fooBarBaz.getParent(), fooBar);
-
- assertEquals(root.getDescendant("foo"), foo);
- assertEquals(foo.getDescendant("bar/baz"), fooBarBaz);
-
- assertEquals(foo.getChild("bar"), fooBar);
-
- assertEquals(foo.getLanguageVersion(languageEn), fooEn);
-
- assertEquals(foo.getAreaVersion(area2), foo2);
-
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/publication/DocumentManagerTest.java b/trunk/src/impl/test/org/apache/lenya/cms/publication/DocumentManagerTest.java
deleted file mode 100644
index c04a9d2..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/publication/DocumentManagerTest.java
+++ /dev/null
@@ -1,198 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.site.NodeSet;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteNode;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.site.SiteUtil;
-import org.apache.lenya.util.StringUtil;
-
-/**
- * Document manager test.
- */
-public class DocumentManagerTest extends AbstractAccessControlTest {
-
- /**
- * Do the test.
- * @throws Exception
- */
- public void testDocumentManager() throws Exception {
- DocumentManager docManager = null;
- try {
- docManager = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
- doTestMoveAll(docManager, "/doctypes", "/tutorial/doctypes");
- doTestMoveAll(docManager, "/tutorial/doctypes", "/doctypes");
- doTestCopyAll(docManager, "/doctypes", "/tutorial/doctypes");
-
- String areaName1 = "authoring";
- String areaName2 = "live";
- String path1 = "/tutorial";
- String path2 = "/doctypes";
-
- doTestCopyToArea(docManager, areaName1, areaName2, path1, path2);
-
- } finally {
- if (docManager != null) {
- getManager().release(docManager);
- }
- }
- }
-
- protected void doTestCopyToArea(DocumentManager docManager, String sourceAreaName,
- String destAreaName, String path1, String path2) throws PublicationException,
- SiteException {
-
- DocumentFactory factory = getFactory();
- Publication pub = factory.getPublication("test");
- SiteStructure sourceArea = pub.getArea(sourceAreaName).getSite();
- SiteStructure destArea = pub.getArea(destAreaName).getSite();
-
- if (destArea.contains(path1)) {
- destArea.getNode(path1).delete();
- }
- if (destArea.contains(path2)) {
- destArea.getNode(path2).delete();
- }
-
- assertFalse(destArea.contains(path1));
- assertFalse(destArea.contains(path2));
-
- // copy second node first to test correct ordering
- doTestCopyToArea(docManager, path2, sourceAreaName, destAreaName);
- doTestCopyToArea(docManager, path1, sourceAreaName, destAreaName);
-
- List sourceNodes = Arrays.asList(sourceArea.getNodes());
-
- SiteNode authoringNode1 = sourceArea.getNode(path1);
- assertTrue(sourceNodes.contains(authoringNode1));
- int sourcePos1 = sourceNodes.indexOf(authoringNode1);
-
- SiteNode sourceNode2 = sourceArea.getNode(path2);
- int sourcePos2 = sourceNodes.indexOf(sourceNode2);
-
- assertTrue(sourcePos1 < sourcePos2);
-
- assertTrue(destArea.contains(path1));
- List liveNodes = Arrays.asList(destArea.getNodes());
- SiteNode liveNode1 = destArea.getNode(path1);
- assertTrue(liveNodes.contains(liveNode1));
- int livePos1 = liveNodes.indexOf(liveNode1);
-
- SiteNode liveNode2 = destArea.getNode(path2);
- int livePos2 = liveNodes.indexOf(liveNode2);
-
- assertTrue(livePos1 < livePos2);
- }
-
- protected void doTestCopyToArea(DocumentManager docManager, String path, String areaName1,
- String areaName2) throws PublicationException {
- DocumentFactory factory = getFactory();
- Publication pub = factory.getPublication("test");
- Area area1 = pub.getArea(areaName1);
- Document doc = area1.getSite().getNode(path).getLink("en").getDocument();
- docManager.copyToArea(doc, areaName2);
- }
-
- protected void doTestCopyAll(DocumentManager docManager, String sourcePath, String targetPath)
- throws SiteException, DocumentException, PublicationException {
- DocumentFactory factory = getFactory();
- Publication pub = factory.getPublication("test");
- Area authoring = pub.getArea("authoring");
-
- SiteNode sourceNode = authoring.getSite().getNode(sourcePath);
-
- NodeSet nodes = SiteUtil.getSubSite(getManager(), sourceNode);
- Document[] docs = nodes.getDocuments();
- Map doc2path = new HashMap();
-
- String sourceBase = sourcePath.substring(0, sourcePath.lastIndexOf("/"));
- String targetBase = targetPath.substring(0, targetPath.lastIndexOf("/"));
-
- for (int i = 0; i < docs.length; i++) {
- doc2path.put(docs[i], docs[i].getPath().substring(sourceBase.length()));
- }
-
- docManager.copyAll(authoring, sourcePath, authoring, targetPath);
- for (int i = 0; i < docs.length; i++) {
- assertTrue(docs[i].hasLink());
- String oldPath = (String) doc2path.get(docs[i]);
- String newPath = targetBase + oldPath;
- assertTrue(authoring.getSite().contains(newPath));
- SiteNode newNode = authoring.getSite().getNode(newPath);
- Document newDoc = newNode.getLink(docs[i].getLanguage()).getDocument();
- assertEquals(newDoc.getContentLength(), docs[i].getContentLength());
- assertFalse(newDoc.getUUID().equals(docs[i].getUUID()));
- }
-
- String[] sourceNames = getChildNames(sourceNode);
- SiteNode targetNode = authoring.getSite().getNode(targetPath);
- String[] targetNames = getChildNames(targetNode);
- assertEquals(StringUtil.join(sourceNames, ","), StringUtil.join(targetNames, ","));
- }
-
- protected String[] getChildNames(SiteNode node) {
- SiteNode[] sourceChildren = node.getChildren();
- String[] names = new String[sourceChildren.length];
- for (int i = 0; i < names.length; i++) {
- names[i] = sourceChildren[i].getName();
- }
- return names;
- }
-
- protected void doTestMoveAll(DocumentManager docManager, String sourcePath, String targetPath)
- throws SiteException, DocumentException, PublicationException {
- DocumentFactory factory = getFactory();
- Publication pub = factory.getPublication("test");
- Area authoring = pub.getArea("authoring");
-
- SiteNode sourceNode = authoring.getSite().getNode(sourcePath);
- String[] sourceNames = getChildNames(sourceNode);
-
- NodeSet nodes = SiteUtil.getSubSite(getManager(), sourceNode);
- Document[] docs = nodes.getDocuments();
- Map doc2path = new HashMap();
-
- String sourceBase = sourcePath.substring(0, sourcePath.lastIndexOf("/"));
- String targetBase = targetPath.substring(0, targetPath.lastIndexOf("/"));
-
- for (int i = 0; i < docs.length; i++) {
- doc2path.put(docs[i], docs[i].getPath().substring(sourceBase.length()));
- }
-
- docManager.moveAll(authoring, sourcePath, authoring, targetPath);
- for (int i = 0; i < docs.length; i++) {
- assertTrue(docs[i].hasLink());
- String oldPath = (String) doc2path.get(docs[i]);
- String newPath = docs[i].getPath();
- assertEquals(targetBase + oldPath, newPath);
- }
-
- SiteNode targetNode = authoring.getSite().getNode(targetPath);
- String[] targetNames = getChildNames(targetNode);
- assertEquals(StringUtil.join(sourceNames, ","), StringUtil.join(targetNames, ","));
-
- }
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/publication/DublinCoreTest.java b/trunk/src/impl/test/org/apache/lenya/cms/publication/DublinCoreTest.java
deleted file mode 100644
index 30e1208..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/publication/DublinCoreTest.java
+++ /dev/null
@@ -1,81 +0,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.
- *
- */
-
-package org.apache.lenya.cms.publication;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.metadata.MetaDataException;
-import org.apache.lenya.cms.metadata.dublincore.DublinCore;
-import org.apache.lenya.cms.repository.RepositoryException;
-
-/**
- * Dublin Core test.
- *
- * @version $Id$
- */
-public class DublinCoreTest extends AbstractAccessControlTest {
-
- private static final String AREA = "authoring";
- private static final String PATH = "/tutorial";
- private static final String LANGUAGE = "de";
-
- /**
- * Test the fetching, modification and refetching of a dc core object.
- * @throws PublicationException
- * @throws MetaDataException
- * @throws RepositoryException
- * @throws AccessControlException
- * @throws RepositoryException
- */
- final public void testModifySaveAndReload() throws PublicationException, MetaDataException,
- AccessControlException, RepositoryException {
-
- login("lenya");
-
- Publication publication = getPublication("test");
-
- Document doc = publication.getArea(AREA).getSite().getNode(PATH).getLink(LANGUAGE).getDocument();
-
- doc.getRepositoryNode().lock();
-
- MetaData dcCore = doc.getMetaData(DublinCore.DC_NAMESPACE);
- String title = dcCore.getFirstValue(DublinCore.ELEMENT_TITLE);
- String subject = dcCore.getFirstValue(DublinCore.ELEMENT_SUBJECT);
- String creator = dcCore.getFirstValue(DublinCore.ELEMENT_CREATOR);
-
- if (creator == null) {
- creator = "test";
- }
-
- String newCreator = creator + "-test";
- dcCore.setValue(DublinCore.ELEMENT_CREATOR, newCreator);
-
- Document doc2 = publication.getArea(AREA).getSite().getNode(PATH).getLink(LANGUAGE).getDocument();
-
- MetaData dcCore2 = doc2.getMetaData(DublinCore.DC_NAMESPACE);
- assertEquals(title, dcCore2.getFirstValue(DublinCore.ELEMENT_TITLE));
- assertEquals(subject, dcCore2.getFirstValue(DublinCore.ELEMENT_SUBJECT));
- assertFalse(creator.equals(dcCore2.getFirstValue(DublinCore.ELEMENT_CREATOR)));
- assertEquals(newCreator, dcCore2.getFirstValue(DublinCore.ELEMENT_CREATOR));
-
- doc.getRepositoryNode().unlock();
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/publication/PublicationTest.java b/trunk/src/impl/test/org/apache/lenya/cms/publication/PublicationTest.java
deleted file mode 100644
index cc8a28e..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/publication/PublicationTest.java
+++ /dev/null
@@ -1,95 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-
-/**
- * Publication test.
- */
-public class PublicationTest extends AbstractAccessControlTest {
-
- /**
- * Tests the publication functionality.
- * @throws Exception
- */
- public void testPublication() throws Exception {
-
- PublicationManager pubMgr = null;
- try {
- pubMgr = (PublicationManager) getManager().lookup(PublicationManager.ROLE);
-
- Publication[] pubs = pubMgr.getPublications(getFactory());
- for (int i = 0; i < pubs.length; i++) {
- doTestPublication(pubs[i]);
- }
-
- } finally {
- if (pubMgr != null) {
- getManager().release(pubMgr);
- }
- }
-
- }
-
- protected void doTestPublication(Publication pub) throws PublicationException {
- String contentDirPath = pub.getContentDir();
- assertNotNull(contentDirPath);
-
- File contentDir = new File(contentDirPath);
-
- assertTrue(pub.exists());
-
- String[] areaNames = pub.getAreaNames();
- for (int i = 0; i < areaNames.length; i++) {
- Area area = pub.getArea(areaNames[i]);
- if (area.getDocuments().length > 0) {
- File areaContentDir = pub.getContentDirectory(areaNames[i]);
- assertTrue(areaContentDir.isDirectory());
- assertEquals(new File(contentDir, areaNames[i]), areaContentDir);
- }
- }
-
- String[] languages = pub.getLanguages();
- assertTrue(languages.length > 0);
-
- assertNotNull(pub.getDefaultLanguage());
- assertTrue(Arrays.asList(languages).contains(pub.getDefaultLanguage()));
-
- String[] types = pub.getResourceTypeNames();
- assertTrue(types.length > 0);
-
- Set typeSet = new HashSet(Arrays.asList(types));
-
- String[] templateIds = pub.getTemplateIds();
- for (int i = 0; i < templateIds.length; i++) {
- Publication template = pub.getFactory().getPublication(templateIds[i]);
- String[] templateTypes = template.getResourceTypeNames();
- for (int t = 0; t < templateTypes.length; t++) {
- assertTrue(typeSet.contains(templateTypes[i]));
- }
- }
-
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/publication/TestPageEnvelope.java b/trunk/src/impl/test/org/apache/lenya/cms/publication/TestPageEnvelope.java
deleted file mode 100644
index effd9d6..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/publication/TestPageEnvelope.java
+++ /dev/null
@@ -1,52 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class TestPageEnvelope extends PageEnvelope {
- /**
- * Constructs a test page envelope.
- * @param publication The publication.
- * @param url The document url (starting with a slash).
- * @throws PageEnvelopeException when something goes wrong.
- */
- public TestPageEnvelope(Publication publication, String url, ServiceManager manager,
- Logger logger) throws PageEnvelopeException {
- super();
- setContext("");
-
- try {
- Session session = RepositoryUtil.createSession(manager, null, false);
- DocumentFactory map = DocumentUtil.createDocumentFactory(manager, session);
- setDocument(map.getFromURL(url));
- } catch (Exception e) {
- throw new PageEnvelopeException(e);
- }
- }
-}
\ No newline at end of file
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java b/trunk/src/impl/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java
deleted file mode 100644
index e6addee..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/publication/file/FilePublicationTest.java
+++ /dev/null
@@ -1,129 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication.file;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.site.SiteException;
-
-/**
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class FilePublicationTest extends AbstractAccessControlTest {
-
- /**
- * <code>sourceDocumentId</code> The source document id
- */
- public static final String sourceDocumentId = "/tutorial";
- /**
- * <code>destinationDocumentId</code> The destination document id
- */
- public static final String destinationDocumentId = "/doctypes/simple-document";
- /**
- * <code>sourceLanguage</code> The source language
- */
- public static final String sourceLanguage = "en";
- /**
- * <code>destinationLanguage</code> The destination language
- */
- public static final String destinationLanguage = "en";
-
- /**
- * Tests copying a document.
- * @throws PublicationException when something went wrong.
- * @throws DocumentException
- * @throws SiteException
- */
- public void testCopyDocument() throws PublicationException, DocumentException, SiteException {
- testCopyDocument(Publication.AUTHORING_AREA,
- sourceDocumentId,
- sourceLanguage,
- Publication.AUTHORING_AREA,
- destinationDocumentId,
- destinationLanguage);
- testCopyDocument(Publication.AUTHORING_AREA,
- sourceDocumentId,
- sourceLanguage,
- Publication.LIVE_AREA,
- sourceDocumentId,
- sourceLanguage);
- }
-
- /**
- * Tests copying a document.
- * @param sourceArea The source area.
- * @param _sourceDocumentId The source document ID.
- * @param _sourceLanguage The source language.
- * @param destinationArea The destination area.
- * @param _destinationDocumentId The destination document ID.
- * @param _destinationLanguage The destination language.
- * @throws PublicationException when something went wrong.
- * @throws DocumentException
- * @throws SiteException
- */
- public void testCopyDocument(String sourceArea, String _sourceDocumentId,
- String _sourceLanguage, String destinationArea, String _destinationDocumentId,
- String _destinationLanguage) throws PublicationException, DocumentException,
- SiteException {
-
- getLogger().info("Copy document");
- getLogger().info(" Source area: [" + sourceArea + "]");
- getLogger().info(" Source document ID: [" + _sourceDocumentId + "]");
- getLogger().info(" Source language: [" + _sourceLanguage + "]");
- getLogger().info(" Destination area: [" + destinationArea + "]");
- getLogger().info(" Destination document ID: [" + _destinationDocumentId + "]");
- getLogger().info(" Destination language: [" + _destinationLanguage + "]");
-
- Publication publication = getPublication("test");
- DocumentFactory map = getFactory();
-
- Document sourceDocument = map.get(publication,
- sourceArea,
- _sourceDocumentId,
- _sourceLanguage);
- Document destinationDocument = map.get(publication,
- destinationArea,
- _destinationDocumentId,
- _destinationLanguage);
-/*
- publication.copyDocument(sourceDocument, destinationDocument);
-
- assertTrue(destinationDocument.exists());
-
- TreeSiteManager manager = (TreeSiteManager) publication.getSiteManager(map);
- SiteTree destinationTree = manager.getTree(destinationArea);
- SiteTreeNode destinationNode = destinationTree.getNode(_destinationDocumentId);
- assertNotNull(destinationNode);
- Label destinationLabel = destinationNode.getLabel(_destinationLanguage);
- assertNotNull(destinationLabel);
-
- SiteTreeNode sourceNode = destinationTree.getNode(_sourceDocumentId);
- Label sourceLabel = sourceNode.getLabel(_sourceLanguage);
-
- assertTrue(destinationLabel.getLabel().equals(sourceLabel.getLabel()));
-*/
- }
-}
\ No newline at end of file
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/rc/RCMLTest.java b/trunk/src/impl/test/org/apache/lenya/cms/rc/RCMLTest.java
deleted file mode 100644
index 0a9674a..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/rc/RCMLTest.java
+++ /dev/null
@@ -1,108 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.rc;
-
-import java.io.PrintWriter;
-
-import org.w3c.dom.Document;
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.xml.DocumentHelper;
-
-/**
- * RCML Test
- */
-public class RCMLTest extends AbstractAccessControlTest {
-
- /**
- * <code>co</code> Checkout
- */
- public static final short co = 0;
- /**
- * <code>ci</code> Checkin
- */
- public static final short ci = 1;
-
- private Document document = null;
-
- /**
- * Constructor.
- * @param test The test to execute.
- */
- public RCMLTest() {
- super();
- }
-
- public void testRCML() {
- String[] args = { "", "", "" };
- testRCML(args);
- }
-
- public void testRCML(String[] args) {
-
- if (args.length != 1) {
- System.out.println("Usage: java RCML rcmlDirectory datafilename rootDirectory");
-
- return;
- }
-
- try {
- org.apache.lenya.cms.publication.Document doc = null;
- doc.getRepositoryNode().checkout();
-
- (new PrintWriter(System.out)).print(this.document);
-
- System.out.println("\n");
-
- if (doc.getRepositoryNode().isCheckedOut()) {
- System.out.println("Checked out");
- } else {
- System.out.println("Not checked out");
- }
- } catch (Exception e) {
- System.out.println(e);
- }
- }
-
-/* protected static final Class[] classes = {
- };
-
- /**
- * Creates a test suite.
- * @return a test suite.
- */
-/* public static Test getSuite() {
- TestSuite suite = new TestSuite();
-
- for (int i = 0; i < classes.length; i++) {
- suite.addTestSuite(classes[i]);
- }
-
- return suite;
- }
-*/
- /** @see junit.framework.TestCase#setUp() */
- protected void setUp() throws Exception {
- /**
- * initialise the RCML-document. Delete all entries
- */
- this.document = DocumentHelper.createDocument(null, "XPSRevisionControl", null);
- }
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/rc/RevisionControllerTest.java b/trunk/src/impl/test/org/apache/lenya/cms/rc/RevisionControllerTest.java
deleted file mode 100644
index c0acd9d..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/rc/RevisionControllerTest.java
+++ /dev/null
@@ -1,84 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.rc;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.repository.RepositoryException;
-
-/**
- * Revision Controller test
- */
-public class RevisionControllerTest extends AbstractAccessControlTest {
-
- /**
- * @see <a
- * href="http://issues.apache.org/bugzilla/show_bug.cgi?id=41005">Bug
- * 41005</a>
- * @throws Exception
- */
- public void testCheckIn() throws Exception {
- login("lenya");
-
- DocumentManager docMgr = null;
- try {
- docMgr = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
- Document source = getPublication("test").getArea("authoring").getSite().getNode(
- "/links").getLink("en").getDocument();
- Document target = docMgr.addVersion(source, "authoring", "es");
- target.delete();
- } finally {
- if (docMgr != null) {
- getManager().release(docMgr);
- }
- }
-
- getFactory().getSession().commit();
- }
-
- public void testRevisionController() throws RepositoryException, RevisionControlException {
-
- String[] args = { "", "", "", "" };
-
- // TestRunner.run(getSuite());
-
- if (args.length != 4) {
- System.out
- .println("Usage: "
- + RevisionControllerTest.class.getName()
- + " username(user who checkout) source(filename without the rootDirectory of the document to checkout) username(user who checkin) destination(filename without the rootDirectory of document to checkin)");
-
- return;
- }
-
- Document doc1 = null;
- Document doc2 = null;
-
- String identityS = args[0];
- String source = args[1];
- String identityD = args[2];
- String destination = args[3];
- //doc1.getRepositoryNode().checkout();
- //doc2.getRepositoryNode().checkin();
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/site/SimpleSiteManagerTest.java b/trunk/src/impl/test/org/apache/lenya/cms/site/SimpleSiteManagerTest.java
deleted file mode 100644
index 9fe93c7..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/site/SimpleSiteManagerTest.java
+++ /dev/null
@@ -1,165 +0,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.
- *
- */
-package org.apache.lenya.cms.site;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.ResourceType;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.cms.site.Link;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteManager;
-import org.apache.lenya.cms.site.SiteNode;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.site.simple.DocumentStore;
-
-public class SimpleSiteManagerTest extends AbstractAccessControlTest {
-
- protected static final String PATH = "/foo/bar";
-
- protected static final String PARENT_PATH = "/foo";
-
- public void testSimpleSiteManager() throws Exception {
-
- Session session = login("lenya");
-
- DocumentFactory factory = DocumentUtil.createDocumentFactory(getManager(), session);
- Publication[] pubs = factory.getPublications();
-
- for (int i = 0; i < pubs.length; i++) {
- checkPublication(session, factory, pubs[i]);
- }
- }
-
- protected void checkPublication(Session session, DocumentFactory factory, Publication pub)
- throws ServiceException, SiteException, DocumentBuildException, PublicationException,
- RepositoryException {
- DocumentManager docManager = null;
- ServiceSelector selector = null;
- SiteManager siteManager = null;
- ServiceSelector resourceTypeSelector = null;
-
- try {
- selector = (ServiceSelector) getManager().lookup(SiteManager.ROLE + "Selector");
- siteManager = (SiteManager) selector.select(pub.getSiteManagerHint());
- SiteStructure structure = siteManager.getSiteStructure(factory, pub,
- Publication.AUTHORING_AREA);
-
- docManager = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
-
- resourceTypeSelector = (ServiceSelector) getManager().lookup(
- ResourceType.ROLE + "Selector");
- ResourceType type = (ResourceType) resourceTypeSelector.select("entry");
- String contentSourceUri = "context://sitemap.xmap";
-
- Document doc = docManager.add(factory, type, contentSourceUri, pub,
- Publication.AUTHORING_AREA, "en", "xml");
-
- structure.add(PATH, doc);
- assertTrue(structure.contains(PATH));
- Document linkDoc = structure.getNode(PATH).getLink("en").getDocument();
- assertSame(linkDoc, doc);
-
- if (!(structure instanceof DocumentStore)) {
- Link link = doc.getLink();
- checkSetLabel(link);
- }
-
- SiteNode[] nodes = structure.getNodes();
- assertTrue(nodes.length > 0);
-
- for (int i = 0; i < nodes.length; i++) {
-
- assertTrue(structure.contains(nodes[i].getPath()));
-
- SiteNode node = structure.getNode(nodes[i].getPath());
- assertNotNull(node);
- assertEquals(nodes[i], node);
-
- checkLinks(siteManager, node);
- }
-
- doc.getLink().delete();
- assertFalse(structure.containsByUuid(doc.getUUID(), doc.getLanguage()));
- assertFalse(structure.contains(PATH));
- assertFalse(structure.contains(PARENT_PATH));
-
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- getManager().release(selector);
- }
- if (docManager != null) {
- getManager().release(docManager);
- }
- if (resourceTypeSelector != null) {
- getManager().release(resourceTypeSelector);
- }
- }
- // session.commit();
- }
-
- protected void checkSetLabel(Link link) {
- String newLabel = "New Label";
- String oldLabel = link.getLabel();
- assertFalse(oldLabel.equals(newLabel));
- link.setLabel(newLabel);
- assertTrue(link.getLabel().equals(newLabel));
- link.setLabel(oldLabel);
- }
-
- protected void checkLinks(SiteManager siteManager, SiteNode node) throws SiteException {
- String[] languages = node.getLanguages();
- for (int i = 0; i < languages.length; i++) {
- Link link = node.getLink(languages[i]);
- assertEquals(link.getLanguage(), languages[i]);
- assertNotNull(link.getLabel());
-
- if (node.getUuid() != null) {
- Document doc = link.getDocument();
- assertNotNull(doc);
-
- String docUuid = doc.getUUID();
- String nodeUuid = node.getUuid();
-
- assertNotNull(doc.getUUID());
- assertEquals(docUuid, nodeUuid);
- assertEquals(doc.getLanguage(), link.getLanguage());
-
- // it may not be allowed to insert the doc twice
- try {
- siteManager.add("/sidebar", doc);
- assertTrue("No exception thrown", false);
- } catch (Exception expected) {
- }
- }
- }
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/site/usecases/LinkRewriterTest.java b/trunk/src/impl/test/org/apache/lenya/cms/site/usecases/LinkRewriterTest.java
deleted file mode 100644
index 0ca168c..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/site/usecases/LinkRewriterTest.java
+++ /dev/null
@@ -1,113 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.cocoon.source.SourceUtil;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.site.SiteUtil;
-import org.apache.lenya.xml.DocumentHelper;
-import org.apache.xpath.XPathAPI;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NodeList;
-
-/**
- * Link rewriter test.
- */
-public class LinkRewriterTest extends AbstractAccessControlTest {
-
- protected static final String DOCUMENT_ID = "/index";
- protected static final String SOURCE_DOCUMENT_ID = "/concepts";
- protected static final String TARGET_DOCUMENT_ID = "/copied";
-
- /**
- * Test method.
- * @throws Exception
- */
- public void testLinkRewriter() throws Exception {
-/*
- Publication pub = PublicationUtil.getPublication(getManager(), "test");
-
- Document document = getIdentityMap().get(pub, Publication.AUTHORING_AREA, DOCUMENT_ID, "en");
- org.w3c.dom.Document xml = DocumentHelper.readDocument(getClass().getResourceAsStream("index_en.xml"));
- document.getRepositoryNode().lock();
- SourceUtil.writeDOM(xml, document.getSourceURI(), getManager());
-
- LinkRewriter rewriter = null;
- DocumentManager docManager = null;
- Document target = null;
- try {
- docManager = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
-
- Document source = getIdentityMap().get(pub,
- Publication.AUTHORING_AREA,
- SOURCE_DOCUMENT_ID,
- "en");
- source.getRepositoryNode().lock();
-
- DocumentLocator targetLoc = DocumentLocator.getLocator(pub.getId(),
- Publication.AUTHORING_AREA,
- TARGET_DOCUMENT_ID,
- "en");
-
- SiteUtil.getSiteStructure(getManager(),
- source.getFactory(),
- source.getPublication(),
- source.getArea()).getRepositoryNode().lock();
-
- docManager.move(source, targetLoc);
- target = source.getFactory().get(targetLoc);
-
- rewriter = (LinkRewriter) getManager().lookup(LinkRewriter.ROLE);
- rewriter.rewriteLinks(source, target);
-
- } finally {
- if (docManager != null) {
- getManager().release(docManager);
- }
- if (rewriter != null) {
- getManager().release(rewriter);
- }
- }
-
- String[] xPaths = document.getResourceType().getLinkAttributeXPaths();
- assertTrue(xPaths.length > 0);
-
- org.w3c.dom.Document xmlDoc = SourceUtil.readDOM(document.getSourceURI(), getManager());
- boolean matched = false;
-
- for (int i = 0; i < xPaths.length; i++) {
- NodeList nodes = XPathAPI.selectNodeList(xmlDoc, xPaths[i]);
- for (int nodeIndex = 0; nodeIndex < nodes.getLength(); nodeIndex++) {
- Attr attribute = (Attr) nodes.item(nodeIndex);
- String targetUrl = attribute.getValue();
- Document targetDoc = getIdentityMap().getFromURL(targetUrl);
- if (targetDoc.equals(target)) {
- matched = true;
- }
- }
- }
- assertTrue(matched);
- */
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/site/usecases/index_en.xml b/trunk/src/impl/test/org/apache/lenya/cms/site/usecases/index_en.xml
deleted file mode 100644
index 960ea40..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/site/usecases/index_en.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html xmlns="http://www.w3.org/1999/xhtml"
-xmlns:xhtml="http://www.w3.org/1999/xhtml"
-xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/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.
--->
-
-<!-- $Id: index_en.xml 169299 2005-05-09 12:00:43Z jwkaltz $ -->
- <head>
- <title>Welcome to the Default publication</title>
- </head>
- <body>
- <h1>Hello and welcome to the Lenya default publication!</h1>
-
- <p>Apache Lenya is a Java Open-Source Content Management System
- based on open standards such as XML and XSLT and the Apache
- Software Stack, in particular the XML publishing framework Apache
- Cocoon.</p>
-
- <p>For an overview of the concepts and the terminology used in
- Apache Lenya please see the <a href="/test/authoring/concepts.html">Concepts
- section</a>. To see what you can do with Apache Lenya please
- refer to the <a href="/test/authoring/features.html">Features
- section</a>.</p>
-
- <p>If you'd like to get a quick introduction on how to use Apache
- Lenya CMS please go through the <a
- href="/test/authoring/tutorial.html">tutorial</a>.</p>
-
- <p>The purpose of this publication is</p>
-
- <ul>
- <li>to show beginners the basic functionality of the Apache
- Lenya CMS,</li>
-
- <li>to provide an "out of the box" publication that can be
- easily adapted and used,</li>
-
- <li>and to provide a basis for reference implementations of new
- concepts and best practices.</li>
-
- </ul>
-
- <p>This publication does not go to the limit of what's possible
- with Apache Lenya CMS, there are no fancy bells and whistles to
- confuse you, this publication simply contains everything you need
- to get started.</p>
- </body>
-</html>
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java b/trunk/src/impl/test/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java
deleted file mode 100644
index 2e68e3c..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java
+++ /dev/null
@@ -1,97 +0,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.
- *
- */
-package org.apache.lenya.cms.usecase;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.cms.usecase.impl.TestUsecaseInvoker;
-
-/**
- * Usecase test base class.
- */
-public abstract class AbstractUsecaseTest extends AbstractAccessControlTest {
-
- /**
- * The test.
- * @throws Exception
- */
- public void testUsecase() throws Exception {
-
- Session session = getSession();
- prepareUsecase();
-
- UsecaseInvoker invoker = null;
- try {
- invoker = (UsecaseInvoker) getManager().lookup(TestUsecaseInvoker.ROLE);
- invoker.setTestSession(session);
- invoker.invoke(getRequest().getPathInfo(), getUsecaseName(), getParameters());
-
- this.targetUrl = invoker.getTargetUrl();
-
- List errorMessages = invoker.getErrorMessages();
- for (Iterator i = errorMessages.iterator(); i.hasNext();) {
- UsecaseMessage message = (UsecaseMessage) i.next();
- String m = message.getMessage();
- String[] params = message.getParameters();
- if (params != null) {
- for (int j = 0; j < params.length; j++) {
- m += " [" + params[j] + "]";
- }
- }
- getLogger().error("Usecase error: " + m);
- }
-
- assertEquals(invoker.getResult(), UsecaseInvoker.SUCCESS);
- assertEquals(invoker.getErrorMessages().size(), 0);
- } finally {
- if (invoker != null) {
- getManager().release(invoker);
- }
- }
-
- checkPostconditions();
-
- }
-
- private String targetUrl;
-
- protected String getTargetUrl() {
- if (this.targetUrl == null) {
- throw new IllegalStateException("The usecase has not yet been executed.");
- }
- return this.targetUrl;
- }
-
- protected void prepareUsecase() throws Exception {
- }
-
- protected Map getParameters() {
- return new HashMap();
- }
-
- protected abstract String getUsecaseName();
-
- protected void checkPostconditions() throws Exception {
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/cms/workflow/WorkflowTest.java b/trunk/src/impl/test/org/apache/lenya/cms/workflow/WorkflowTest.java
deleted file mode 100644
index 5c861a7..0000000
--- a/trunk/src/impl/test/org/apache/lenya/cms/workflow/WorkflowTest.java
+++ /dev/null
@@ -1,170 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.workflow;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.workflow.Version;
-import org.apache.lenya.workflow.WorkflowException;
-import org.apache.lenya.workflow.Workflowable;
-
-/**
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class WorkflowTest extends AbstractAccessControlTest {
-
- private static final String variableName = "is_live";
- protected static final String URL = "/authoring/index.html";
-
- protected String getWebappUrl() {
- return "/test" + URL;
- }
-
- /**
- * Tests the workflow.
- * @throws Exception when something went wrong.
- */
- public void testWorkflow() throws Exception {
- Publication publication = getPublication("test");
- String url = "/" + publication.getId() + URL;
- DocumentFactory map = getFactory();
- Document document = map.getFromURL(url);
-
- document.getRepositoryNode().lock();
-
- Session session = getSession(submitSituation);
- Workflowable workflowable = WorkflowUtil.getWorkflowable(getManager(),
- session,
- getLogger(),
- document);
- if (workflowable.getVersions().length > 0) {
- Version version = workflowable.getLatestVersion();
- if (version.getValue(variableName) == true) {
- invoke(document, deactivateSituation);
- } else if (version.getState().equals("review")) {
- invoke(document, rejectSituation);
- }
- }
-
- for (int situationIndex = 0; situationIndex < situations.length; situationIndex++) {
- TestSituation situation = situations[situationIndex];
- invoke(document, situation);
- }
-
- document.getRepositoryNode().unlock();
-
- getLogger().info("Test completed.");
- }
-
- protected void invoke(Document document, TestSituation situation)
- throws AccessControlException, RepositoryException, WorkflowException {
- Session session = getSession(situation);
- Workflowable instance = new DocumentWorkflowable(getManager(),
- session,
- document,
- getLogger());
- assertNotNull(instance);
-
- String event = situation.getEvent();
-
- getLogger().info("Event: " + event);
-
- WorkflowUtil.invoke(getManager(), session, getLogger(), document, event);
-
- boolean value = instance.getLatestVersion().getValue(variableName);
-
- getLogger().info("Variable: " + variableName + " = " + value);
- getLogger().info("------------------------------------------------------");
-
- assertEquals(value, situation.getValue());
- }
-
- protected Session getSession(TestSituation situation) throws AccessControlException,
- RepositoryException {
- Session session = login(situation.getUser());
- getLogger().info("User: [" + session.getIdentity().getUser() + "]");
- return session;
- }
-
- private static final TestSituation submitSituation = new TestSituation("lenya", "submit", false);
- private static final TestSituation rejectSituation = new TestSituation("alice", "reject", false);
- private static final TestSituation deactivateSituation = new TestSituation("alice",
- "deactivate",
- false);
- private static final TestSituation publishSituation = new TestSituation("alice",
- "publish",
- true);
-
- private static final TestSituation[] situations = { submitSituation, rejectSituation,
- submitSituation, publishSituation, deactivateSituation };
-
- /**
- * A test situation.
- */
- public static class TestSituation {
- private String user;
- private String event;
- private boolean value;
-
- /**
- * Creates a new test situation.
- * @param _user The user.
- * @param _event The event.
- * @param _value The variable value.
- */
- public TestSituation(String _user, String _event, boolean _value) {
- this.user = _user;
- this.event = _event;
- this.value = _value;
- }
-
- /**
- * Returns the event.
- * @return An event.
- */
- public String getEvent() {
- return this.event;
- }
-
- /**
- * Returns the user.
- * @return A string.
- */
- public String getUser() {
- return this.user;
- }
-
- /**
- * Returns the value.
- * @return A value.
- */
- public boolean getValue() {
- return this.value;
- }
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/impl/test/org/apache/lenya/net/InetAddressUtilTest.java b/trunk/src/impl/test/org/apache/lenya/net/InetAddressUtilTest.java
deleted file mode 100644
index 5aec774..0000000
--- a/trunk/src/impl/test/org/apache/lenya/net/InetAddressUtilTest.java
+++ /dev/null
@@ -1,45 +0,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.
- */
-package org.apache.lenya.net;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import org.apache.cocoon.core.container.ContainerTestCase;
-
-/**
- * Inet address util test
- */
-public class InetAddressUtilTest extends ContainerTestCase {
-
- public void testInetAddressUtil() throws UnknownHostException {
-
- String[] args = { "195.226.6.64", "255.255.255.0", "195.226.6.70" };
-
- if (args.length != 3) {
- System.out.println("Usage: InetAddressUtilTest network subnet ip");
- return;
- }
-
- InetAddress network = InetAddress.getByName(args[0]); // "195.226.6.64");
- InetAddress subnet = InetAddress.getByName(args[1]); // "255.255.255.0");
- InetAddress ip = InetAddress.getByName(args[2]); // "195.226.6.70");
-
- InetAddressUtil util = new InetAddressUtil(getLogger());
- System.out.println(util.contains(network, subnet, ip));
- }
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/transaction/MockFactory.java b/trunk/src/impl/test/org/apache/lenya/transaction/MockFactory.java
deleted file mode 100644
index 715f20f..0000000
--- a/trunk/src/impl/test/org/apache/lenya/transaction/MockFactory.java
+++ /dev/null
@@ -1,36 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-public class MockFactory implements IdentifiableFactory {
-
- private UnitOfWork unit;
-
- public MockFactory(UnitOfWork unit) {
- this.unit = unit;
- }
-
- public Object build(IdentityMap map, String key) throws Exception {
- return new MockTransactionable(key, this.unit);
- }
-
- public String getType() {
- return "mock";
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/transaction/MockRevisionController.java b/trunk/src/impl/test/org/apache/lenya/transaction/MockRevisionController.java
deleted file mode 100644
index c398922..0000000
--- a/trunk/src/impl/test/org/apache/lenya/transaction/MockRevisionController.java
+++ /dev/null
@@ -1,73 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class MockRevisionController {
-
- private static Map histories = new HashMap();
-
- public static History getHistory(MockTransactionable transactionable) {
- History history = (History) histories.get(transactionable.getId());
- if (history == null) {
- history = new History();
- histories.put(transactionable.getId(), history);
- }
- return history;
- }
-
- public static class History {
-
- public History() {
- }
-
- private int version = 0;
- private boolean checkedOut = false;
- private String checkOutUser = null;
-
- public void newVersion() {
- this.version++;
- }
-
- public int getLatestVersion() {
- return this.version;
- }
-
- public boolean isCheckedOut() {
- return this.checkedOut;
- }
-
- public void checkOut(String user) {
- this.checkedOut = true;
- this.checkOutUser = user;
- }
-
- public void checkIn() {
- this.checkedOut = false;
- this.checkOutUser = null;
- }
-
- public String getCheckOutUser() {
- return this.checkOutUser;
- }
-
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/transaction/MockTransactionable.java b/trunk/src/impl/test/org/apache/lenya/transaction/MockTransactionable.java
deleted file mode 100644
index 1e740a4..0000000
--- a/trunk/src/impl/test/org/apache/lenya/transaction/MockTransactionable.java
+++ /dev/null
@@ -1,111 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-import org.apache.lenya.cms.repository.RepositoryException;
-
-public class MockTransactionable implements Transactionable {
-
- private String id;
-
- public MockTransactionable(String id, UnitOfWork unit) {
- this.id = id;
- this.unit = unit;
- }
-
- public void write() {
- MockRevisionController.getHistory(this).newVersion();
- }
-
- public void changed() {
- }
-
- public void createTransactionable() throws TransactionException {
- }
-
- public void deleteTransactionable() throws TransactionException {
- }
-
- public void removed() {
- }
-
- public void saveTransactionable() throws TransactionException {
- }
-
- public void checkin() throws TransactionException {
- MockRevisionController.getHistory(this).checkIn();
- }
-
- public void checkout() throws TransactionException {
- MockRevisionController.getHistory(this).checkOut(getUserId());
- }
-
- public boolean hasChanged() throws TransactionException {
- try {
- int currentVersion = getLatestVersion();
- int lockVersion = getLock().getVersion();
- return currentVersion > lockVersion;
- } catch (Exception e) {
- throw new RepositoryException(e);
- }
- }
-
- protected int getLatestVersion() {
- int currentVersion = MockRevisionController.getHistory(this).getLatestVersion();
- return currentVersion;
- }
-
- public boolean isCheckedOut() throws TransactionException {
- return MockRevisionController.getHistory(this).isCheckedOut();
- }
-
- public boolean isCheckedOutBySession() throws TransactionException {
- String user = MockRevisionController.getHistory(this).getCheckOutUser();
- return user != null && user.equals(getUserId());
- }
-
- private String getUserId() {
- return ((UnitOfWorkImpl) this.unit).getIdentity().getUser().getId();
- }
-
- private Lock lock;
-
- public Lock getLock() {
- return this.lock;
- }
-
- public boolean isLocked() throws TransactionException {
- return this.lock != null;
- }
-
- private UnitOfWork unit;
-
- public void lock() throws TransactionException {
- this.lock = unit.createLock(this, getLatestVersion());
- }
-
- public void unlock() throws TransactionException {
- this.lock = null;
- unit.removeLock(this);
- }
-
- public String getId() {
- return this.id;
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/transaction/MockUser.java b/trunk/src/impl/test/org/apache/lenya/transaction/MockUser.java
deleted file mode 100644
index f60cd9a..0000000
--- a/trunk/src/impl/test/org/apache/lenya/transaction/MockUser.java
+++ /dev/null
@@ -1,169 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-import java.io.File;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.User;
-
-public class MockUser implements User {
-
- private String id;
-
- public MockUser(String id) {
- this.id = id;
- }
-
- public boolean authenticate(String password) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void delete() throws AccessControlException {
- // TODO Auto-generated method stub
-
- }
-
- public String getDefaultDocumentLocale() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getDefaultMenuLocale() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getEmail() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void save() throws AccessControlException {
- // TODO Auto-generated method stub
-
- }
-
- public void setDefaultDocumentLocale(String documentLocale) {
- // TODO Auto-generated method stub
-
- }
-
- public void setDefaultMenuLocale(String menuLocale) {
- // TODO Auto-generated method stub
-
- }
-
- public void setEmail(String email) {
- // TODO Auto-generated method stub
-
- }
-
- public void setPassword(String plainTextPassword) {
- // TODO Auto-generated method stub
-
- }
-
- public Accreditable[] getAccreditables() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void configure(Configuration configuration) throws ConfigurationException {
- // TODO Auto-generated method stub
-
- }
-
- public String getDescription() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getId() {
- return this.id;
- }
-
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setConfigurationDirectory(File configurationDirectory) {
- // TODO Auto-generated method stub
-
- }
-
- public void setDescription(String description) {
- // TODO Auto-generated method stub
-
- }
-
- public void setName(String name) {
- // TODO Auto-generated method stub
-
- }
-
- public void enableLogging(Logger arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void addedToGroup(Group group) {
- // TODO Auto-generated method stub
-
- }
-
- public Group[] getGroups() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void removeFromAllGroups() {
- // TODO Auto-generated method stub
-
- }
-
- public void removedFromGroup(Group group) {
- // TODO Auto-generated method stub
-
- }
-
- public AccreditableManager getAccreditableManager() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public ItemManager getItemManager() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean canChangePassword() {
- // TODO Auto-generated method stub
- return false;
- }
-
-}
diff --git a/trunk/src/impl/test/org/apache/lenya/transaction/TransactionTest.java b/trunk/src/impl/test/org/apache/lenya/transaction/TransactionTest.java
deleted file mode 100644
index a793643..0000000
--- a/trunk/src/impl/test/org/apache/lenya/transaction/TransactionTest.java
+++ /dev/null
@@ -1,71 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-import org.apache.cocoon.core.container.ContainerTestCase;
-import org.apache.lenya.ac.Identity;
-
-public class TransactionTest extends ContainerTestCase {
-
- public void testTransaction() throws TransactionException {
-
- Identity lenya = new Identity(getLogger());
- lenya.addIdentifiable(new MockUser("lenya"));
-
- Identity alice = new Identity(getLogger());
- alice.addIdentifiable(new MockUser("alice"));
-
- IdentityMap lenyaMap = new IdentityMapImpl(getLogger());
- UnitOfWork lenyaUnit = new UnitOfWorkImpl(lenyaMap, lenya, getLogger());
- IdentifiableFactory lenyaFactory = new MockFactory(lenyaUnit);
-
- IdentityMap aliceMap = new IdentityMapImpl(getLogger());
- UnitOfWork aliceUnit = new UnitOfWorkImpl(aliceMap, alice, getLogger());
- IdentifiableFactory aliceFactory = new MockFactory(aliceUnit);
-
- MockTransactionable lenyaT1 = (MockTransactionable) lenyaMap.get(lenyaFactory, "t1");
- MockTransactionable aliceT1 = (MockTransactionable) aliceMap.get(aliceFactory, "t1");
-
- checkDoubleLock(lenyaT1);
- checkLockAndModify(lenyaUnit, lenyaT1, aliceT1);
-
- }
-
- protected void checkDoubleLock(MockTransactionable t) throws TransactionException {
- t.lock();
- try {
- t.lock();
- assertTrue("No exception thrown!", false);
- } catch (LockException ignore) {
- }
- t.unlock();
- }
-
- protected void checkLockAndModify(UnitOfWork lenyaUnit, MockTransactionable lenyaT1,
- MockTransactionable aliceT1) throws TransactionException {
- lenyaT1.lock();
- aliceT1.write();
- try {
- lenyaUnit.commit();
- assertTrue("No exception thrown!", false);
- } catch (ConcurrentModificationException ignore) {
- }
- lenyaT1.unlock();
- }
-
-}
diff --git a/trunk/src/impl/test/webtest/config.xml b/trunk/src/impl/test/webtest/config.xml
deleted file mode 100644
index 034d36e..0000000
--- a/trunk/src/impl/test/webtest/config.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<config
- host="localhost"
- port="8888"
- protocol="http"
- saveresponse="true"
- resultpath="src/test/webtest/results/"
- verbose="true"
- basepath="" />
\ No newline at end of file
diff --git a/trunk/src/impl/test/webtest/tests.xml b/trunk/src/impl/test/webtest/tests.xml
deleted file mode 100644
index 33ac5f1..0000000
--- a/trunk/src/impl/test/webtest/tests.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<!DOCTYPE project [
- <!ENTITY default SYSTEM "../../webapp/lenya/pubs/default/test/webtest/tests.xml">
- <!ENTITY config SYSTEM "config.xml">
-]>
-
-<project name="Lenya webtest tests" default="tests">
-
- <taskdef file="${webtest.home}/webtestTaskdefs.properties">
- <classpath>
- <fileset dir="${webtest.home}" includes="**/lib/*.jar"/>
- </classpath>
- </taskdef>
-
- <target name="tests" depends="pubs.default"/>
-
- &default;
-
-</project>
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/ac/AccessControlException.java b/trunk/src/java/org/apache/lenya/ac/AccessControlException.java
deleted file mode 100644
index 306f726..0000000
--- a/trunk/src/java/org/apache/lenya/ac/AccessControlException.java
+++ /dev/null
@@ -1,66 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-/**
- * Access control exception.
- * @version $Id$
- */
-public class AccessControlException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Create an AccessControlException
- *
- */
- public AccessControlException() {
- super();
- }
-
- /**
- * Create an AccessControlException
- *
- * @param message The message.
- */
- public AccessControlException(String message) {
- super(message);
- }
-
- /**
- * Create an AccessControlException
- *
- * @param message The message.
- * @param cause The cause.
- */
- public AccessControlException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Create an AccessControlException.
- *
- * @param cause The cause.
- */
- public AccessControlException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/AccessController.java b/trunk/src/java/org/apache/lenya/ac/AccessController.java
deleted file mode 100644
index 55e55f8..0000000
--- a/trunk/src/java/org/apache/lenya/ac/AccessController.java
+++ /dev/null
@@ -1,85 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-import org.apache.avalon.framework.component.Component;
-import org.apache.cocoon.environment.Request;
-
-/**
- * An access controller allows authenticating and authorizing identities.
- * @version $Id$
- */
-public interface AccessController extends Component {
-
- /**
- * The access control namespace URI.
- */
- String NAMESPACE = "http://apache.org/cocoon/lenya/ac/1.0";
-
- /**
- * The default prefix for the access control namespace.
- */
- String DEFAULT_PREFIX = "ac";
-
- /**
- * The Avalon role.
- */
- String ROLE = AccessController.class.getName();
-
- /**
- * Authenticates a request.
- * @param request A request.
- * @return A boolean value.
- * @throws AccessControlException when something went wrong.
- */
- boolean authenticate(Request request) throws AccessControlException;
-
- /**
- * Authorizes a request inside a publication.
- * @param request A request.
- * @return A boolean value.
- * @throws AccessControlException when something went wrong.
- */
- boolean authorize(Request request) throws AccessControlException;
-
- /**
- * Initializes the identity for this access controller.
- * @param request The request that contains the identity information.
- * @throws AccessControlException when something went wrong.
- */
- void setupIdentity(Request request) throws AccessControlException;
-
- /**
- * Returns the accreditable manager.
- * @return An accreditable manager.
- */
- AccreditableManager getAccreditableManager();
-
- /**
- * Returns the policy manager.
- * @return A policy manager.
- */
- PolicyManager getPolicyManager();
-
- /**
- * @return The authorizers.
- */
- Authorizer[] getAuthorizers();
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/ac/AccessControllerResolver.java b/trunk/src/java/org/apache/lenya/ac/AccessControllerResolver.java
deleted file mode 100644
index 0898ffe..0000000
--- a/trunk/src/java/org/apache/lenya/ac/AccessControllerResolver.java
+++ /dev/null
@@ -1,55 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac;
-
-import org.apache.avalon.framework.component.Component;
-
-/**
- * An access controller resolver resolves the appropriate access controller
- * for a given Cocoon object model.
- */
-public interface AccessControllerResolver extends Component {
-
- /**
- * The Avalon role.
- */
- String ROLE = AccessControllerResolver.class.getName();
-
- /**
- * The name of the default resolver to use.
- */
- String DEFAULT_RESOLVER = "publication";
-
- /**
- * Resolves an access controller for a certain URL.
- * @param webappUrl The URL within the web application (without context prefix).
- * @return An access controller or <code>null</code> if no controller could be resolved.
- * @throws AccessControlException when something went wrong.
- */
- AccessController resolveAccessController(String webappUrl) throws AccessControlException;
-
- /**
- * Releases a resolved access controller.
- * @param controller The access controller to release.
- */
- void release(AccessController controller);
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/Accreditable.java b/trunk/src/java/org/apache/lenya/ac/Accreditable.java
deleted file mode 100644
index 1a6b4da..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Accreditable.java
+++ /dev/null
@@ -1,36 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac;
-
-
-/**
- * An Accreditable can be accredited with roles on a certain URI
- * using a {@link org.apache.lenya.ac.Credential}.
- */
-public interface Accreditable {
- /**
- * Returns the set of accreditables of this accreditable.
- * The set contains the accreditable itself and all collections it belongs to.
- * @return An array of accreditables.
- */
- Accreditable[] getAccreditables();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/AccreditableManager.java b/trunk/src/java/org/apache/lenya/ac/AccreditableManager.java
deleted file mode 100644
index aa2be82..0000000
--- a/trunk/src/java/org/apache/lenya/ac/AccreditableManager.java
+++ /dev/null
@@ -1,87 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-import org.apache.avalon.framework.component.Component;
-
-/**
- * An AccreditableManager combines a UserManager, a GroupManager, an IPRangeManager and a
- * RoleManager.
- * @version $Id$
- */
-public interface AccreditableManager extends Component {
-
- /**
- * Avalon role.
- */
- String ROLE = AccreditableManager.class.getName();
-
- /**
- * Returns the user manager of this access controller.
- * @return A user manager.
- * @throws AccessControlException when something went wrong.
- */
- UserManager getUserManager() throws AccessControlException;
-
- /**
- * Returns the group manager of this access controller.
- * @return A group manager.
- * @throws AccessControlException when something went wrong.
- */
- GroupManager getGroupManager() throws AccessControlException;
-
- /**
- * Returns the role manager of this access controller.
- * @return A role manager.
- * @throws AccessControlException when something went wrong.
- */
- RoleManager getRoleManager() throws AccessControlException;
-
- /**
- * Returns the IP range manager of this access controller.
- * @return An IP range manager.
- * @throws AccessControlException when something went wrong.
- */
- IPRangeManager getIPRangeManager() throws AccessControlException;
-
- /**
- * Attaches an item manager listener to this accreditable manager.
- * @param listener An item manager listener.
- */
- void addItemManagerListener(ItemManagerListener listener);
-
- /**
- * Removes an item manager listener from this accreditable manager.
- * @param listener An item manager listener.
- */
- void removeItemManagerListener(ItemManagerListener listener);
-
- /**
- * @return A source URI to store configuration sources. This URI
- * must point to a collection.
- */
- String getConfigurationCollectionUri();
-
- /**
- * @return The unique ID of this accreditable manager. It is used to check
- * if two accreditables belong to the same accreditable manager.
- */
- String getId();
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/ac/AccreditableManagerFactory.java b/trunk/src/java/org/apache/lenya/ac/AccreditableManagerFactory.java
deleted file mode 100644
index 45dbc3f..0000000
--- a/trunk/src/java/org/apache/lenya/ac/AccreditableManagerFactory.java
+++ /dev/null
@@ -1,40 +0,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.
- *
- */
-package org.apache.lenya.ac;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-
-/**
- * Factory to produce accreditable managers.
- */
-public interface AccreditableManagerFactory {
-
- /**
- * The Avalon service role.
- */
- String ROLE = AccreditableManagerFactory.class.getName();
-
- /**
- * @param config The configuration.
- * @return An accreditable manager for a certain configuration.
- * @throws ConfigurationException if the configuration failed.
- */
- AccreditableManager getAccreditableManager(Configuration config) throws ConfigurationException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/Authenticator.java b/trunk/src/java/org/apache/lenya/ac/Authenticator.java
deleted file mode 100644
index edc1fe0..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Authenticator.java
+++ /dev/null
@@ -1,44 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-import org.apache.avalon.framework.component.Component;
-import org.apache.cocoon.environment.Request;
-
-/**
- * An authenticator.
- * @version $Id$
- */
-public interface Authenticator extends Component {
-
- /**
- * Avalon role.
- */
- String ROLE = Authenticator.class.getName();
-
- /**
- * Authenticates a request.
- * @param accreditableManager The accreditable manager to use.
- * @param request The request.
- * @return <code>true</code> if the request is authenticated, <code>false</code> otherwise.
- * @throws AccessControlException when something went wrong.
- */
- boolean authenticate(AccreditableManager accreditableManager, Request request)
- throws AccessControlException;
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/Authorizer.java b/trunk/src/java/org/apache/lenya/ac/Authorizer.java
deleted file mode 100644
index 002629c..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Authorizer.java
+++ /dev/null
@@ -1,44 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-import org.apache.avalon.framework.component.Component;
-import org.apache.cocoon.environment.Request;
-
-/**
- * An Authorizer checks if an Identity is authorized to invoke a certain request.
- * @version $Id$
- */
-public interface Authorizer extends Component {
-
- /**
- * The Avalon role.
- */
- String ROLE = Authorizer.class.getName();
-
- /**
- * Authorizes an identity at a URL.
- * @param request The request.
- * @return <code>true</code> if the identity is authorized, <code>false</code> otherwise.
- * @throws AccessControlException when something went wrong.
- */
- boolean authorize(Request request)
- throws AccessControlException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/Credential.java b/trunk/src/java/org/apache/lenya/ac/Credential.java
deleted file mode 100644
index 5763434..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Credential.java
+++ /dev/null
@@ -1,49 +0,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.
- *
- */
-package org.apache.lenya.ac;
-
-/**
- * A credential assigns a {@link Role} to an {@link Accreditable}.
- */
-public interface Credential {
-
- /**
- * @return The accreditable this credential applies to.
- */
- Accreditable getAccreditable();
-
- /**
- * @return The role of this credential.
- */
- Role getRole();
-
- /**
- * @return The method, one of {@link #GRANT} and {@link #DENY}.
- */
- String getMethod();
-
- /**
- * The "grant" method.
- */
- String GRANT = "grant";
-
- /**
- * The "deny" method.
- */
- String DENY = "deny";
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/Group.java b/trunk/src/java/org/apache/lenya/ac/Group.java
deleted file mode 100644
index 2880984..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Group.java
+++ /dev/null
@@ -1,69 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-/**
- * A group.
- * @version $Id$
- */
-public interface Group extends Identifiable, Item {
-
- /**
- * Returns the members of this group.
- * @return An array of {@link Groupable}s.
- */
- Groupable[] getMembers();
-
- /**
- * Adds a member to this group.
- * @param member The member to add.
- */
- void add(Groupable member);
-
- /**
- * Removes a member from this group.
- * @param member The member to remove.
- */
- void remove(Groupable member);
-
- /**
- * Removes all members from this group.
- */
- void removeAllMembers();
-
- /**
- * Returns if this group contains this member.
- * @param member The member to check.
- * @return A boolean value.
- */
- boolean contains(Groupable member);
-
- /**
- * Delete a group.
- * @throws AccessControlException if the delete failed
- */
- void delete() throws AccessControlException;
-
- /**
- * Saves this group.
- * @throws AccessControlException when saving failed.
- */
- void save() throws AccessControlException;
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/ac/GroupManager.java b/trunk/src/java/org/apache/lenya/ac/GroupManager.java
deleted file mode 100644
index d711795..0000000
--- a/trunk/src/java/org/apache/lenya/ac/GroupManager.java
+++ /dev/null
@@ -1,56 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-/**
- * A group manager.
- * @version $Id$
- */
-public interface GroupManager extends ItemManager {
-
- /**
- * Get all groups.
- * @return an array of groups.
- */
- Group[] getGroups();
-
- /**
- * Add a group to this manager.
- * @param id the ID of the group to be added.
- * @return A group.
- * @throws AccessControlException when the group is already contained.
- */
- Group add(String id) throws AccessControlException;
-
- /**
- * Remove a group from this manager.
- * @param group the group to be removed.
- * @throws AccessControlException when the group is not contained.
- */
- void remove(Group group) throws AccessControlException;
-
- /**
- * Get the group with the given group name.
- *
- * @param groupId the id of the requested group.
- * @return a <code>Group</code> or null if there is no group with the given name
- */
- Group getGroup(String groupId);
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/ac/Groupable.java b/trunk/src/java/org/apache/lenya/ac/Groupable.java
deleted file mode 100644
index d692333..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Groupable.java
+++ /dev/null
@@ -1,49 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-/**
- * Generalized interface of group member objects.
- * @version $Id$
- */
-public interface Groupable {
-
- /**
- * Notifies this Groupable of being added to a group.
- * @param group The group.
- */
- void addedToGroup(Group group);
-
- /**
- * Notifies this Groupable of being removed from a group.
- * @param group The group.
- */
- void removedFromGroup(Group group);
-
- /**
- * Returns all groups that contain this Groupable.
- * @return A {@link Group} array.
- */
- Group[] getGroups();
-
- /**
- * Removes this Groupable from all groups.
- */
- void removeFromAllGroups();
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/IPRange.java b/trunk/src/java/org/apache/lenya/ac/IPRange.java
deleted file mode 100644
index 7b54a01..0000000
--- a/trunk/src/java/org/apache/lenya/ac/IPRange.java
+++ /dev/null
@@ -1,101 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac;
-
-import java.net.InetAddress;
-
-
-/**
- * An IP range.
- */
-public interface IPRange extends Accreditable, Item, Groupable {
-
- /**
- * Sets the network address.
- *
- * @param address A string, e.g. 192.168.0.32
- *
- * @throws AccessControlException when the conversion of the String to an
- * InetAddress failed.
- */
- void setNetworkAddress(String address) throws AccessControlException;
-
- /**
- * Sets the network address.
- *
- * @param address A byte array of the length 4.
- *
- * @throws AccessControlException when the conversion of the byte array to an
- * InetAddress failed.
- */
- void setNetworkAddress(byte[] address) throws AccessControlException;
-
- /**
- * Returns the network address.
- * @return An InetAddress value.
- */
- InetAddress getNetworkAddress();
-
- /**
- * Sets the subnet mask.
- *
- * @param mask A string, e.g. 192.168.0.32
- *
- * @throws AccessControlException when the conversion of the String to an
- * InetAddress failed.
- */
- void setSubnetMask(String mask) throws AccessControlException;
-
- /**
- * Sets the subnet mask.
- *
- * @param mask A byte array of the length 4.
- *
- * @throws AccessControlException when the conversion of the byte array to an
- * InetAddress failed.
- */
- void setSubnetMask(byte[] mask) throws AccessControlException;
-
- /**
- * Returns the subnet mask.
- * @return An InetAddress value.
- */
- InetAddress getSubnetMask();
-
- /**
- * Checks if this IP range contains a certain machine.
- * @param machine The machine to check for.
- * @return A boolean value.
- */
- boolean contains(Machine machine);
-
- /**
- * Save the IP range.
- * @throws AccessControlException if the save failed
- */
- void save() throws AccessControlException;
-
- /**
- * Delete an IP range.
- * @throws AccessControlException if the delete failed
- */
- void delete() throws AccessControlException;
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/ac/IPRangeManager.java b/trunk/src/java/org/apache/lenya/ac/IPRangeManager.java
deleted file mode 100644
index 0ba3a4f..0000000
--- a/trunk/src/java/org/apache/lenya/ac/IPRangeManager.java
+++ /dev/null
@@ -1,61 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac;
-
-/**
- * An IP range manager.
- */
-public interface IPRangeManager extends ItemManager {
-
- /**
- * Get all IP ranges.
- *
- * @return an array of IP ranges.
- */
- IPRange[] getIPRanges();
-
- /**
- * Add the given IP range
- *
- * @param id IP range that is to be added
- * @return An IP range.
- * @throws AccessControlException when the IP range is already contained.
- */
- IPRange add(String id) throws AccessControlException;
-
- /**
- * Remove the given IP range
- *
- * @param range IP range that is to be removed
- * @throws AccessControlException when the IP range is not contained.
- */
- void remove(IPRange range) throws AccessControlException;
-
- /**
- * Get the IPRange with the given id.
- *
- * @param rangeId user id of requested IP range
- * @return the requested IP range or null if there is
- * no IP range with the given id
- */
- IPRange getIPRange(String rangeId);
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/ac/Identifiable.java b/trunk/src/java/org/apache/lenya/ac/Identifiable.java
deleted file mode 100644
index 25de70c..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Identifiable.java
+++ /dev/null
@@ -1,28 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac;
-
-/**
- * A marker interface to mark an {@link Accreditable} as identifiable.
- */
-public interface Identifiable extends Accreditable {
- // implement here
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/Identity.java b/trunk/src/java/org/apache/lenya/ac/Identity.java
deleted file mode 100644
index 6d34e19..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Identity.java
+++ /dev/null
@@ -1,217 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.cocoon.environment.Session;
-
-/**
- * Identity object. Used to store the authenticated accreditables in the session.
- */
-public class Identity extends AbstractLogEnabled implements Identifiable, Serializable {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private Set identifiables = new HashSet();
-
- /**
- * Ctor.
- * @param logger The logger.
- */
- public Identity(Logger logger) {
- ContainerUtil.enableLogging(this, logger);
- }
-
- /**
- * Initializes this identity.
- */
- public void initialize() {
- addIdentifiable(World.getInstance());
- }
-
- /**
- * In the case of Tomcat the object will be serialized to TOMCAT/work/Standalone/localhost/lenya/SESSIONS.ser
- * @param out OutputStream to hold the serialized identity
- * @throws IOException
- */
- private void writeObject(ObjectOutputStream out) throws IOException {
- out.defaultWriteObject();
- out.writeObject(this.identifiables);
- }
-
- /**
- * In case of Tomcat the object will be restored from TOMCAT/work/Standalone/localhost/lenya/SESSIONS.ser
- * @param in InputStream that holds the serialized identity
- * @throws IOException
- * @throws ClassNotFoundException
- */
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- in.defaultReadObject();
- this.identifiables = (Set) in.readObject();
- }
-
- /**
- * Returns the identifiables of this identity.
- * @return An array of identifiables.
- */
- public Identifiable[] getIdentifiables() {
- return (Identifiable[]) this.identifiables.toArray(new Identifiable[this.identifiables.size()]);
- }
-
- /**
- * Adds a new identifiable to this identity.
- * @param identifiable The identifiable to add.
- */
- public void addIdentifiable(Identifiable identifiable) {
- assert identifiable != null;
- assert identifiable != this;
- assert !this.identifiables.contains(identifiable);
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Adding identifiable: [" + identifiable + "]");
- }
-
- this.identifiables.add(identifiable);
- }
-
- /**
- * @see Accreditable#getAccreditables()
- */
- public Accreditable[] getAccreditables() {
- Set accreditables = new HashSet();
- Identifiable[] _identifiables = getIdentifiables();
-
- for (int i = 0; i < _identifiables.length; i++) {
- Accreditable[] groupAccreditables = _identifiables[i].getAccreditables();
- accreditables.addAll(Arrays.asList(groupAccreditables));
- }
-
- return (Accreditable[]) accreditables.toArray(new Accreditable[accreditables.size()]);
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer buf = new StringBuffer();
- Accreditable[] accreditables = getAccreditables();
-
- for (int i = 0; i < accreditables.length; i++) {
- buf.append(" " + accreditables[i]);
- }
-
- String string = "[identity:" + buf.toString() + "]";
-
- return string;
- }
-
- /**
- * Checks if this identity belongs to a certain accreditable manager.
- * @param manager The accreditable manager to check for.
- * @return A boolean value.
- * @throws AccessControlException if an error occurs
- */
- public boolean belongsTo(AccreditableManager manager) throws AccessControlException {
- User user = getUser();
- if (user == null) {
- return true;
- }
- else {
- String thisId = user.getAccreditableManager().getId();
- String otherId = manager.getId();
- return thisId.equals(otherId);
- }
- }
-
- /**
- * Returns the user of this identity.
- * @return A user.
- */
- public User getUser() {
- User user = null;
- Identifiable[] _identifiables = getIdentifiables();
- int i = 0;
- while (user == null && i < _identifiables.length) {
- if (_identifiables[i] instanceof User) {
- user = (User) _identifiables[i];
- }
- i++;
- }
- return user;
- }
-
- /**
- * Returns the machine of this identity.
- * @return A machine.
- */
- public Machine getMachine() {
- Machine machine = null;
- Identifiable[] _identifiables = getIdentifiables();
- int i = 0;
- while (machine == null && i < _identifiables.length) {
- if (_identifiables[i] instanceof Machine) {
- machine = (Machine) _identifiables[i];
- }
- i++;
- }
- return machine;
- }
-
- /**
- * Checks if this identity contains a certain identifiable.
- * @param identifiable The identifiable to look for.
- * @return A boolean value.
- */
- public boolean contains(Identifiable identifiable) {
- return this.identifiables.contains(identifiable);
- }
-
- /**
- * Fetches the identity from a session.
- * @param session The session.
- * @return An identity.
- */
- public static Identity getIdentity(Session session) {
- Identity identity = (Identity) session.getAttribute(Identity.class.getName());
- return identity;
- }
-
- /**
- * Removes a certain identifiable from the idenity.
- * @param identifiable An identifiable.
- */
- public void removeIdentifiable(Identifiable identifiable) {
- assert this.identifiables.contains(identifiable);
- this.identifiables.remove(identifiable);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/ac/InheritingPolicyManager.java b/trunk/src/java/org/apache/lenya/ac/InheritingPolicyManager.java
deleted file mode 100644
index 6e83772..0000000
--- a/trunk/src/java/org/apache/lenya/ac/InheritingPolicyManager.java
+++ /dev/null
@@ -1,59 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.PolicyManager;
-
-/**
- * Policy manager which inherits credentials in a policy tree.
- * @version $Id$
- */
-public interface InheritingPolicyManager extends PolicyManager {
-
- /**
- * Builds a subtree policy from a file. When the file is not present, an empty policy is
- * returned.
- * @param controller The access controller to use.
- * @param url The URL inside the web application.
- * @return A policy.
- * @throws AccessControlException when something went wrong.
- */
- Policy buildSubtreePolicy(AccreditableManager controller, String url)
- throws AccessControlException;
-
- /**
- * Returns the existing policies for all URL steps in bottom-up order, ending with the root policy.
- * @param controller The accreditable manager to use.
- * @param url The URL inside the web application.
- * @return An array of policies.
- * @throws AccessControlException when something went wrong.
- */
- Policy[] getPolicies(AccreditableManager controller, String url) throws AccessControlException;
-
- /**
- * Saves a Subtree policy.
- * @param url The url to save the policy for.
- * @param policy The policy to save.
- * @throws AccessControlException when something went wrong.
- */
- void saveSubtreePolicy(String url, Policy policy) throws AccessControlException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/Item.java b/trunk/src/java/org/apache/lenya/ac/Item.java
deleted file mode 100644
index 4675334..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Item.java
+++ /dev/null
@@ -1,75 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.LogEnabled;
-
-
-/**
- * An item can be initialized from a configuration.
- */
-public interface Item extends LogEnabled {
-
- /**
- * Returns the ID.
- * @return A string.
- */
- String getId();
-
- /**
- * Returns the name.
- * @return A string.
- */
- String getName();
-
- /**
- * Sets the name.
- * @param name A string.
- */
- void setName(String name);
-
- /**
- * Returns the description.
- * @return A string.
- */
- String getDescription();
-
- /**
- * Sets the description.
- * @param description A string.
- */
- void setDescription(String description);
-
- /**
- * Configures this item.
- * @param configuration The configuration.
- * @throws ConfigurationException when something went wrong.
- */
- void configure(Configuration configuration) throws ConfigurationException;
-
- /**
- * @return The item manager this item belongs to.
- */
- ItemManager getItemManager();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/ItemManager.java b/trunk/src/java/org/apache/lenya/ac/ItemManager.java
deleted file mode 100644
index 7f55e71..0000000
--- a/trunk/src/java/org/apache/lenya/ac/ItemManager.java
+++ /dev/null
@@ -1,44 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-/**
- * Item manager.
- * @version $Id$
- */
-public interface ItemManager {
-
- /**
- * Adds an item manager listener.
- * @param listener The listener to add.
- */
- void addItemManagerListener(ItemManagerListener listener);
-
- /**
- * Removes an item manager listener.
- * @param listener The listener to remove.
- */
- void removeItemManagerListener(ItemManagerListener listener);
-
- /**
- * @return The accreditable manager this item manager belongs to.
- */
- AccreditableManager getAccreditableManager();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/ItemManagerListener.java b/trunk/src/java/org/apache/lenya/ac/ItemManagerListener.java
deleted file mode 100644
index 3868570..0000000
--- a/trunk/src/java/org/apache/lenya/ac/ItemManagerListener.java
+++ /dev/null
@@ -1,44 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac;
-
-/**
- * This class allows listening to objects that manages items.
- */
-public interface ItemManagerListener {
-
- /**
- * Called when an accreditable was added.
- *
- * @param item The item that was added.
- * @throws AccessControlException when an error occurs.
- */
- void itemAdded(Item item) throws AccessControlException;
-
- /**
- * Called when an accreditable was removed.
- *
- * @param item The item that was removed.
- * @throws AccessControlException when an error occurs.
- */
- void itemRemoved(Item item) throws AccessControlException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/ItemUtil.java b/trunk/src/java/org/apache/lenya/ac/ItemUtil.java
deleted file mode 100644
index 9442d9d..0000000
--- a/trunk/src/java/org/apache/lenya/ac/ItemUtil.java
+++ /dev/null
@@ -1,45 +0,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.
- *
- */
-package org.apache.lenya.ac;
-
-import org.apache.commons.validator.EmailValidator;
-
-/**
- * Utility class for access control items.
- */
-public class ItemUtil {
-
- /**
- * Checks if a string is a valid ID.
- * @param id The string to test.
- * @return A boolean value.
- */
- public static boolean isValidId(String id) {
- return id != null && id.matches("\\w+");
- }
-
- /**
- * Checks if a string is a valid e-mail address.
- * @param email The string.
- * @return A boolean value.
- */
- public static boolean isValidEmail(String email) {
- return EmailValidator.getInstance().isValid(email);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/Machine.java b/trunk/src/java/org/apache/lenya/ac/Machine.java
deleted file mode 100644
index b42f7a0..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Machine.java
+++ /dev/null
@@ -1,183 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A machine (representing an IP address).
- * @version $Id$
- */
-public class Machine implements Identifiable, Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates a new machine object. This method accepts
- * numeric IPv4 addresses like <code>"129.168.0.32"</code>,
- * numeric IPv6 addresses like <code>"1080::8:800:200C:417A"</code>
- * as well as hostnames (if DNS resolution is available) like
- * <code>"localhost"</code> or <code>"www.apache.com"</code>.
- *
- * @param ip a <code>String</code> like <code>"192.168.0.32"</code>,
- * <code>"::1"</code>, ...
- * .
- * @throws AccessControlException when the conversion of the
- * <code>String</code> to an <code>InetAddress</code> failed
- */
- public Machine(String ip) throws AccessControlException {
- try {
- setAddress(InetAddress.getByName(ip));
- } catch(UnknownHostException uhe) {
- throw new AccessControlException
- ("Failed to convert address [" + ip + "]: ", uhe);
- }
- }
-
- private InetAddress address;
-
- /**
- * @see java.lang.Object#equals(Object)
- */
- public boolean equals(Object otherObject) {
- boolean equals = false;
-
- if (otherObject instanceof Machine) {
- Machine otherMachine = (Machine) otherObject;
- equals = getAddress().equals(otherMachine.getAddress());
- }
-
- return equals;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getAddress().hashCode();
- }
-
- /**
- * @see org.apache.lenya.ac.Accreditable#getAccreditables()
- */
- public Accreditable[] getAccreditables() {
- Accreditable[] ranges = getIPRanges();
- Accreditable[] accreditables = new Accreditable[ranges.length + 1];
- accreditables[0] = this;
- for (int i = 0; i < ranges.length; i++) {
- accreditables[i+1] = ranges[i];
- }
- return accreditables;
- }
-
- /**
- * Returns the IP address.
- * @return The IP address.
- */
- public String getIp() {
- return getAddress().getHostAddress();
- }
-
- /**
- * Converts a string to an IP addres.
- * @param string The IP address, represented by a string.
- * @return An InetAddress object.
- * @throws AccessControlException when something went wrong.
- * @deprecated This method is unnecessary and does not work for IPv6.
- * Use <code>InetAddress.getByName(string)</code> instead!
- */
- public static InetAddress getAddress(String string)
- throws AccessControlException {
- String[] strings = string.split("\\.");
-
- InetAddress address;
- try {
- byte[] numbers = new byte[strings.length];
- for (int i = 0; i < strings.length; i++) {
- int number = Integer.parseInt(strings[i]);
- if (number > 127) {
- number = number - 256;
- }
- numbers[i] = (byte) number;
- }
-
- address = InetAddress.getByAddress(numbers);
- } catch (final NumberFormatException e1) {
- throw new AccessControlException(
- "Failed to convert address [" + string + "]: ",
- e1);
- } catch (final UnknownHostException e1) {
- throw new AccessControlException(
- "Failed to convert address [" + string + "]: ",
- e1);
- }
- return address;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return getIp();
- }
-
- /**
- * Returns the IP address.
- * @return An IP address.
- */
- public InetAddress getAddress() {
- return this.address;
- }
-
- /**
- * Sets the IP address.
- * @param _address An IP address.
- */
- public void setAddress(InetAddress _address) {
- this.address = _address;
- }
-
- private List ipRanges = new ArrayList();
-
- /**
- * Adds an IP range to this machine.
- * @param range An IP range this machine belongs to.
- */
- public void addIPRange(IPRange range) {
- assert range != null;
- assert !this.ipRanges.contains(range);
- this.ipRanges.add(range);
- }
-
- /**
- * Returns the IP ranges this machine belongs to.
- * @return An array of IP ranges.
- */
- public IPRange[] getIPRanges() {
- return (IPRange[]) this.ipRanges.toArray(new IPRange[this.ipRanges.size()]);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/ModifiablePolicy.java b/trunk/src/java/org/apache/lenya/ac/ModifiablePolicy.java
deleted file mode 100644
index 29ef2d7..0000000
--- a/trunk/src/java/org/apache/lenya/ac/ModifiablePolicy.java
+++ /dev/null
@@ -1,90 +0,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.
- *
- */
-package org.apache.lenya.ac;
-
-/**
- * Modifiable policy.
- */
-public interface ModifiablePolicy extends Policy {
-
- /**
- * Sets if this policy requires SSL protection.
- *
- * @param ssl
- * A boolean value.
- */
- void setSSL(boolean ssl);
-
- /**
- * Adds a role to this policy for a certain accreditable and a certain role.
- * If a credenital exists for the accreditable, the role is added to this
- * credential. Otherwise, a new credential is created.
- *
- * @param accreditable
- * An accreditable.
- * @param role
- * A role.
- * @param method
- */
- public void addRole(Accreditable accreditable, Role role, String method);
-
- /**
- * Removes a role from this policy for a certain accreditable and a certain
- * role.
- *
- * @param accreditable
- * An accreditable.
- * @param role
- * A role.
- * @throws AccessControlException
- * if the accreditable-role pair is not contained.
- */
- public void removeRole(Accreditable accreditable, Role role)
- throws AccessControlException;
-
- /**
- * Removes all roles from this policy for a certain accreditable.
- *
- * @param accreditable
- * An accreditable.
- * @throws AccessControlException
- * if the accreditable-role pair is not contained.
- */
- void removeRoles(Accreditable accreditable) throws AccessControlException;
-
- /**
- * Moves a role up the credential tree, giving it higher priority.
- *
- * @param accreditable
- * @param role
- * @throws AccessControlException
- */
- public void moveRoleUp(Accreditable accreditable, Role role)
- throws AccessControlException;
-
- /**
- * Moves a role down the credential tree, decreasing its priority.
- *
- * @param accreditable
- * @param role
- * @throws AccessControlException
- */
- public void moveRoleDown(Accreditable accreditable, Role role)
- throws AccessControlException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/Password.java b/trunk/src/java/org/apache/lenya/ac/Password.java
deleted file mode 100644
index 9cdabb9..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Password.java
+++ /dev/null
@@ -1,73 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac;
-
-import java.security.MessageDigest;
-
-/**
- * Encrypt plain text password
- * Example: "message digest" becomes "f96b697d7cb7938d525a2f31aaf161d0" (hexadecimal notation (32 characters))
- */
-public class Password {
-
- /**
- * Encrypt plain text password
- *
- * @param plain plain text password
- * @return encrypted password
- */
- public static String encrypt(String plain) {
- return getMD5(plain);
- }
-
- /**
- * Returns the MD5 representation of a string.
- * @param plain The plain string.
- * @return A string.
- */
- public static String getMD5(String plain) {
- MessageDigest md = null;
- try {
- md = MessageDigest.getInstance("MD5");
- } catch (java.security.NoSuchAlgorithmException e) {
- throw new RuntimeException(e);
- }
- return stringify(md.digest(plain.getBytes()));
- }
-
- /**
- * Converts a byte buffer to a string.
- * @param buf The buffer.
- * @return A string.
- */
- private static String stringify(byte[] buf) {
- StringBuffer sb = new StringBuffer(2 * buf.length);
-
- for (int i = 0; i < buf.length; i++) {
- int h = (buf[i] & 0xf0) >> 4;
- int l = (buf[i] & 0x0f);
- sb.append(new Character((char) ((h > 9) ? (('a' + h) - 10) : ('0' + h))));
- sb.append(new Character((char) ((l > 9) ? (('a' + l) - 10) : ('0' + l))));
- }
-
- return sb.toString();
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/Policy.java b/trunk/src/java/org/apache/lenya/ac/Policy.java
deleted file mode 100644
index c2d355e..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Policy.java
+++ /dev/null
@@ -1,81 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-/**
- * A policy assigns roles to accreditables using credentials.
- * Additionally, SSL protection is defined.
- *
- * @version $Id$
- */
-public interface Policy {
-
- /**
- * The identity was not matched in this policy.
- */
- int RESULT_NOT_MATCHED = 0;
-
- /**
- * The role is denied for the identity.
- */
- int RESULT_DENIED = 1;
-
- /**
- * The role is granted for the identity.
- */
- int RESULT_GRANTED = 2;
-
- /**
- * Checks if a certain role is granted for a certain policy.
- * @param identity The identity.
- * @param role The role to check.
- * @return A result code.
- * @throws AccessControlException when something went wrong.
- */
- int check(Identity identity, Role role) throws AccessControlException;
-
- /**
- * Returns if this policy requires SSL protection.
- * @return A boolean value.
- * @throws AccessControlException when something went wrong.
- */
- boolean isSSLProtected() throws AccessControlException;
-
- /**
- * Returns if the policy is empty. A policy is empty if it does
- * not contain any credentials.
- * @return A boolean value.
- * @throws AccessControlException when something went wrong.
- */
- boolean isEmpty() throws AccessControlException;
-
- /**
- * @param identity The identity.
- * @return All credentials defined by this policy for this identity.
- * @throws AccessControlException if an error occurs.
- */
- Credential[] getCredentials(Identity identity) throws AccessControlException;
-
- /**
- * @return All credentials defined by this policy.
- * @throws AccessControlException if an error occurs.
- */
- Credential[] getCredentials() throws AccessControlException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/PolicyManager.java b/trunk/src/java/org/apache/lenya/ac/PolicyManager.java
deleted file mode 100644
index e063525..0000000
--- a/trunk/src/java/org/apache/lenya/ac/PolicyManager.java
+++ /dev/null
@@ -1,90 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-import org.apache.avalon.framework.component.Component;
-
-/**
- * A policy manager.
- *
- * @version $Id$
- */
-public interface PolicyManager extends Component {
-
- /**
- * The Avalon role.
- */
- String ROLE = PolicyManager.class.getName();
-
- /**
- * Returns the policy for a given page.
- * @param controller The access controller.
- * @param url The url inside the web application.
- * @return The policy.
- * @throws AccessControlException when something went wrong.
- */
- Policy getPolicy(AccreditableManager controller, String url) throws AccessControlException;
-
- /**
- * Returns all granted roles for a certain identity on a certain URL.
- * @param accreditableManager The accreditable manager.
- * @param identity The identity.
- * @param url The URL.
- * @return An array of roles.
- * @throws AccessControlException if an error occurs.
- */
- Role[] getGrantedRoles(AccreditableManager accreditableManager, Identity identity, String url)
- throws AccessControlException;
-
- /**
- * Return all credentials for this url
- *
- * @param controller The Accreditable Manager
- * @param url The AC url
- * @return An array of credentials
- * @throws AccessControlException when something went wrong.
- */
- Credential[] getCredentials(AccreditableManager controller, String url)
- throws AccessControlException;
-
- /**
- * Called when an accreditable was added. Used to create the admin interface
- * policy. This method get invoked, when e.g. a new user is added. The user
- * always should be able to edit her profile. Therefore the method normally
- * grant inherit edit rights to the user profile page.
- *
- * @param manager The accreditable manager the accreditable belonged to.
- * @param accreditable The accreditable that was removed.
- * @throws AccessControlException when something went wrong.
- */
- void accreditableAdded(AccreditableManager manager, Accreditable accreditable)
- throws AccessControlException;
-
- /**
- * Called when an accreditable was removed. Used to clean up the policies
- * and to remove the admin interface policy.
- *
- * @param manager The accreditable manager the accreditable belonged to.
- * @param accreditable The accreditable that was removed.
- * @throws AccessControlException when something went wrong.
- */
- void accreditableRemoved(AccreditableManager manager, Accreditable accreditable)
- throws AccessControlException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/Role.java b/trunk/src/java/org/apache/lenya/ac/Role.java
deleted file mode 100644
index 2fc823b..0000000
--- a/trunk/src/java/org/apache/lenya/ac/Role.java
+++ /dev/null
@@ -1,34 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac;
-
-/**
- * The role interface.
- * @version $Id$
- */
-public interface Role extends Item {
-
- /**
- * @return if the role may be assigned to accreditables in policies.
- */
- boolean isAssignable();
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/ac/RoleManager.java b/trunk/src/java/org/apache/lenya/ac/RoleManager.java
deleted file mode 100644
index d6537ec..0000000
--- a/trunk/src/java/org/apache/lenya/ac/RoleManager.java
+++ /dev/null
@@ -1,60 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac;
-
-/**
- * Role manager.
- * @version $Id$
- */
-public interface RoleManager extends ItemManager {
-
- /**
- * Get the role for the given ID.
- *
- * @param roleId The name of the role requested.
- * @return a <code>Role</code> or null if no role with the given name found
- */
- Role getRole(String roleId);
-
- /**
- * Get all roles
- *
- * @return an array of roles
- */
- Role[] getRoles();
-
- /**
- * Add a role
- *
- * @param role Role to add
- * @throws AccessControlException when the role is already contained.
- */
- void add(Role role) throws AccessControlException;
-
- /**
- * Remove a role
- *
- * @param role Role to remove
- * @throws AccessControlException when the role is not contained.
- */
- void remove(Role role) throws AccessControlException;
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/ac/User.java b/trunk/src/java/org/apache/lenya/ac/User.java
deleted file mode 100644
index 9fe7188..0000000
--- a/trunk/src/java/org/apache/lenya/ac/User.java
+++ /dev/null
@@ -1,125 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-/**
- * A user.
- * @version $Id$
- */
-public interface User extends Identifiable, Item, Groupable {
-
- /**
- * Get the email address
- *
- * @return a <code>String</code>
- */
- String getEmail();
-
- /**
- * Set the email address
- *
- * @param email the new email address
- */
- void setEmail(String email);
-
- /**
- * Sets the password.
- * @param plainTextPassword The plain text password.
- */
- void setPassword(String plainTextPassword);
-
- /**
- * Checks support for changing password
- * @return true if password change is supported
- */
- public abstract boolean canChangePassword();
-
- /**
- * Returns the user's preferred locale for the Lenya
- * CMS menus and CMS screens.
- *
- * The locale can either be a 2 letter country code
- * (de, en) or a locale code according to RFC 1766 /
- * ISO 639 / ISO 3166 (de_DE, de_CH, de_AT, en_US, ...)
- * @return The locale.
- */
- String getDefaultMenuLocale();
-
- /**
- * Sets the user's preferred locale for the Lenya
- * menu and CMS screens.
- *
- * The locale can either be a 2 letter country code
- * (de, en) or a locale code according to RFC 1766 /
- * ISO 639 / ISO 3166 (de_DE, de_CH, de_AT, en_US, ...)
- * @param menuLocale The locale.
- */
- void setDefaultMenuLocale(String menuLocale);
-
- /**
- * Returns the user's default locale of documents
- * to be created or edited.
- *
- * The locale can either be a 2 letter country code
- * (de, en) or a locale code according to RFC 1766 /
- * ISO 639 / ISO 3166 (de_DE, de_CH, de_AT, en_US, ...)
- * @return The locale.
- */
- String getDefaultDocumentLocale();
-
- /**
- * Sets the user's default locale of documents
- * to be created or edited.
- *
- * The locale can either be a 2 letter country code
- * (de, en) or a locale code according to RFC 1766 /
- * ISO 639 / ISO 3166 (de_DE, de_CH, de_AT, en_US, ...)
- * @param documentLocale The locale.
- */
- void setDefaultDocumentLocale(String documentLocale);
-
- /**
- * Save the user
- *
- * @throws AccessControlException if the save failed
- */
- void save() throws AccessControlException;
-
- /**
- * Delete a user
- *
- * @throws AccessControlException if the delete failed
- */
- void delete() throws AccessControlException;
-
- /**
- * Authenticate a user. This is done by encrypting
- * the given password and comparing this to the
- * encryptedPassword.
- *
- * @param password to authenticate with
- * @return true if the given password matches the password for this user
- */
- boolean authenticate(String password);
-
- /**
- * @return The accreditable manager this accreditable belongs to.
- */
- AccreditableManager getAccreditableManager();
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/UserManager.java b/trunk/src/java/org/apache/lenya/ac/UserManager.java
deleted file mode 100644
index 1dd7c1e..0000000
--- a/trunk/src/java/org/apache/lenya/ac/UserManager.java
+++ /dev/null
@@ -1,66 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-/**
- * User manager.
- * @version $Id$
- */
-public interface UserManager extends ItemManager {
-
- /**
- * Get all users.
- *
- * @return an array of users
- */
- User[] getUsers();
-
- /**
- * Get all supported user types
- *
- * @return a collection of user types
- */
- UserType[] getUserTypes();
-
- /**
- * Add the given user
- *
- * @param user A user.
- * @throws AccessControlException when the user is already contained.
- */
- void add(User user) throws AccessControlException;
-
- /**
- * Remove the given user
- *
- * @param user User that is to be removed
- * @throws AccessControlException when the user is not contained.
- */
- void remove(User user) throws AccessControlException;
-
- /**
- * Get the user with the given user id.
- *
- * @param userId user id of requested user
- * @return the requested user or null if there is
- * no user with the given user id
- */
- User getUser(String userId);
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/ac/UserType.java b/trunk/src/java/org/apache/lenya/ac/UserType.java
deleted file mode 100644
index 939f3be..0000000
--- a/trunk/src/java/org/apache/lenya/ac/UserType.java
+++ /dev/null
@@ -1,115 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-/**
- * A user type to be supported by the UserManager
- * Note: the types are configured through the access control configuration
- *
- * @version $Id$
- */
-public class UserType {
- private String key;
- private String className;
- private String createUseCase;
-
- /**
- * Ctor.
- */
- public UserType() {
- // do nothing
- }
-
- /**
- * Ctor.
- * @param _key The key.
- * @param _className The class name.
- * @param _createUseCase The create usecase.
- */
- public UserType(String _key, String _className, String _createUseCase) {
- this.key = _key;
- this.className = _className;
- this.createUseCase = _createUseCase;
- }
-
- /**
- * Get the key to be used for this type.
- * This key can be used for a dictionary entry for the user interface.
- * @return a <code>String</code>
- */
- public String getKey() {
- return this.key;
- }
-
- /**
- * Set the key to be used for this type.
- * This key can be used for a dictionary entry for the user interface.
- * @param _key the new key
- */
- public void setKey(String _key) {
- this.key = _key;
- }
-
- /**
- * Get the name of the class responsible for implementing this
- * type of user. Note that in current version, this field is for
- * information only; in later versions, it might be used for
- * introspection and dynamic script creation.
- * @see org.apache.lenya.ac.file.FileUser
- * @see org.apache.lenya.ac.ldap.LDAPUser
- * @return a <code>String</code> the name of the class
- */
- public String getClassName() {
- return this.className;
- }
-
- /**
- * Set the name of the class responsible for implementing this
- * type of user. Note that in current version, this field is for
- * information only; in later versions, it might be used for
- * introspection and dynamic flowscript creation.
- * @param _className the new className
- */
- public void setClassName(String _className) {
- this.className = _className;
- }
-
- /**
- * Get the createUseCase name to be used when a user of this type
- * is to be created.
- * This name will be used in the flowscript (currently: user-admin.js),
- * in order to distinguish between different types.
- * @return a <code>String</code> the name of the use case in the flowscript
- */
- public String getCreateUseCase() {
- return this.createUseCase;
- }
-
- /**
- * Set the createUseCase name to be used when a user of this type
- * is to be created.
- * This name will be used in the flowscript (currently: user-admin.js),
- * in order to distinguish between different types.
- * @param _createUseCase the new createUseCase
- */
- public void setCreateUseCase(String _createUseCase) {
- this.createUseCase = _createUseCase;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/ac/World.java b/trunk/src/java/org/apache/lenya/ac/World.java
deleted file mode 100644
index baf5fbd..0000000
--- a/trunk/src/java/org/apache/lenya/ac/World.java
+++ /dev/null
@@ -1,62 +0,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.
- *
- */
-
-package org.apache.lenya.ac;
-
-import java.io.Serializable;
-import java.util.Collections;
-
-/**
- * The world.
- * @version $Id$
- */
-public final class World implements Identifiable, Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates a new World object.
- */
- private World() {
- // do nothing
- }
-
- private static World instance;
-
- /**
- * Returns the singleton world object.
- * @return A world object.
- */
- public static World getInstance() {
- if (instance == null) {
- instance = new World();
- }
-
- return instance;
- }
-
- /**
- * @see org.apache.lenya.ac.Accreditable#getAccreditables()
- */
- public Accreditable[] getAccreditables() {
- return (Accreditable[]) Collections.singleton(this).toArray(new Accreditable[1]);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/ac/PolicyUtil.java b/trunk/src/java/org/apache/lenya/cms/ac/PolicyUtil.java
deleted file mode 100644
index 5d48e1a..0000000
--- a/trunk/src/java/org/apache/lenya/cms/ac/PolicyUtil.java
+++ /dev/null
@@ -1,164 +0,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.
- *
- */
-
-package org.apache.lenya.cms.ac;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.List;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.AccessControllerResolver;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.UserManager;
-
-/**
- * Policy utility class.
- */
-public final class PolicyUtil {
-
- /**
- * Fetches the stored roles from the request.
- * @param request The request.
- * @return A role array.
- * @throws AccessControlException If the request does not contain the roles
- * list.
- */
- public static final Role[] getRoles(Request request) throws AccessControlException {
- List roleList = (List) request.getAttribute(Role.class.getName());
-
- if (roleList == null) {
- StringBuffer buf = new StringBuffer();
- buf.append(" URI: [" + request.getRequestURI() + "]\n");
- for (Enumeration e = request.getParameterNames(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
- buf.append(" Parameter: [" + key + "] = [" + request.getParameter(key) + "]\n");
- }
-
- throw new AccessControlException("Request [" + request + "] does not contain roles: \n"
- + buf.toString());
- }
-
- Role[] roles = (Role[]) roleList.toArray(new Role[roleList.size()]);
- return roles;
- }
-
- /**
- * @param manager The service manager.
- * @param webappUrl The web application URL.
- * @param userId The user ID.
- * @param logger The logger.
- * @return A user.
- * @throws AccessControlException if an error occurs.
- */
- public static final User getUser(ServiceManager manager, String webappUrl,
- String userId, Logger logger) throws AccessControlException {
- ServiceSelector selector = null;
- AccessControllerResolver resolver = null;
- AccessController controller = null;
- try {
- selector = (ServiceSelector) manager.lookup(AccessControllerResolver.ROLE + "Selector");
- resolver = (AccessControllerResolver) selector
- .select(AccessControllerResolver.DEFAULT_RESOLVER);
- controller = resolver.resolveAccessController(webappUrl);
-
- AccreditableManager accreditableManager = controller.getAccreditableManager();
- UserManager userManager = accreditableManager.getUserManager();
-
- return userManager.getUser(userId);
- } catch (ServiceException e) {
- throw new AccessControlException(e);
- } finally {
- if (selector != null) {
- if (resolver != null) {
- if (controller != null) {
- resolver.release(controller);
- }
- selector.release(resolver);
- }
- manager.release(selector);
- }
- }
-
- }
-
- /**
- * @param manager The service manager.
- * @param webappUrl The web application URL.
- * @param role The ID of the role.
- * @param logger The logger to use.
- * @return All users which have the role on this URL.
- * @throws AccessControlException if an error occurs.
- */
- public static final User[] getUsersWithRole(ServiceManager manager, String webappUrl,
- String role, Logger logger) throws AccessControlException {
- ServiceSelector selector = null;
- AccessControllerResolver resolver = null;
- AccessController controller = null;
- try {
- selector = (ServiceSelector) manager.lookup(AccessControllerResolver.ROLE + "Selector");
- resolver = (AccessControllerResolver) selector
- .select(AccessControllerResolver.DEFAULT_RESOLVER);
- controller = resolver.resolveAccessController(webappUrl);
-
- AccreditableManager accreditableManager = controller.getAccreditableManager();
- UserManager userManager = accreditableManager.getUserManager();
- User[] users = userManager.getUsers();
- List usersWithRole = new ArrayList();
- PolicyManager policyManager = controller.getPolicyManager();
-
- Role roleObject = accreditableManager.getRoleManager().getRole(role);
-
- for (int i = 0; i < users.length; i++) {
- Identity identity = new Identity(logger);
- identity.addIdentifiable(users[i]);
- Role[] roles = policyManager.getGrantedRoles(accreditableManager, identity,
- webappUrl);
- if (Arrays.asList(roles).contains(roleObject)) {
- usersWithRole.add(users[i]);
- }
- }
-
- return (User[]) usersWithRole.toArray(new User[usersWithRole.size()]);
- } catch (ServiceException e) {
- throw new AccessControlException(e);
- } finally {
- if (selector != null) {
- if (resolver != null) {
- if (controller != null) {
- resolver.release(controller);
- }
- selector.release(resolver);
- }
- manager.release(selector);
- }
- }
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/DiscoverCheckoutAction.java b/trunk/src/java/org/apache/lenya/cms/cocoon/acting/DiscoverCheckoutAction.java
deleted file mode 100644
index e7fb52d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/DiscoverCheckoutAction.java
+++ /dev/null
@@ -1,53 +0,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.
- *
- */
-
-package org.apache.lenya.cms.cocoon.acting;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.cms.repository.Node;
-
-
-/**
- * An action that tests if a document is already checked out by a given user.
- * If it isn't, a check out will be tried.
- */
-public class DiscoverCheckoutAction extends RevisionControllerAction {
-
- /**
- * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
- */
- public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String src,
- Parameters parameters) throws Exception {
- super.act(redirector, resolver, objectModel, src, parameters);
-
- HashMap actionMap = new HashMap();
- Node node = getNode();
-
- if (node.isCheckedOut()) {
- actionMap.put("filename", node.getSourceURI());
- actionMap.put("user", node.getCheckoutUserId());
- return actionMap;
- }
- return null;
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/LanguageExistsAction.java b/trunk/src/java/org/apache/lenya/cms/cocoon/acting/LanguageExistsAction.java
deleted file mode 100644
index 10b98e8..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/LanguageExistsAction.java
+++ /dev/null
@@ -1,61 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.acting;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.acting.ServiceableAction;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Action that checks if the current URL represents an existing document.
- */
-public class LanguageExistsAction extends ServiceableAction {
-
- /**
- * Check if the current URL represents an existing document.
- * @return an empty <code>Map</code> if there is a version of this document for the current
- * language, <code>null</code> otherwise.
- * @throws Exception if an error occurs
- */
- public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source,
- Parameters parameters) throws Exception {
-
- Request request = ObjectModelHelper.getRequest(objectModel);
- DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
-
- String url = ServletHelper.getWebappURI(request);
- if (factory.isDocument(url)) {
- return Collections.unmodifiableMap(Collections.EMPTY_MAP);
- }
- else {
- return null;
- }
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ReservedCheckinAction.java b/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ReservedCheckinAction.java
deleted file mode 100644
index e05391b..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ReservedCheckinAction.java
+++ /dev/null
@@ -1,83 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.acting;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Checkin document
- */
-public class ReservedCheckinAction extends RevisionControllerAction {
- /**
- * Checkin document
- * @return HashMap with checkin parameters
- * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector,
- * org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String,
- * org.apache.avalon.framework.parameters.Parameters)
- */
- public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String src,
- Parameters parameters) throws Exception {
- super.act(redirector, resolver, objectModel, src, parameters);
-
- try {
- Request request = ObjectModelHelper.getRequest(objectModel);
- Identity identity = (Identity) request.getSession().getAttribute(Identity.class.getName());
- Session session = RepositoryUtil.createSession(this.manager, identity, true);
-
- DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
- String url = ServletHelper.getWebappURI(request);
- if (factory.isDocument(url)) {
- Node node = factory.getFromURL(url).getRepositoryNode();
- if (node.isCheckedOutBySession(session)) {
- node.checkin();
- }
- }
- else {
- throw new RuntimeException("The URL [" + url + "] doesn't represent a document.");
- }
-
- } catch (RepositoryException e) {
- getLogger().error("Could not check in node: ", e);
- Map actionMap = new HashMap();
- actionMap.put("exception", "genericException");
- actionMap.put("filename", getNode().getSourceURI());
- actionMap.put("message", e.getMessage());
- return actionMap;
- }
-
- return null;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ReservedCheckoutAction.java b/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ReservedCheckoutAction.java
deleted file mode 100644
index 6a79a2b..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ReservedCheckoutAction.java
+++ /dev/null
@@ -1,70 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.acting;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.util.Assert;
-
-/**
- * Action doing reserved checkout
- */
-public class ReservedCheckoutAction extends RevisionControllerAction {
-
- /**
- * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
- */
- public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String src,
- Parameters parameters) throws Exception {
- super.act(redirector, resolver, objectModel, src, parameters);
-
- HashMap actionMap = new HashMap();
-
- //check out
- try {
-
- Node node = getNode();
- String username = getUsername();
-
- Assert.notNull("node", node);
- Assert.notNull("username", username);
-
- if (!node.isCheckedOutBySession(node.getSession())) {
- node.checkout();
- }
- } catch (RepositoryException e) {
- actionMap.put("exception", "genericException");
- actionMap.put("filename", getNode().getSourceURI());
- actionMap.put("message", "" + e.getMessage());
- getLogger().error("The node " + getNode().getSourceURI() + " couldn't be checked out: ", e);
-
- return actionMap;
- }
-
- return null;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ReservedCheckoutTestAction.java b/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ReservedCheckoutTestAction.java
deleted file mode 100644
index e08c29f..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ReservedCheckoutTestAction.java
+++ /dev/null
@@ -1,71 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.acting;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.RepositoryException;
-
-
-/**
- * An action that tests if a document is already checked out by a given user.
- * If it isn't, a check out will be tried.
- */
-
-public class ReservedCheckoutTestAction extends RevisionControllerAction {
-
- /**
- * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
- */
- public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String src,
- Parameters parameters) throws Exception {
- super.act(redirector, resolver, objectModel, src, parameters);
-
- HashMap actionMap = new HashMap();
-
- try {
- Node node = getNode();
-
- if (!node.isCheckedOut() || !node.getCheckoutUserId().equals(getUsername())) {
- //check out
- getNode().checkout();
- }
- } catch (RepositoryException e) {
- actionMap.put("exception", "RepositoryException");
- actionMap.put("filename", getNode().getSourceURI());
-
- return actionMap;
- } catch (Exception e) {
- actionMap.put("exception", "genericException");
- actionMap.put("filename", getNode().getSourceURI());
- actionMap.put("message", e.getMessage());
- getLogger().error(".act(): The node " + getNode().getSourceURI() + " couldn't be checked out: ", e);
-
- return actionMap;
- }
- return null;
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ResourceExistsAction.java b/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ResourceExistsAction.java
deleted file mode 100644
index 24fe72d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/ResourceExistsAction.java
+++ /dev/null
@@ -1,89 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.acting;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.acting.AbstractAction;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.TraversableSource;
-
-
-/**
- * This action simply checks to see if a given resource exists. It checks
- * whether the specified in the src attribute source exists or not.
- * The action returns empty <code>Map</code> if it exists, null otherwise.
- * <p>Instead of src attribute, source can be specified using
- * parameter named 'url' (this is old syntax).
- * <p>In order to differentiate between files and directories, the type can be specified
- * using the parameter 'type' (<map:parameter name="type" value="file"/> or
- * <map:parameter name="type" value="directory"/>). The parameter 'type' is optional.
- * <p>
- * <strong>Note:</strong> {@link org.apache.cocoon.selection.ResourceExistsSelector}
- * should be preferred to this component, as the semantics of a Selector better
- * match the supplied functionality.
- */
-public class ResourceExistsAction extends AbstractAction implements ThreadSafe {
- /**
- * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
- */
- public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source,
- Parameters parameters) throws Exception {
- String url = parameters.getParameter("url", source);
- String type = parameters.getParameter("type", "resource");
- Source src = null;
-
- try {
- src = resolver.resolveURI(url);
-
- if (src.exists()) {
-
- boolean isCollection = false;
- if (src instanceof TraversableSource) {
- TraversableSource traversableSource = (TraversableSource) src;
- isCollection = traversableSource.isCollection();
- }
-
- boolean exists = type.equals("resource")
- || type.equals("file") && !isCollection
- || type.equals("directory") && isCollection;
-
- if (exists) {
- getLogger().debug(type + " exists: " + src.getURI());
- return Collections.EMPTY_MAP;
- }
- }
- getLogger().debug(".act(): Resource " + source + " as type \"" + type +
- "\" does not exist");
- } finally {
- if (src != null) {
- resolver.release(src);
- }
- }
-
- return null;
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/RevisionControllerAction.java b/trunk/src/java/org/apache/lenya/cms/cocoon/acting/RevisionControllerAction.java
deleted file mode 100644
index 818ee80..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/acting/RevisionControllerAction.java
+++ /dev/null
@@ -1,183 +0,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.
- *
- */
-
-package org.apache.lenya.cms.cocoon.acting;
-
-import java.io.File;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.acting.ServiceableAction;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Session;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.PageEnvelope;
-import org.apache.lenya.cms.publication.PageEnvelopeFactory;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.rc.RCEnvironment;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-
-/**
- * Revision controller action.
- *
- * @version $Id: RevisionControllerAction.java 487290 2006-12-14 18:18:35Z
- * andreas $
- */
-public class RevisionControllerAction extends ServiceableAction {
-
- private String rcmlDirectory = null;
- private String backupDirectory = null;
- private String username = null;
- private Node node = null;
-
- /**
- * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector,
- * org.apache.cocoon.environment.SourceResolver, java.util.Map,
- * java.lang.String, org.apache.avalon.framework.parameters.Parameters)
- */
- public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String src,
- Parameters parameters) throws Exception {
- // Get request object
- Request request = ObjectModelHelper.getRequest(objectModel);
-
- if (request == null) {
- getLogger().error(".act(): No request object");
-
- return null;
- }
-
- PageEnvelope envelope = null;
- Publication publication;
-
- try {
- publication = PublicationUtil.getPublication(this.manager, request);
- } catch (Exception e) {
- throw new AccessControlException(e);
- }
- org.apache.lenya.cms.repository.Session repoSession = RepositoryUtil.getSession(
- this.manager, request);
-
- DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, repoSession);
- Document document = null;
-
- try {
- publication = PublicationUtil.getPublication(this.manager, objectModel);
- envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(factory, objectModel,
- publication);
- document = envelope.getDocument();
- } catch (Exception e) {
- getLogger().error("Resolving page envelope failed: ", e);
- throw e;
- }
-
- // get Parameters for RC
- String publicationPath = publication.getDirectory().getCanonicalPath();
- RCEnvironment rcEnvironment = RCEnvironment.getInstance(publication.getServletContext()
- .getCanonicalPath(), getLogger());
- this.rcmlDirectory = rcEnvironment.getRCMLDirectory();
- this.rcmlDirectory = publicationPath + File.separator + this.rcmlDirectory;
- this.backupDirectory = rcEnvironment.getBackupDirectory();
- this.backupDirectory = publicationPath + File.separator + this.backupDirectory;
-
- // Get session
- Session session = request.getSession(false);
-
- if (session == null) {
- getLogger().error(".act(): No session object");
-
- return null;
- }
-
- Identity identity = (Identity) session.getAttribute(Identity.class.getName());
- getLogger().debug(".act(): Identity: " + identity);
-
- // FIXME: hack because of the uri for the editor bitflux. The filename
- // cannot be get from
- // the page-envelope
-
- String documentid = document.getPath();
- int bx = documentid.lastIndexOf("-bxe");
-
- if (bx > 0) {
- String language = document.getLanguage();
-
- int l = documentid.length();
- int bxLength = "-bxe".length();
- int lang = documentid.lastIndexOf("_", bx);
- int langLength = bx - lang;
-
- if (bx > 0 && bx + bxLength <= l) {
- documentid = documentid.substring(0, bx) + documentid.substring(bx + bxLength, l);
-
- if (lang > 0 && langLength + lang < l) {
- language = documentid.substring(lang + 1, lang + langLength);
- documentid = documentid.substring(0, lang)
- + documentid.substring(lang + langLength, l - bxLength);
- }
- }
-
- Document srcDoc = factory.get(publication, document.getArea(), documentid, language);
- this.node = srcDoc.getRepositoryNode();
-
- } else {
- this.node = document.getRepositoryNode();
- }
-
- this.username = null;
-
- if (identity != null) {
- User user = identity.getUser();
- if (user != null) {
- this.username = user.getId();
- }
- } else {
- getLogger().error(".act(): No identity yet");
- }
-
- getLogger().debug(".act(): Username: " + this.username);
-
- return null;
- }
-
- /**
- * Get the node.
- * @return the node
- */
- protected Node getNode() {
- return this.node;
- }
-
- /**
- * Get the user name.
- * @return the user name
- */
- protected String getUsername() {
- return this.username;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/context/ContextUtility.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/context/ContextUtility.java
deleted file mode 100644
index 94b4c5a..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/context/ContextUtility.java
+++ /dev/null
@@ -1,82 +0,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.
- */
-package org.apache.lenya.cms.cocoon.components.context;
-
-import java.util.Map;
-
-import org.apache.avalon.framework.component.Component;
-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.logger.AbstractLogEnabled;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Response;
-
-/**
- * Utility class for getting the context, request, response and
- * object model of the current request.
- */
-public class ContextUtility extends AbstractLogEnabled implements
- Component, Contextualizable {
- /**
- * The component's role.
- */
- public static final String ROLE = ContextUtility.class.getName();
-
- protected Context context;
-
-
- /**
- * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
- */
- public void contextualize(Context context) throws ContextException {
- this.context = context;
- }
-
- /**
- * Get the context object of the current request.
- * @return The context object of the current request.
- */
- public Context getContext() {
- return context;
- }
-
- /**
- * Get the request object of the current request.
- * @return The request object of the current request.
- */
- public Request getRequest() {
- return ContextHelper.getRequest(context);
- }
-
- /**
- * Get the response object of the current request.
- * @return The response object of the current request.
- */
- public Response getResponse() {
- return ContextHelper.getResponse(context);
- }
-
- /**
- * Get the object model of the current request.
- * @return The object model of the current request.
- */
- public Map getObjectModel() {
- return ContextHelper.getObjectModel(context);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/AbstractPageEnvelopeModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/AbstractPageEnvelopeModule.java
deleted file mode 100644
index b0978b4..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/AbstractPageEnvelopeModule.java
+++ /dev/null
@@ -1,104 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.io.File;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.cocoon.environment.Context;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.PageEnvelope;
-import org.apache.lenya.cms.publication.PageEnvelopeFactory;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Abstract superclass for classes which need access to the page envelope.
- *
- * The web application URL can be provided in the attribute name, separated by a colon (":").
- */
-public abstract class AbstractPageEnvelopeModule extends OperationModule {
-
- /**
- * Get the the page envelope for the given objectModel.
- * @param objectModel the objectModel for which the page enevelope is requested.
- * @param name The attribute name.
- * @return a <code>PageEnvelope</code>
- * @throws ConfigurationException if the page envelope could not be instantiated.
- */
- protected PageEnvelope getEnvelope(Map objectModel, String name) throws ConfigurationException {
-
- String webappUrl = null;
- Request request = ObjectModelHelper.getRequest(objectModel);
-
- PageEnvelope envelope = (PageEnvelope) request.getAttribute(PageEnvelope.class.getName());
- if (envelope == null) {
-
- String[] snippets = name.split(":");
- if (snippets.length > 1) {
- webappUrl = snippets[1];
- } else {
- webappUrl = ServletHelper.getWebappURI(request);
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Resolving page envelope for URL [" + webappUrl + "]");
- }
-
- String contextPath = request.getContextPath();
- Context context = ObjectModelHelper.getContext(objectModel);
- String servletContextPath = context.getRealPath("");
-
- try {
- DocumentFactory factory = getDocumentFactory();
- Publication pub = null;
- String pubId = new URLInformation(webappUrl).getPublicationId();
- if (pubId != null && factory.existsPublication(pubId)) {
- pub = factory.getPublication(pubId);
- }
- envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(
- factory,
- contextPath,
- webappUrl,
- new File(servletContextPath),
- pub);
- } catch (Exception e) {
- throw new ConfigurationException("Resolving page envelope failed: ", e);
- }
- request.setAttribute(PageEnvelope.class.getName(), envelope);
- }
- return envelope;
- }
-
- /**
- * @param name The original attribute name.
- * @return The attribute name without URL attachment.
- */
- protected String getAttributeName(String name) {
- final String[] snippets = name.split(":");
- return snippets[0];
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DateConverterModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DateConverterModule.java
deleted file mode 100644
index 583cf0c..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DateConverterModule.java
+++ /dev/null
@@ -1,64 +0,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.
- */
-
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.components.modules.input.AbstractInputModule;
-
-/**
- * The DateConverterModule converts a date string from one format into
- * another format.
- * The conversion is defined by the nested elements <src-pattern/> and
- * <pattern/> of the module declaration.
- *
- */
-public class DateConverterModule extends AbstractInputModule implements ThreadSafe {
-
- public Object getAttribute(String name, Configuration modeConf, Map objectModel) throws ConfigurationException {
-
- String srcPattern = (String) this.settings.get("src-pattern");
- String pattern = (String) this.settings.get("pattern");
-
- if (modeConf != null) {
- srcPattern = modeConf.getChild("src-pattern").getValue(srcPattern);
- pattern = modeConf.getChild("pattern").getValue(pattern);
- }
-
- if (srcPattern==null) {
- throw new ConfigurationException("Source date pattern not specified.");
- }
- if (pattern==null) {
- throw new ConfigurationException("Date pattern not specified.");
- }
-
- try {
- SimpleDateFormat srcFormat = new SimpleDateFormat(srcPattern);
- SimpleDateFormat format = new SimpleDateFormat(pattern);
- Date date = srcFormat.parse(name);
- return format.format(date);
- } catch (Exception e) {
- throw new ConfigurationException("Could not convert date: "+name, e);
- }
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DocumentInfoModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DocumentInfoModule.java
deleted file mode 100644
index a2701c9..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DocumentInfoModule.java
+++ /dev/null
@@ -1,209 +0,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.
- *
- */
-
-/* $Id:$ */
-
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-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.components.modules.input.AbstractInputModule;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * Input module to get document information.
- * {doc-info:{publication-id}:{area}:{uuid}:{document-language}:{property}} where {property} may be:
- * <ul>
- * <li><strong><code>contentLength</code></strong> - the content length (number of bytes).</li>
- * <li><strong><code>expires</code></strong> - the expiration date in ISO 8601 format.</li>
- * <li><strong><code>lastModified</code></strong> - the last modification date in ISO 8601
- * format.</li>
- * <li><strong><code>mimeType</code></strong> - the MIME type</li>
- * <li><strong><code>nodeName</code></strong> - the name of the node in the site structure</li>
- * <li><strong><code>path</code></strong> - the path in the site structure (starting with a
- * slash) or an empty string if the document is not referenced in the site structure.</li>
- * <li><strong><code>resourceType</code></strong> - the name of the resource type</li>
- * <li><strong><code>sourceExtension</code></strong> - the source extension</li>
- * <li><strong><code>visibleInNav</code></strong> - <code>true</code> if the document's node
- * is visible in the navigation, <code>false</code> otherwise.</li>
- * <li><strong><code>webappUrl</code></strong> - the web application URL of the document or
- * an empty string if the document is not referenced in the site structure.</li>
- * </ul>
- */
-public class DocumentInfoModule extends AbstractInputModule implements Serviceable {
-
- protected ServiceManager manager;
-
- // Input module parameters:
- protected final static String PARAM_PUBLICATION_ID = "publication-id";
- protected final static String PARAM_AREA = "area";
- protected final static String PARAM_UUID = "uuid";
- protected final static String PARAM_DOCUMENT_LANGUAGE = "document-language";
- protected final static String PARAM_PROPERTY = "property";
- protected final static String PARAM_REVISION = "revision";
- protected final static int MIN_MANDATORY_PARAMS = 5;
-
- protected final static String UUID = "uuid";
- protected final static String LANGUAGE = "language";
- protected final static String PATH = "path";
- protected final static String NODE_NAME = "nodeName";
- protected final static String WEBAPP_URL = "webappUrl";
- protected final static String DOCUMENT_URL = "documentUrl";
- protected final static String RESOURCE_TYPE = "resourceType";
- protected final static String LAST_MODIFIED = "lastModified";
- protected final static String MIME_TYPE = "mimeType";
- protected final static String CONTENT_LENGTH = "contentLength";
- protected final static String SOURCE_EXTENSION = "sourceExtension";
- protected final static String EXPIRES = "expires";
- protected final static String VISIBLE_IN_NAVIGATION = "visibleInNav";
-
- protected final static String[] PARAMS = { PARAM_PUBLICATION_ID, PARAM_AREA, PARAM_UUID,
- PARAM_DOCUMENT_LANGUAGE, PARAM_PROPERTY, PARAM_REVISION };
-
- protected final static String META_RESOURCE_TYPE = "resourceType";
- protected final static String META_EXPIRES = "expires";
-
- protected SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
-
- /**
- * Parse the parameters and return a document.
- * @param publicationId The publication ID.
- * @param area The area.
- * @param uuid The document UUID.
- * @param language The document language.
- * @param revision The revision.
- * @param objectModel The object model.
- * @return The document object created.
- * @throws ConfigurationException
- */
- protected Document getDocument(String publicationId, String area, String uuid, String language,
- int revision, Map objectModel) throws ConfigurationException {
- Document document = null;
-
- Request request = ObjectModelHelper.getRequest(objectModel);
-
- try {
- Session session = RepositoryUtil.getSession(this.manager, request);
- DocumentFactory docFactory = DocumentUtil.createDocumentFactory(this.manager, session);
- Publication pub = docFactory.getPublication(publicationId);
- document = docFactory.get(pub, area, uuid, language, revision);
- } catch (Exception e) {
- throw new ConfigurationException("Error getting document [" + publicationId + ":"
- + area + ":" + uuid + ":" + language + "]: " + e.getMessage(), e);
- }
- return document;
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object getAttribute(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- Object value = null;
-
- InputModuleParameters params = new InputModuleParameters(name, PARAMS, MIN_MANDATORY_PARAMS);
-
- try {
- int rev = -1;
- if (params.isParameter(PARAM_REVISION)) {
- String revision = params.getParameter(PARAM_REVISION);
- if (!revision.equals("")) {
- rev = Integer.valueOf(revision).intValue();
- }
- }
-
- Document document = getDocument(params.getParameter(PARAM_PUBLICATION_ID), params
- .getParameter(PARAM_AREA), params.getParameter(PARAM_UUID), params
- .getParameter(PARAM_DOCUMENT_LANGUAGE), rev, objectModel);
-
- String attribute = params.getParameter(PARAM_PROPERTY);
-
- if (attribute.equals(RESOURCE_TYPE)) {
- value = document.getResourceType().getName();
- } else if (attribute.equals(LAST_MODIFIED)) {
- value = this.dateFormat.format(new Date(document.getLastModified()));
- } else if (attribute.equals(MIME_TYPE)) {
- value = document.getMimeType();
- } else if (attribute.equals(CONTENT_LENGTH)) {
- value = Long.toString(document.getContentLength());
- } else if (attribute.equals(SOURCE_EXTENSION)) {
- value = document.getSourceExtension();
- } else if (attribute.equals(LANGUAGE)) {
- value = document.getLanguage();
- } else if (attribute.equals(PATH)) {
- value = document.getPath();
- } else if (attribute.equals(NODE_NAME)) {
- value = document.getName();
- } else if (attribute.equals(UUID)) {
- value = document.getUUID();
- } else if (attribute.equals(WEBAPP_URL)) {
- value = document.getCanonicalWebappURL();
- } else if (attribute.equals(DOCUMENT_URL)) {
- value = document.getCanonicalDocumentURL();
- } else if (attribute.equals(EXPIRES)) {
- try {
- Date expires = document.getExpires();
- value = this.dateFormat.format(expires);
- } catch (DocumentException e) {
- throw new ConfigurationException("Error getting expires date from document.", e);
- }
- } else if (attribute.equals(VISIBLE_IN_NAVIGATION)) {
- value = Boolean.toString(isVisibleInNavigation(document));
- } else {
- throw new ConfigurationException("Attribute '" + attribute + "' not supported ["
- + name + "]");
- }
- } catch (ConfigurationException e) {
- throw e;
- } catch (Exception e) {
- throw new ConfigurationException("Error getting input module parameters.", e);
- }
-
- return value;
- }
-
- protected boolean isVisibleInNavigation(Document document) throws ConfigurationException {
- try {
- return document.getLink().getNode().isVisible();
- } catch (DocumentException e) {
- throw new ConfigurationException("Obtaining navigation visibility failed [" + document
- + "]: " + e.getMessage(), e);
- }
-
- }
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DocumentURLModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DocumentURLModule.java
deleted file mode 100644
index 43fda03..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DocumentURLModule.java
+++ /dev/null
@@ -1,91 +0,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.
- *
- */
-
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.lenya.cms.publication.util.DocumentHelper;
-
-/**
- * <p>
- * This module constructs the document url taking into account difference in the language .version
- * being created and used.
- * </p>
- * <p>
- * Example:
- * <code>{document-url:{page-envelope:area}:{page-envelope:document-uuid}:{page-envelope:document-language}}</code>
- * </p>
- * @version $Id$
- */
-public class DocumentURLModule extends AbstractPageEnvelopeModule {
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object getAttribute(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
-
- String url;
-
- final String[] attributes = name.split(":");
-
- if (attributes.length < 3) {
- throw new ConfigurationException("Invalid number of parameters: " + attributes.length
- + ". Expected 3 (area, document-uuid, language)");
- }
-
- final String area = attributes[0];
- final String uuid = attributes[1];
- final String language = attributes[2];
-
- try {
- DocumentHelper helper = new DocumentHelper(this.manager, objectModel);
- url = helper.getDocumentUrl(uuid, area, language);
- } catch (Exception e) {
- throw new ConfigurationException("Resolving attribute [" + name + "] failed: ", e);
- }
-
- return url;
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration,
- * java.util.Map)
- */
- public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- return Collections.EMPTY_SET.iterator();
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeValues(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- Object[] objects = { getAttribute(name, modeConf, objectModel) };
- return objects;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/FallbackModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/FallbackModule.java
deleted file mode 100644
index a972be2..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/FallbackModule.java
+++ /dev/null
@@ -1,225 +0,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.
- *
- */
-
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.SourceUtil;
-
-/**
- * <p>
- * This module checks if a file exists in a publiation, and if not, it chooses the core file. The
- * attribute name must a path relatively to the <code>webapps/lenya/lenya</code> directory.
- * </p>
- * <p>
- * Example: <code>{fallback:xslt/style.xsl}</code> looks if
- * <code>lenya/pubs/(publication-id)/lenya/xslt/style.xsl</code> exists, and if not, it uses
- * <code>lenya/xslt/style.xsl</code>.
- *
- * @version $Id$
- */
-public class FallbackModule extends AbstractPageEnvelopeModule {
-
- private String[] baseUris;
-
- /**
- * <code>PATH_PREFIX</code> The path prefix from the webapp
- */
- public static final String PATH_PREFIX = "lenya/";
-
- protected static final String ELEMENT_PATH = "directory";
-
- protected static final String ATTRIBUTE_SRC = "src";
-
- /**
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration conf) throws ConfigurationException {
- super.configure(conf);
-
- Configuration[] pathConfigs = conf.getChildren(ELEMENT_PATH);
- List baseUriList = new ArrayList();
-
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
- Source source = null;
- for (int i = 0; i < pathConfigs.length; i++) {
- String uri = pathConfigs[i].getAttribute(ATTRIBUTE_SRC);
- try {
- source = resolver.resolveURI(uri);
- if (source.exists()) {
- File file = SourceUtil.getFile(source);
- if (file.isDirectory()) {
- baseUriList.add(uri);
- } else {
- getLogger().warn("Omitting path [" + uri + "] (not a directory).");
- }
- } else {
- getLogger().warn("Omitting path [" + uri + "] (does not exist).");
- }
- } catch (Exception e) {
- getLogger().error("Could not resolve path [" + uri + "]: ", e);
- throw e;
- } finally {
- if (source != null) {
- resolver.release(source);
- }
- }
- }
- } catch (Exception e) {
- throw new ConfigurationException("Configuring failed: ", e);
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- }
-
- this.baseUris = (String[]) baseUriList.toArray(new String[baseUriList.size()]);
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object getAttribute(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Resolving file for path [" + name + "]");
- }
-
- String resolvedUri = resolveURI(name, objectModel);
- return resolvedUri;
- }
-
- /**
- * Resolves the URI for a certain path.
- * @param path The path.
- * @param objectModel The object model.
- * @return A string.
- * @throws ConfigurationException if an error occurs.
- */
- protected String resolveURI(final String path, Map objectModel) throws ConfigurationException {
- String resolvedUri = null;
- String checkedUris = "\n";
-
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
-
- String[] _baseUris = getBaseURIs(objectModel, path);
- Source source = null;
- int i = 0;
- while (resolvedUri == null && i < _baseUris.length) {
- String uri = _baseUris[i] + "/" + path;
-
- checkedUris += uri + "\n";
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Trying to resolve URI [" + uri + "]");
- }
-
- try {
- source = resolver.resolveURI(uri);
- if (source.exists()) {
- resolvedUri = uri;
- } else {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Skipping URI [" + uri + "] (does not exist).");
- }
- }
- } catch (Exception e) {
- getLogger().error("Could not resolve URI [" + uri + "]: ", e);
- throw e;
- } finally {
- if (source != null) {
- resolver.release(source);
- }
- }
- i++;
- }
-
- } catch (Exception e) {
- throw new ConfigurationException("Resolving attribute [" + path + "] failed: ", e);
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- }
-
- if (resolvedUri == null) {
- /*
- throw new ConfigurationException("Could not resolve file for path [" + path + "]."
- + "\nChecked URIs:" + checkedUris);
- */
- resolvedUri = this.baseUris[this.baseUris.length - 1] + "/" + path;
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("No URI resolved, choosing last defined URI: [" + resolvedUri + "]");
- }
- }
- else {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Resolved URI: [" + resolvedUri + "]");
- }
- }
- return resolvedUri;
- }
-
- /**
- * Returns the base directory URIs in the order they should be traversed.
- * @param objectModel The object model.
- * @param attributeName The name of the module attribute.
- * @return An array of strings.
- * @throws ConfigurationException if an error occurs.
- */
- protected String[] getBaseURIs(Map objectModel, String attributeName) throws ConfigurationException {
- return this.baseUris;
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration,
- * java.util.Map)
- */
- public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- return Collections.EMPTY_SET.iterator();
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeValues(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- Object[] objects = { getAttribute(name, modeConf, objectModel) };
-
- return objects;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/InputModuleParameters.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/InputModuleParameters.java
deleted file mode 100644
index 2ab073d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/InputModuleParameters.java
+++ /dev/null
@@ -1,116 +0,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.
- *
- */
-
-/* $Id:$ */
-
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.parameters.ParameterException;
-import org.apache.avalon.framework.parameters.Parameters;
-
-/**
- * Input module parameter class.
- * Parses input module parameters and offers accessors for the parameters.
- * The parameters are expected to be separated by ":".
- */
-public class InputModuleParameters {
-
- protected final static char PARAM_SEPARATOR = ':';
-
- protected Parameters params;
- protected final String[] paramList;
-
- /**
- * Parse input module parameters.
- * @param parameters Parameter to be parsed.
- * @param paramList List of expected parameters.
- * @param minParams Minimum number of parameters expected.
- * @throws ConfigurationException if there is an error parsing the parameters.
- */
- public InputModuleParameters(String parameters, final String[] paramList, int minParams)
- throws ConfigurationException
- {
- params = new Parameters();
- this.paramList = (String[])paramList.clone();
- parseParameters(parameters, minParams);
- }
-
- /**
- * Parse parameters according to the parameter list passed.
- * @param parameters
- * @param minParams Minimum number of parameters.
- * @return Parameters object initialized with parsed parameters.
- * @throws ConfigurationException
- */
- protected Parameters parseParameters(String parameters, int minParams)
- throws ConfigurationException
- {
- // Parse parameters
- int start = 0;
- int end = parameters.indexOf(PARAM_SEPARATOR);
- for (int i=0; i<paramList.length; i++) {
- if (end != -1) {
- String paramToken = parameters.substring(start, end);
- params.setParameter(paramList[i], paramToken);
- start = end+1;
- end = parameters.indexOf(PARAM_SEPARATOR, start+1);
- } else {
- if ((i+1) < minParams) {
- // A mandatory parameter is missing.
- throw new ConfigurationException("Error parsing parameters: mandatory parameter '"
- + paramList[i] + "' not found [" + parameters + "]");
- } else if (i == 0) {
- // Zero or one parameter passed.
- if (parameters.length() != 0) {
- params.setParameter(paramList[i], parameters);
- }
- break;
- } else {
- // All parameters parsed except the last one.
- String paramToken = parameters.substring(start);
- if (paramToken.length() != 0) {
- params.setParameter(paramList[i], paramToken);
- }
- break;
- }
- }
- }
- return params;
- }
-
- /**
- * Get a parameter.
- * @param param Name of requested parameter.
- * @return Requested parameter.
- * @throws ParameterException if the specified parameter cannot be found
- */
- public String getParameter(String param) throws ParameterException
- {
- return params.getParameter(param);
- }
-
- /**
- * Does a parameter with given name exists?
- * @param param Parameter name.
- * @return True if parameters exists, otherwise false.
- */
- public boolean isParameter(String param) {
- return params.isParameter(param);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/MetaDataModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/MetaDataModule.java
deleted file mode 100644
index cb8c6fe..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/MetaDataModule.java
+++ /dev/null
@@ -1,150 +0,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.
- *
- */
-
-/* $Id: DublinCoreModule.java 169299 2005-05-09 12:00:43Z jwkaltz $ */
-
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.lenya.cms.metadata.Element;
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.metadata.MetaDataException;
-import org.apache.lenya.cms.metadata.MetaDataRegistry;
-import org.apache.lenya.cms.publication.Document;
-
-/**
- * <p>
- * Input module to access meta data values. Use the name of the element as
- * input module parameter.
- * </p>
- * <p>Configuration:</p>
- * <pre>
- * <component-instance logger="sitemap.modules.input.dublincore" name="[...]"
- * class="org.apache.lenya.cms.cocoon.components.modules.input.MetaDataModule"
- * namespace="[namespace URI of the element set]"/>
- * </pre>
- * <p>Usage examples:</p>
- * <ul>
- * <li><code>{dublincore:title}</code></li>
- * <li><code>{myMetData:myElementName}</code></li>
- * </ul>
- */
-public class MetaDataModule extends AbstractPageEnvelopeModule {
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object getAttribute(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- Object value;
-
- MetaData metaData = getCustomMetaData(objectModel);
-
- if (!metaData.isValidAttribute(name)) {
- throw new ConfigurationException("The attribute [" + name + "] is not supported!");
- }
-
- try {
- value = metaData.getFirstValue(name);
- } catch (MetaDataException e) {
- throw new ConfigurationException("Obtaining custom meta data value for [" + name
- + "] failed: ", e);
- }
-
- return value;
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration,
- * java.util.Map)
- */
- public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
- throws ConfigurationException {
-
- MetaDataRegistry registry = null;
- try {
- registry = (MetaDataRegistry) this.manager.lookup(MetaDataRegistry.ROLE);
- Element[] elements = registry.getElementSet(this.namespaceUri).getElements();
- String[] keys = new String[elements.length];
- for (int i = 0; i < keys.length; i++) {
- keys[i] = elements[i].getName();
- }
- return Arrays.asList(keys).iterator();
- } catch (Exception e) {
- throw new ConfigurationException(e.getMessage(), e);
- }
- finally {
- this.manager.release(registry);
- }
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeValues(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- Object[] values;
- MetaData metaData = getCustomMetaData(objectModel);
-
- if (!metaData.isValidAttribute(name)) {
- throw new ConfigurationException("The attribute [" + name + "] is not supported!");
- }
-
- try {
- values = metaData.getValues(name);
- } catch (MetaDataException e) {
- throw new ConfigurationException("Obtaining custom meta data value for [" + name
- + "] failed: ", e);
- }
-
- return values;
- }
-
- protected MetaData getCustomMetaData(Map objectModel) throws ConfigurationException {
- // FIXME: There seems to be no reason to pass the attribute name to get the page envelope.
- Document document = getEnvelope(objectModel, "").getDocument();
- if (document == null) {
- throw new ConfigurationException("There is no document for this page envelope!");
- }
- MetaData metaData = null;
- try {
- metaData = document.getMetaData(this.namespaceUri);
- } catch (MetaDataException e) {
- throw new ConfigurationException("Obtaining custom meta data value for ["
- + document + "] failed: ", e);
- }
- return metaData;
- }
-
- private String namespaceUri;
-
- public void configure(Configuration conf) throws ConfigurationException {
- super.configure(conf);
- this.namespaceUri = conf.getAttribute("namespace");
- }
-
-
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/OperationModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/OperationModule.java
deleted file mode 100644
index 1c3d08d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/OperationModule.java
+++ /dev/null
@@ -1,87 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import org.apache.avalon.framework.activity.Initializable;
-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.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.components.modules.input.AbstractInputModule;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * Super class for operation-based input modules.
- *
- * @version $Id$
- */
-public class OperationModule extends AbstractInputModule implements Serviceable,
- Initializable, Contextualizable {
-
- /**
- * Ctor.
- */
- public OperationModule() {
- super();
- }
-
- private DocumentFactory documentIdentityMap;
-
- private Request request;
-
- protected DocumentFactory getDocumentFactory() {
- if (this.documentIdentityMap == null) {
- try {
- Session session = RepositoryUtil.getSession(this.manager, this.request);
- this.documentIdentityMap = DocumentUtil.createDocumentFactory(this.manager, session);
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
- return this.documentIdentityMap;
- }
-
- protected ServiceManager manager;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager _manager) throws ServiceException {
- this.manager = _manager;
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Initializable#initialize()
- */
- public void initialize() throws Exception {
- // do nothing
- }
-
- public void contextualize(Context context) throws ContextException {
- this.request = ContextHelper.getRequest(context);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PageEnvelopeModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PageEnvelopeModule.java
deleted file mode 100644
index c6a1b49..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PageEnvelopeModule.java
+++ /dev/null
@@ -1,198 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.commons.lang.StringUtils;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.PageEnvelope;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.ResourceType;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Input module wrapping the page envelope. This module provides publication
- * related information such as document-uuid, area, publication-id.
- *
- * @see org.apache.lenya.cms.publication.PageEnvelope
- * @deprecated use DocumentInfoModule instead.
- */
-public class PageEnvelopeModule extends AbstractPageEnvelopeModule {
-
- protected static final String URI_PARAMETER_DOCTYPE = "doctype";
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration,
- * java.util.Map)
- */
- public Object getAttribute(final String attributeName, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
-
- final String name = getAttributeName(attributeName);
-
- if (!Arrays.asList(PageEnvelope.PARAMETER_NAMES).contains(name)) {
- throw new ConfigurationException("The attribute [" + name + "] is not supported!");
- }
-
- PageEnvelope envelope = getEnvelope(objectModel, attributeName);
- Object value = null;
-
- try {
- if (name.equals(PageEnvelope.AREA)) {
- value = envelope.getArea();
- } else if (name.equals(PageEnvelope.CONTEXT)) {
- value = envelope.getContext();
- } else if (name.equals(PageEnvelope.IS_PUBLICATION)) {
- value = Boolean.toString(envelope.getPublication() != null);
- } else if (name.equals(PageEnvelope.PUBLICATION_ID)) {
- Publication pub = envelope.getPublication();
- value = pub != null ? pub.getId() : "";
- } else if (name.equals(PageEnvelope.PUBLICATION)) {
- value = envelope.getPublication();
- } else if (name.equals(PageEnvelope.PUBLICATION_LANGUAGES_CSV)) {
- value = StringUtils.join(envelope.getPublication().getLanguages(), ',');
- } else if (name.equals(PageEnvelope.DEFAULT_LANGUAGE)) {
- value = envelope.getPublication().getDefaultLanguage();
- } else if (name.equals(PageEnvelope.LANGUAGE)) {
- value = envelope.getLanguage();
- } else if (name.equals(PageEnvelope.BREADCRUMB_PREFIX)) {
- value = envelope.getPublication().getBreadcrumbPrefix();
- } else if (name.equals(PageEnvelope.DOCUMENT_PATH)) {
- value = getPath(envelope, objectModel);
- } else {
- Document document = envelope.getDocument();
- if (document != null) {
- if (name.equals(PageEnvelope.DOCUMENT)) {
- value = document;
- } else if (name.equals(PageEnvelope.DOCUMENT_ID)) {
- getLogger().warn(
- "This attribute [ " + name + " ] is deprecated."
- + " Use document-path or document-uuid instead!");
- value = document.getUUID();
- } else if (name.equals(PageEnvelope.DOCUMENT_PARENT)) {
- value = document.getLocator().getParent().getPath();
- } else if (name.equals(PageEnvelope.DOCUMENT_NAME)) {
- value = document.getName();
- } else if (name.equals(PageEnvelope.DOCUMENT_LABEL)) {
- value = document.getLink().getLabel();
- } else if (name.equals(PageEnvelope.DOCUMENT_URL)) {
- value = document.getCanonicalDocumentURL();
- } else if (name.equals(PageEnvelope.DOCUMENT_URL_WITHOUT_LANGUAGE)) {
- value = document.getCanonicalWebappURL();
- } else if (name.equals(PageEnvelope.DOCUMENT_FILE)) {
- value = document.getFile();
- } else if (name.equals(PageEnvelope.DOCUMENT_EXTENSION)) {
- value = document.getExtension();
- } else if (name.equals(PageEnvelope.DOCUMENT_SOURCE_EXTENSION)) {
- value = document.getSourceExtension();
- } else if (name.equals(PageEnvelope.DOCUMENT_UUID)) {
- value = document.getUUID();
- } else if (name.equals(PageEnvelope.DOCUMENT_LANGUAGE)) {
- value = document.getLanguage();
- } else if (name.equals(PageEnvelope.DOCUMENT_LANGUAGES)) {
- value = document.getLanguages();
- } else if (name.equals(PageEnvelope.DOCUMENT_LANGUAGES_CSV)) {
- value = StringUtils.join(document.getLanguages(), ',');
- } else if (name.equals(PageEnvelope.DOCUMENT_LASTMODIFIED)) {
- Date date = new Date(document.getLastModified());
- value = new SimpleDateFormat(DATE_FORMAT).format(date);
- } else if (name.equals(PageEnvelope.DOCUMENT_TYPE)) {
- ResourceType resourceType = document.getResourceType();
- if (resourceType == null) {
- value = null;
- } else {
- value = resourceType.getName();
- }
- }
- }
- }
- } catch (final Exception e) {
- throw new ConfigurationException("Getting attribute for name [" + name + "] failed: ",
- e);
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Returning [" + name + "] = [" + value + "]");
- }
-
- return value;
- }
-
- protected String getPath(PageEnvelope envelope, Map objectModel) throws SiteException {
- String path;
- Document doc = envelope.getDocument();
- if (doc == null) {
- Publication pub = envelope.getPublication();
- Request request = ObjectModelHelper.getRequest(objectModel);
- String url = ServletHelper.getWebappURI(request);
- DocumentLocator loc;
- try {
- loc = pub.getDocumentBuilder().getLocator(pub.getFactory(), url);
- } catch (DocumentBuildException e) {
- throw new SiteException(e);
- }
- path = loc.getPath();
- } else {
- path = doc.getLocator().getPath();
- }
- return path;
- }
-
- /**
- * <code>DATE_FORMAT</code> The date format
- */
- public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss Z";
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration,
- * java.util.Map)
- */
- public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- return Arrays.asList(PageEnvelope.PARAMETER_NAMES).iterator();
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeValues(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration,
- * java.util.Map)
- */
- public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- Object[] objects = { getAttribute(name, modeConf, objectModel) };
-
- return objects;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PublicationFallbackModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PublicationFallbackModule.java
deleted file mode 100644
index e94a8e8..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PublicationFallbackModule.java
+++ /dev/null
@@ -1,60 +0,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.
- *
- */
-
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.lenya.cms.publication.PageEnvelope;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * Publication Fallback Module
- */
-public class PublicationFallbackModule extends FallbackModule {
-
- /**
- * Ctor.
- */
- public PublicationFallbackModule() {
- super();
- }
-
- /**
- * @see org.apache.lenya.cms.cocoon.components.modules.input.FallbackModule#getBaseURIs(java.util.Map,
- * java.lang.String)
- */
- protected String[] getBaseURIs(Map objectModel, String name) throws ConfigurationException {
- String[] superUris = super.getBaseURIs(objectModel, name);
- String[] uris = new String[superUris.length + 1];
-
- PageEnvelope envelope = getEnvelope(objectModel, name);
- String publicationId = envelope.getPublication().getId();
-
- String publicationUri = "context://" + Publication.PUBLICATION_PREFIX_URI + "/"
- + publicationId + "/lenya";
- uris[0] = publicationUri;
-
- for (int i = 0; i < superUris.length; i++) {
- uris[i + 1] = superUris[i];
- }
-
- return uris;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PublicationTemplateFallbackModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PublicationTemplateFallbackModule.java
deleted file mode 100644
index 16174d3..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PublicationTemplateFallbackModule.java
+++ /dev/null
@@ -1,118 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * This module uses publication templating to resolve the real path for a resource. The current
- * publication ID can be provided as a parameter: <code>{fallback:{pub-id}:foo/bar}</code>. This
- * is especially useful for cocoon:// request which are triggered from non-environment components
- * (e.g. the scheduler).
- *
- * @version $Id$
- */
-public class PublicationTemplateFallbackModule extends AbstractPageEnvelopeModule {
-
- /**
- * Ctor.
- */
- public PublicationTemplateFallbackModule() {
- super();
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object getAttribute(final String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Resolving publication template for file [" + name + "]");
- }
-
- String resolvedUri = null;
-
- try {
- String targetUri = null;
-
- // check if publication ID is provided in attribute name
- if (name.indexOf(":") > -1) {
- String[] parts = name.split(":");
- if (parts.length > 2) {
- throw new RuntimeException("The attribute may not contain more than one colons!");
- }
- String publicationId = parts[0];
- targetUri = parts[1];
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Publication ID provided explicitely: [" + publicationId
- + "]");
- }
-
- } else {
- targetUri = name;
- }
-
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
- resolvedUri = resolver.resolveURI("fallback://" + targetUri).getURI();
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- }
-
- } catch (final Exception e) {
- String message = "Resolving path [" + name + "] failed: ";
- getLogger().error(message, e);
- throw new ConfigurationException(message, e);
- }
- return resolvedUri;
- }
-
- /**
- * Returns the base URI for a certain publication.
- * @param publication The publication.
- * @return A string.
- */
- public static String getBaseURI(Publication publication) {
- String publicationUri = "context://" + Publication.PUBLICATION_PREFIX_URI + "/"
- + publication.getId();
- return publicationUri;
- }
-
- /**
- * Returns the base URI for a certain publication including the prefix "lenya".
- * @param publication The publication.
- * @return A string.
- */
- protected String getLenyaBaseURI(Publication publication) {
- String publicationUri = "context://" + Publication.PUBLICATION_PREFIX_URI + "/"
- + publication.getId() + "/lenya";
- return publicationUri;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceExistsModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceExistsModule.java
deleted file mode 100644
index c40ab46..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceExistsModule.java
+++ /dev/null
@@ -1,109 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-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.components.modules.input.AbstractInputModule;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.excalibur.source.SourceResolver;
-
-/**
- * Checks if a certain resource exists and returns either the string "true" or "false".
- * @version $Id$
- */
-public class ResourceExistsModule extends AbstractInputModule implements Serviceable, Disposable {
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object getAttribute(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
-
- String resourceURI = name;
-
- Source source = null;
- boolean exists = false;
- try {
- source = this.resolver.resolveURI(resourceURI);
- exists = source.exists();
- } catch (SourceNotFoundException e) {
- exists = false;
- } catch (Exception e) {
- getLogger().warn("Exception resolving resource [" + resourceURI + "]", e);
- exists = false;
- } finally {
- if (source != null) {
- this.resolver.release(source);
- }
- }
-
- return Boolean.toString(exists);
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration,
- * java.util.Map)
- */
- public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- return Collections.EMPTY_SET.iterator();
- }
-
- private ServiceManager manager;
- private SourceResolver resolver;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager _manager) throws ServiceException {
- this.manager = _manager;
- this.resolver = (SourceResolver) _manager.lookup(SourceResolver.ROLE);
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- super.dispose();
- this.manager.release(this.resolver);
- this.resolver = null;
- this.manager = null;
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeValues(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- Object result = this.getAttribute(name, modeConf, objectModel);
- return (result == null ? null : new Object[] { result });
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java b/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
deleted file mode 100644
index 56c3326..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
+++ /dev/null
@@ -1,172 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Date;
-import java.text.SimpleDateFormat;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.cocoon.components.modules.input.AbstractInputModule;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.commons.lang.StringUtils;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.ResourceType;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * <p>
- * Resource type module.
- * </p>
- * <p>
- * The syntax is either <code>{resource-type:<attribute>}</code> (which uses the resource
- * type of the currenlty requested document) or
- * <code>{resource-type:<name>:<attribute>}</code> (which allows to access an
- * arbitrary resource type).
- * </p>
- * <p>
- * Attributes:
- * </p>
- * <ul>
- * <li><strong><code>expires</code></strong> - the expiration date in RFC 822/1123 format, see
- * {@link org.apache.lenya.cms.publication.ResourceType#getExpires()}</li>
- * <li><strong><code>schemaUri</code></strong> - see
- * {@link org.apache.lenya.xml.Schema#getURI()}</li>
- * <li><strong><code>httpSchemaUri</code></strong> - the URI to request the schema over HTTP, without Proxy and context (use {proxy:} around it).</li>
- * <li><strong><code>supportsFormat:{format}</code></strong> - true if the resource type
- * supports this format, false otherwise</li>
- * </ul>
- */
-public class ResourceTypeModule extends AbstractInputModule implements Serviceable {
-
- protected static final String SCHEMA_URI = "schemaUri";
- protected static final String HTTP_SCHEMA_URI = "httpSchemaUri";
- protected static final String EXPIRES = "expires";
- protected static final String SUPPORTS_FORMAT = "supportsFormat";
-
- public Object getAttribute(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- Object value = null;
-
- try {
- Request request = ObjectModelHelper.getRequest(objectModel);
- Session session = RepositoryUtil.getSession(this.manager, request);
-
- ResourceType resourceType;
- Publication pub = null;
- String attribute;
-
- String[] steps = name.split(":");
- if (steps.length == 1) {
- DocumentFactory docFactory = DocumentUtil.createDocumentFactory(this.manager,
- session);
- String webappUrl = ServletHelper.getWebappURI(request);
- Document document = docFactory.getFromURL(webappUrl);
- pub = document.getPublication();
-
- attribute = name;
- resourceType = document.getResourceType();
- } else {
- attribute = steps[1];
- String resourceTypeName = steps[0];
-
- ServiceSelector selector = null;
- try {
- selector = (ServiceSelector) this.manager
- .lookup(ResourceType.ROLE + "Selector");
- resourceType = (ResourceType) selector.select(resourceTypeName);
- } finally {
- this.manager.release(selector);
- }
- }
-
- if (attribute.startsWith("format-")) {
- String[] formatSteps = name.split("-");
- String format = formatSteps[1];
- value = resourceType.getFormatURI(format);
- } else if (attribute.equals(SCHEMA_URI)) {
- value = resourceType.getSchema().getURI();
- } else if (attribute.equals(HTTP_SCHEMA_URI)) {
- String uri = resourceType.getSchema().getURI();
- value = transformFallbackUriToHttp(pub.getId(), uri);
- } else if (attribute.equals(EXPIRES)) {
- Date expires = resourceType.getExpires();
- SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss zzz");
- value = sdf.format(expires);
- } else if (attribute.equals(SUPPORTS_FORMAT)) {
- String format = steps[steps.length - 1];
- String[] formats = resourceType.getFormats();
- return Boolean.toString(Arrays.asList(formats).contains(format));
- } else {
- throw new ConfigurationException("Attribute [" + name + "] not supported!");
- }
-
- } catch (Exception e) {
- throw new ConfigurationException("Resolving attribute [" + name + "] failed: ", e);
- }
-
- return value;
- }
-
- /**
- * Transforms a fallback URI for resources into a HTTP URL.
- *
- * Currently only supports module urls:
- *
- * fallback://lenya/modules/foo/resources/schemas/bar.rng ->
- * prefix/pubid/modules/foo/schemas/bar.rng
- *
- * FIXME: allow other kind of fallback URIs
- *
- * @param pubid publication id of the current document
- * @param prefix prefix which will be prepended to the resulting URL
- * @param uri fallback uri, must start with fallback://
- * @return A string.
- * @throws ConfigurationException
- */
- protected String transformFallbackUriToHttp(String pubid, String uri)
- throws ConfigurationException {
- if (uri.startsWith("fallback://lenya/modules/")) {
- String path = StringUtils.substringAfter(uri, "fallback://lenya/modules/");
- String module = StringUtils.substringBefore(path, "/");
- path = StringUtils.substringAfter(path, module + "/resources");
- return "/" + pubid + "/modules/" + module + path;
- } else {
- throw new ConfigurationException("Don't know how to create HTTP URL from : " + uri);
- }
- }
-
- protected ServiceManager manager;
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/flow/FlowHelper.java b/trunk/src/java/org/apache/lenya/cms/cocoon/flow/FlowHelper.java
deleted file mode 100644
index ae95fab..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/flow/FlowHelper.java
+++ /dev/null
@@ -1,110 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.flow;
-
-import java.util.Map;
-
-import org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.cms.publication.PageEnvelope;
-import org.apache.lenya.cms.publication.PageEnvelopeException;
-import org.apache.lenya.cms.publication.util.DocumentHelper;
-import org.apache.lenya.cms.rc.FileReservedCheckInException;
-import org.apache.lenya.workflow.WorkflowException;
-
-/**
- * Flowscript utility class.
- * @version $Id$
- */
-public interface FlowHelper {
-
- /**
- * The Avalon Role.
- */
- String ROLE = FlowHelper.class.getName();
-
- /**
- * Returns the current page envelope.
- * @param cocoon The FOM_Cocoon object.
- * @return A page envelope.
- * @throws PageEnvelopeException when something went wrong.
- */
- PageEnvelope getPageEnvelope(FOM_Cocoon cocoon) throws PageEnvelopeException;
-
- /**
- * Returns the request URI of the current request.
- * @param cocoon The FOM_Cocoon object.
- * @return A string.
- */
- String getRequestURI(FOM_Cocoon cocoon);
-
- /**
- * Returns the request object of the current request.
- * @param cocoon The FOM_Cocoon object.
- * @return A request object.
- */
- Request getRequest(FOM_Cocoon cocoon);
-
- /**
- * Returns the Cocoon Object Model
- * @param cocoon The Flow Object Model of Cocoon
- * @return The object model
- */
- Map getObjectModel(FOM_Cocoon cocoon);
-
- /**
- * Returns a DocumentHelper instance.
- * @param cocoon The Flow Object Model of Cocoon
- * @return The document helper
- * @see DocumentHelper
- */
- DocumentHelper getDocumentHelper(FOM_Cocoon cocoon);
-
- /**
- * Resolves the request parameter value for a specific name. The parameter
- * names are encoded as <code>{name}:{value}.{axis}</code>. This is a
- * workaround for the <input type="image"/> bug in Internet Explorer.
- * @param cocoon The FOM_Cocoon object.
- * @param parameterName The request parameter name.
- * @return A string.
- */
- String getImageParameterValue(FOM_Cocoon cocoon, String parameterName);
-
- /**
- * Trigger a workflow event for the document associated with the current
- * PageEnvelope.
- * @param cocoon The Cocoon Flow Object Model
- * @param event The name of the workflow event to trigger.
- * @throws WorkflowException If an workflow error occurs
- * @throws PageEnvelopeException Page envelope can not operate properly.
- * @throws AccessControlException If an access control violation occurs.
- */
- void triggerWorkflow(FOM_Cocoon cocoon, String event) throws WorkflowException,
- PageEnvelopeException, AccessControlException;
-
- /**
- * Checkis in the current document from the PageEnvelope context.
- * @param cocoon The Cocoon Flow Object Model
- * @param backup Wether a new revision should be created.
- * @throws FileReservedCheckInException
- * @throws Exception
- */
- void reservedCheckIn(FOM_Cocoon cocoon, boolean backup) throws FileReservedCheckInException,
- Exception;
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/flow/FlowHelperImpl.java b/trunk/src/java/org/apache/lenya/cms/cocoon/flow/FlowHelperImpl.java
deleted file mode 100644
index f81d932..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/flow/FlowHelperImpl.java
+++ /dev/null
@@ -1,174 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.flow;
-
-import java.util.Enumeration;
-import java.util.Map;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-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.components.flow.javascript.fom.FOM_Cocoon;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.PageEnvelope;
-import org.apache.lenya.cms.publication.PageEnvelopeException;
-import org.apache.lenya.cms.publication.PageEnvelopeFactory;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.publication.util.DocumentHelper;
-import org.apache.lenya.cms.rc.FileReservedCheckInException;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.cms.workflow.WorkflowUtil;
-import org.apache.lenya.workflow.WorkflowException;
-
-/**
- * Flowscript utility class. The FOM_Cocoon object is not passed in the constructor to avoid errors.
- * This way, not the initial, but the current FOM_Cocoon object is used by the methods.
- */
-public class FlowHelperImpl extends AbstractLogEnabled implements FlowHelper, Serviceable {
-
- /**
- * Ctor.
- */
- public FlowHelperImpl() {
- // do nothing
- }
-
- /**
- * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getPageEnvelope(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon)
- */
- public PageEnvelope getPageEnvelope(FOM_Cocoon cocoon) throws PageEnvelopeException {
- Request request = getRequest(cocoon);
- try {
- Session session = RepositoryUtil.getSession(this.manager, request);
- DocumentFactory map = DocumentUtil.createDocumentFactory(this.manager, session);
- PageEnvelopeFactory factory = PageEnvelopeFactory.getInstance();
- Publication publication = PublicationUtil.getPublication(this.manager, request);
- return factory.getPageEnvelope(map, cocoon.getObjectModel(), publication);
- } catch (Exception e) {
- throw new PageEnvelopeException(e);
- }
- }
-
- /**
- * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getRequestURI(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon)
- */
- public String getRequestURI(FOM_Cocoon cocoon) {
- return cocoon.getRequest().getRequestURI();
- }
-
- /**
- * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getRequest(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon)
- */
- public Request getRequest(FOM_Cocoon cocoon) {
- return cocoon.getRequest();
- }
-
- /**
- * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getObjectModel(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon)
- */
- public Map getObjectModel(FOM_Cocoon cocoon) {
- return cocoon.getObjectModel();
- }
-
- /**
- * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getDocumentHelper(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon)
- */
- public DocumentHelper getDocumentHelper(FOM_Cocoon cocoon) {
- return new DocumentHelper(this.manager, cocoon.getObjectModel());
- }
-
- /**
- * <code>SEPARATOR</code> The separator
- */
- public static final String SEPARATOR = ":";
-
- /**
- * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getImageParameterValue(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon,
- * java.lang.String)
- */
- public String getImageParameterValue(FOM_Cocoon cocoon, String parameterName) {
-
- getLogger().debug("Resolving parameter value for name [" + parameterName + "]");
-
- Request request = cocoon.getRequest();
- String value = request.getParameter(parameterName);
-
- if (value == null) {
- String prefix = parameterName + SEPARATOR;
- Enumeration e = request.getParameterNames();
- while (e.hasMoreElements() && value == null) {
- String name = (String) e.nextElement();
- if (name.startsWith(prefix)) {
- getLogger().debug("Complete parameter name: [" + name + "]");
- value = name.substring(prefix.length(), name.length() - 2);
- getLogger().debug("Resolved value: [" + value + "]");
- }
- }
- }
-
- return value;
- }
-
- /**
- * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#triggerWorkflow(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon,
- * java.lang.String)
- */
- public void triggerWorkflow(FOM_Cocoon cocoon, String event) throws WorkflowException,
- PageEnvelopeException, AccessControlException {
- Document document = getPageEnvelope(cocoon).getDocument();
- Request request = getRequest(cocoon);
- try {
- Session session = RepositoryUtil.getSession(this.manager, request);
- WorkflowUtil.invoke(this.manager, session, getLogger(), document, event);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- /**
- * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#reservedCheckIn(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon,
- * boolean)
- */
- public void reservedCheckIn(FOM_Cocoon cocoon, boolean backup)
- throws FileReservedCheckInException, Exception {
- final PageEnvelope pageEnvelope = getPageEnvelope(cocoon);
- Node node = pageEnvelope.getDocument().getRepositoryNode();
- node.checkin();
- }
-
- private ServiceManager manager;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/generation/LenyaMetaDataGenerator.java b/trunk/src/java/org/apache/lenya/cms/cocoon/generation/LenyaMetaDataGenerator.java
deleted file mode 100644
index 9fc6470..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/generation/LenyaMetaDataGenerator.java
+++ /dev/null
@@ -1,235 +0,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.
- */
-package org.apache.lenya.cms.cocoon.generation;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.caching.CacheableProcessingComponent;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.generation.ServiceableGenerator;
-import org.apache.excalibur.source.SourceValidity;
-import org.apache.excalibur.source.impl.validity.TimeStampValidity;
-import org.apache.excalibur.xml.dom.DOMParser;
-import org.apache.lenya.cms.cocoon.source.RepositorySource;
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.metadata.MetaDataException;
-import org.apache.lenya.cms.repository.ContentHolder;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- * <p>
- * Generates the meta data of a document. The <code>src</code> attribute must be
- * a {@link RepositorySource} URI (e.g., <code>lenya-document:...</code>).
- * </p>
- * <p>
- * Example output:
- * </p>
- *
- * <pre>
- * <lenya:metadata xmlns:lenya="http://apache.org/cocoon/lenya/metadata/1.0">
- * <elements xmlns="http://purl.org/dc/elements/1.1/">
- * <title>Search</title>
- * <date>2006-06-12 13:43:14</date>
- * <language>en</language>
- * <creator>lenya</creator>
- * </elements>
- * <elements xmlns="http://apache.org/lenya/metadata/document/1.0">
- * <extension>xml</extension>
- * <resourceType>usecase</resourceType>
- * <contentType>xml</contentType>
- * </elements>
- * </lenya:metadata>
- * </pre>
- */
-public class LenyaMetaDataGenerator extends ServiceableGenerator implements
- CacheableProcessingComponent {
-
- /** Node and attribute names */
- protected AttributesImpl attributes;
-
- /** Metadata */
- protected static final String ROOT_META_NODE_NAME = "meta";
-
- /** The URI of the namespace of the metadata */
- protected static final String URI_META = "http://apache.org/cocoon/lenya/metadata/1.0";
-
- /** The namespace prefix for this namespace */
- protected static final String PREFIX_META = "lenya";
-
- /** The parser for the XML snippets to be included. */
- protected DOMParser parser = null;
-
- private String src;
-
- /** The repository content holder to generate the meta data for */
- private ContentHolder content;
-
- /**
- * Recycle this component. All instance variables are set to <code>null</code>.
- */
- public void recycle() {
- this.content = null;
- this.src = null;
- this.parser = null;
- super.recycle();
- }
-
- /**
- * Serviceable
- *
- * @param manager the ComponentManager
- *
- * @throws ServiceException in case a component could not be found
- */
- public void service(ServiceManager manager) throws ServiceException {
- super.service(manager);
- this.parser = (DOMParser) manager.lookup(DOMParser.ROLE);
- this.attributes = new AttributesImpl();
- }
-
- /**
- * Setup the file generator. Try to get the last modification date of the source for caching.
- */
- public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
- throws ProcessingException, SAXException, IOException {
-
- super.setup(resolver, objectModel, src, par);
- this.src = src;
-
- RepositorySource source = null;
- try {
- source = (RepositorySource) resolver.resolveURI(src);
- this.content = source.getContent();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- finally {
- if (source != null) {
- resolver.release(source);
- }
- }
- }
-
- /**
- * Generate the unique key. This key must be unique inside the space of this component.
- *
- * @return The generated key hashes the src
- */
- public Serializable getKey() {
- return this.src;
- }
-
- /**
- * Generate the validity object.
- *
- * @return The generated validity object or <code>null</code> if the component is currently
- * not cacheable.
- */
- public SourceValidity getValidity() {
- long lastModified;
- try {
- lastModified = this.content.getLastModified();
- } catch (Exception e) {
- getLogger().error("Error determining last modification date", e);
- return null;
- }
- return new TimeStampValidity(lastModified);
- }
-
- /**
- * Generate XML data.
- */
- public void generate() throws IOException, SAXException, ProcessingException {
- startNodeRoot();
- performIncludesMeta();
- endNodeRoot();
- }
-
- private void performIncludesMeta() throws SAXException, ProcessingException {
-
- try {
- String[] namespaces = this.content.getMetaDataNamespaceUris();
- for (int i = 0; i < namespaces.length; i++) {
- this.contentHandler.startPrefixMapping("", namespaces[i]);
- startNodeMeta(namespaces[i]);
- parseMetaData(namespaces[i]);
- endNodeMeta(namespaces[i]);
- this.contentHandler.endPrefixMapping("");
- }
- } catch (MetaDataException e) {
- throw new ProcessingException(e);
- }
-
- }
-
- private void parseMetaData(String namespace) throws ProcessingException, SAXException {
- MetaData metaData = getMetaData(namespace);
- String[] names = metaData.getAvailableKeys();
- for (int i = 0; i < names.length; i++) {
- String[] values;
- try {
- values = metaData.getValues(names[i]);
- } catch (MetaDataException e) {
- throw new ProcessingException(e);
- }
- for (int j = 0; j < values.length; j++) {
- this.contentHandler.startElement(namespace, names[i], names[i],
- new AttributesImpl());
- char[] valueChars = values[j].toCharArray();
- this.contentHandler.characters(valueChars, 0, valueChars.length);
- this.contentHandler.endElement(namespace, names[i], names[i]);
- }
- }
- }
-
- private void endNodeRoot() throws SAXException {
- this.contentHandler.endElement(URI_META, "metadata", PREFIX_META + ":metadata");
- this.contentHandler.endPrefixMapping(PREFIX_META);
- this.contentHandler.endDocument();
- }
-
- private void startNodeRoot() throws SAXException {
- this.contentHandler.startDocument();
- this.contentHandler.startPrefixMapping(PREFIX_META, URI_META);
- this.contentHandler.startElement(URI_META, "metadata", PREFIX_META + ":metadata",
- attributes);
- }
-
- private void startNodeMeta(String namespace) throws SAXException {
- this.contentHandler.startElement(namespace, "elements", "elements", attributes);
- }
-
- private void endNodeMeta(String namespace) throws SAXException {
- this.contentHandler.endElement(namespace, "elements", "elements");
- }
-
- protected MetaData getMetaData(String namespaceUri) throws ProcessingException {
- try {
- return this.content.getMetaData(namespaceUri);
- } catch (Exception e1) {
- throw new ProcessingException("Obtaining meta data value for [" + this.content
- + "] failed: ", e1);
- }
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/selection/LastModSourceSelector.java b/trunk/src/java/org/apache/lenya/cms/cocoon/selection/LastModSourceSelector.java
deleted file mode 100644
index e9b407f..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/selection/LastModSourceSelector.java
+++ /dev/null
@@ -1,103 +0,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.
- */
-package org.apache.lenya.cms.cocoon.selection;
-
-import org.apache.cocoon.selection.Selector;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-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.avalon.framework.thread.ThreadSafe;
-
-import java.util.Map;
-
-/**
- * <p>
- * Last Modified Source Selector.
- * </p>
- *
- * <pre>
- * <map:selector name="last-mod" src="org.apache.lenya.cms.cocoon.selection.LastModSourceSelector"/>
- *
- * <map:select type="last-mod">
- * <map:parameter name="compare-to" value="{sourceToCompareTo}"/>
- *
- * <map:when test="cachedsource">
- * <!-- executes iff cachedsource last-modified > courceToCompareTo last-modified -->
- * <map:read src="{cachedsource}" mime-type="text/xml; charset=utf-8"/>
- * </map:when>
- * <map:otherwise>
- * <map:read src="{sourceToCompareTo}" mime-type="text/xml; charset=utf-8"/>
- * </map:otherwise>
- * </map:select>
- * </pre>
- */
-
-public class LastModSourceSelector extends AbstractLogEnabled
- implements ThreadSafe, Serviceable, Disposable, Selector {
-
- private ServiceManager manager;
- private SourceResolver resolver;
- private Source source = null;
- private Source compare = null;
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- this.resolver = (SourceResolver)manager.lookup(SourceResolver.ROLE);
- }
-
- public void dispose() {
- if (null != this.source) {
- resolver.release(this.source);
- this.source = null;
- }
- if (null != this.compare) {
- resolver.release(this.compare);
- this.compare = null;
- }
- this.manager.release(this.resolver);
- this.resolver = null;
- this.manager = null;
- }
-
- public boolean select(String expression, Map objectModel, Parameters parameters) {
- String sourceToCompare = parameters.getParameter("compare-to",null);
- String compareToSource = expression;
- long sourceModDate = 0;
- long compareModDate = 0;
- try {
- source = resolver.resolveURI(sourceToCompare);
- sourceModDate = source.getLastModified();
- compare = resolver.resolveURI(compareToSource);
- compareModDate = compare.getLastModified();
- } catch (SourceNotFoundException e) {
- return false;
- } catch (Exception e) {
- getLogger().warn("Exception resolving resource ", e);
- return false;
- }
- boolean isNewer = (compareModDate > sourceModDate);
-
- return (sourceToCompare != null && isNewer);
-
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/serialization/LinkSerializer.java b/trunk/src/java/org/apache/lenya/cms/cocoon/serialization/LinkSerializer.java
deleted file mode 100644
index 9a41a81..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/serialization/LinkSerializer.java
+++ /dev/null
@@ -1,106 +0,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.
- */
-package org.apache.lenya.cms.cocoon.serialization;
-
-import org.apache.cocoon.serialization.Serializer;
-import org.apache.cocoon.Constants;
-import org.apache.cocoon.xml.xlink.ExtendedXLinkPipe;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-
-/**
- * Link serializer.
- * TODO: add meaningful javadocs
- */
-public class LinkSerializer extends ExtendedXLinkPipe implements Serializer {
-
- private PrintStream out;
-
- /**
- * Set the {@link OutputStream} where the requested resource should be serialized.
- */
- public void setOutputStream(OutputStream out) throws IOException {
- this.out = new PrintStream(out);
- }
-
- /**
- * Get the mime-type of the output of this <code>Component</code>.
- */
- public String getMimeType() {
- return Constants.LINK_CONTENT_TYPE;
- }
-
- public void simpleLink(String href, String role, String arcrole, String title, String show,
- String actuate, String uri, String name, String raw, Attributes attr)
- throws SAXException {
- print(href);
- super.simpleLink(href, role, arcrole, title, show, actuate, uri, name, raw, attr);
- }
-
- public void startLocator(String href, String role, String title, String label, String uri,
- String name, String raw, Attributes attr) throws SAXException {
- if (traversable(href)) {
- print(href);
- }
- super.startLocator(href, role, title, label, uri, name, raw, attr);
- }
-
- private boolean traversable(String href) {
- if (href.length() == 0)
- return false;
- if (href.charAt(0) == '#')
- return false;
- if (href.indexOf("://") != -1)
- return false;
- if (href.startsWith("mailto:"))
- return false;
- if (href.startsWith("news:"))
- return false;
- if (href.startsWith("javascript:"))
- return false;
- return true;
- }
-
- private void print(String href) {
- int ankerPos = href.indexOf('#');
- if (ankerPos == -1) {
- // TODO: Xalan encodes international characters into URL encoding
- out.println(href);
- } else {
- out.println(href.substring(0, ankerPos));
- }
- }
-
- /**
- * Test if the component wants to set the content length
- */
- public boolean shouldSetContentLength() {
- return false;
- }
-
- /**
- * Recyclable
- */
- public void recycle() {
- super.recycle();
- this.out = null;
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java
deleted file mode 100644
index 0e6d4fc..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java
+++ /dev/null
@@ -1,170 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.source;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-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.logger.AbstractLogEnabled;
-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.components.ContextHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceFactory;
-import org.apache.excalibur.source.SourceUtil;
-import org.apache.excalibur.source.URIAbsolutizer;
-import org.apache.lenya.cms.module.ModuleManager;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationManager;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.publication.templating.AllExistingSourceResolver;
-import org.apache.lenya.cms.publication.templating.PublicationTemplateManager;
-
-/**
- * Aggregate all existing fallback URIs by merging their XML content under
- * the document element of the first encountered source.
- */
-public class AggregatingFallbackSourceFactory extends AbstractLogEnabled implements SourceFactory,
- Serviceable, Contextualizable, URIAbsolutizer {
-
- public Source getSource(final String location, Map parameters) throws IOException,
- MalformedURLException {
-
- // Remove the protocol and the first '//'
- int pos = location.indexOf("://");
-
- if (pos == -1) {
- throw new RuntimeException("The location [" + location
- + "] does not contain the string '://'");
- }
-
- String path = location.substring(pos + 3);
- String publicationId = null;
-
- // allow for template-fallback://{pubid}//{path} for the sake of the
- // cocoon use-store
- if (path.indexOf("//") > 1) {
- pos = path.indexOf("//");
- publicationId = path.substring(0, pos);
- path = path.substring(pos + 2, path.length());
- }
-
- if (path.length() == 0) {
- throw new RuntimeException("The path after the protocol must not be empty!");
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Location: [" + location + "]");
- getLogger().debug("Path: [" + path + "]");
- }
-
- PublicationTemplateManager templateManager = null;
- try {
- templateManager = (PublicationTemplateManager) this.manager
- .lookup(PublicationTemplateManager.ROLE);
-
- Request request = ContextHelper.getRequest(this.context);
-
- if (publicationId == null) {
- String webappUrl = request.getRequestURI().substring(
- request.getContextPath().length());
-
- URLInformation info = new URLInformation(webappUrl);
- publicationId = info.getPublicationId();
- }
-
- DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
-
- String[] uris;
-
- if (factory.existsPublication(publicationId)) {
- Publication pub = factory.getPublication(publicationId);
- AllExistingSourceResolver resolver = new AllExistingSourceResolver();
- templateManager.visit(pub, path, resolver);
- uris = resolver.getUris();
- } else {
- uris = new String[0];
- }
-
- List allUris = new ArrayList();
- allUris.addAll(Arrays.asList(uris));
-
- String contextSourceUri = null;
- if (path.startsWith("lenya/modules/")) {
- ModuleManager moduleMgr = null;
- try {
- moduleMgr = (ModuleManager) this.manager.lookup(ModuleManager.ROLE);
- final String moduleShortcut = path.split("/")[2];
- String baseUri = moduleMgr.getBaseURI(moduleShortcut);
- final String modulePath = path.substring(("lenya/modules/" + moduleShortcut).length());
- contextSourceUri = baseUri + modulePath;
- } finally {
- if (moduleMgr != null) {
- this.manager.release(moduleMgr);
- }
- }
- } else {
- contextSourceUri = "context://" + path;
- }
- if (org.apache.lenya.cms.cocoon.source.SourceUtil.exists(contextSourceUri, this.manager)) {
- allUris.add(contextSourceUri);
- }
-
- String[] aggregateUris = (String[]) allUris.toArray(new String[allUris.size()]);
- return new AggregatingSource(location, aggregateUris, this.manager);
-
- } catch (Exception e) {
- throw new RuntimeException("Resolving path [" + location + "] failed: ", e);
- } finally {
- if (templateManager != null) {
- this.manager.release(templateManager);
- }
- }
- }
-
- public void release(Source source) {
- }
-
- private ServiceManager manager;
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
- private Context context;
-
- public void contextualize(Context context) throws ContextException {
- this.context = context;
- }
-
- public String absolutize(String baseURI, String location) {
- return SourceUtil.absolutize(baseURI, location, true);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java
deleted file mode 100644
index 38c4bed..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/AggregatingSource.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.apache.lenya.cms.cocoon.source;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.components.source.impl.MultiSourceValidity;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.SourceValidity;
-import org.apache.lenya.xml.DocumentHelper;
-import org.apache.lenya.xml.NamespaceHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- *
- */
-public class AggregatingSource implements Source {
-
- private String uri;
- private String[] sourceUris;
- private ServiceManager manager;
-
- /**
- * @param uri
- * @param uris
- * @param manager
- */
- public AggregatingSource(String uri, String[] uris, ServiceManager manager) {
- this.manager = manager;
- this.sourceUris = (String[])uris.clone();
- this.uri = uri;
- }
-
- public String toString() {
- return getURI();
- }
-
- protected void loadDom() {
- try {
- for (int i = 0; i < sourceUris.length; i++) {
- Document sourceDom = SourceUtil.readDOM(sourceUris[i], this.manager);
-
- if (sourceDom == null) {
- throw new RuntimeException("The source [" + sourceUris[i]
- + "] doesn't contain XML.");
- }
-
- Element docElement = sourceDom.getDocumentElement();
- if (this.dom == null) {
- String namespaceUri = docElement.getNamespaceURI();
- String prefix = docElement.getPrefix();
- String localName = docElement.getLocalName();
-
- if (namespaceUri == null) {
- this.dom = DocumentHelper.createDocument(null, localName, null);
- } else {
- NamespaceHelper helper = new NamespaceHelper(namespaceUri, prefix,
- localName);
- this.dom = helper.getDocument();
- }
- }
-
- Element[] elements = DocumentHelper.getChildren(docElement);
- for (int e = 0; e < elements.length; e++) {
- Element clone = (Element) this.dom.importNode(elements[e], true);
- this.dom.getDocumentElement().appendChild(clone);
- }
- }
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private Document dom;
- private byte[] data;
-
- protected Document getDom() {
- if (this.dom == null) {
- loadDom();
- }
- return this.dom;
- }
-
- protected byte[] getData() {
- if (this.data == null) {
- Document dom = getDom();
- if (dom != null) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try {
- DocumentHelper.writeDocument(dom, out);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- this.data = out.toByteArray();
- }
- }
- return this.data;
- }
-
- public boolean exists() {
- return this.sourceUris.length > 0;
- }
-
- public long getContentLength() {
- return getData().length;
- }
-
- public InputStream getInputStream() throws IOException, SourceNotFoundException {
- if (!exists()) {
- throw new RuntimeException(this + " does not exist!");
- }
- return new ByteArrayInputStream(getData());
- }
-
- public long getLastModified() {
- long lastModified = 0;
- for (int i = 0; i < this.sourceUris.length; i++) {
- try {
- lastModified = Math.max(lastModified, SourceUtil.getLastModified(sourceUris[i],
- this.manager));
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- return lastModified;
- }
-
- public String getMimeType() {
- return "application/xml";
- }
-
- public String getScheme() {
- return "aggregate-template";
- }
-
- public String getURI() {
- return this.uri;
- }
-
- private SourceValidity validity;
-
- public SourceValidity getValidity() {
- if (this.validity == null) {
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
- MultiSourceValidity aggregatedValidity = new MultiSourceValidity(resolver, 0);
- for (int i = 0; i < this.sourceUris.length; i++) {
- Source source = null;
- try {
- source = resolver.resolveURI(this.sourceUris[i]);
- aggregatedValidity.addSource(source);
- } finally {
- if (source != null) {
- resolver.release(source);
- }
- }
- }
- aggregatedValidity.close();
- this.validity = aggregatedValidity;
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- }
- }
- return this.validity;
- }
-
- public void refresh() {
- this.dom = null;
- this.data = null;
- this.validity = null;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java
deleted file mode 100644
index ae6c941..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java
+++ /dev/null
@@ -1,226 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.source;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-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.components.ContextHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceFactory;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.SourceUtil;
-import org.apache.excalibur.source.URIAbsolutizer;
-import org.apache.lenya.cms.module.ModuleManager;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.publication.templating.ExistingSourceResolver;
-import org.apache.lenya.cms.publication.templating.PublicationTemplateManager;
-import org.apache.lenya.cms.publication.templating.VisitingSourceResolver;
-
-/**
- * <p>
- * Source factory following the fallback principle.
- * </p>
- * <p>
- * The ID of the current publication can be passed in the URL (<code>fallback:pub://path</code),
- * this is necessary as a workaround for bug 40564.
- * </p>
- *
- * @version $Id$
- */
-public class FallbackSourceFactory extends AbstractLogEnabled implements SourceFactory,
- Serviceable, Contextualizable, URIAbsolutizer {
-
- /**
- * Ctor.
- */
- public FallbackSourceFactory() {
- super();
- }
-
- /**
- * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
- */
- public Source getSource(final String location, Map parameters) throws IOException,
- MalformedURLException {
-
- // Remove the protocol and the first '//'
- int pos = location.indexOf("://");
-
- if (pos == -1) {
- throw new RuntimeException("The location [" + location
- + "] does not contain the string '://'");
- }
-
- String path = location.substring(pos + 3);
-
- String publicationId = null;
-
- // extract publication ID
- String prefix = location.substring(0, pos);
- StringTokenizer tokens = new StringTokenizer(prefix, ":");
- if (tokens.countTokens() > 1) {
- tokens.nextToken();
- publicationId = tokens.nextToken();
- }
-
- // remove query string
- int questionMarkIndex = path.indexOf("?");
- if (questionMarkIndex > -1) {
- path = path.substring(0, questionMarkIndex);
- }
-
- if (path.length() == 0) {
- throw new RuntimeException("The path after the protocol must not be empty!");
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Location: [" + location + "]");
- getLogger().debug("Path: [" + path + "]");
- }
-
- PublicationTemplateManager templateManager = null;
- SourceResolver sourceResolver = null;
- Source source = null;
- try {
- sourceResolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
-
- templateManager = (PublicationTemplateManager) this.manager.lookup(PublicationTemplateManager.ROLE);
-
- Request request = ContextHelper.getRequest(this.context);
-
- if (publicationId == null) {
- String webappUrl = request.getRequestURI().substring(request.getContextPath().length());
-
- URLInformation info = new URLInformation(webappUrl);
- publicationId = info.getPublicationId();
- }
-
- DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
- if (factory.existsPublication(publicationId)) {
- Publication pub = factory.getPublication(publicationId);
- VisitingSourceResolver resolver = getSourceVisitor();
- templateManager.visit(pub, path, resolver);
- source = resolver.getSource();
- }
-
- if (source == null) {
- if (path.startsWith("lenya/modules/")) {
- ModuleManager moduleMgr = null;
- try {
- moduleMgr = (ModuleManager) this.manager.lookup(ModuleManager.ROLE);
- final String moduleShortcut = path.split("/")[2];
- String baseUri = moduleMgr.getBaseURI(moduleShortcut);
- final String modulePath = path.substring(("lenya/modules/" + moduleShortcut).length());
- source = sourceResolver.resolveURI(baseUri + modulePath);
- } finally {
- if (moduleMgr != null) {
- this.manager.release(moduleMgr);
- }
- }
- } else {
- String contextUri = "context://" + path;
- source = sourceResolver.resolveURI(contextUri);
- }
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Resolved source: [" + source.getURI() + "]");
- }
-
- } catch (Exception e) {
- throw new RuntimeException("Resolving path [" + location + "] failed: ", e);
- } finally {
- if (templateManager != null) {
- this.manager.release(templateManager);
- }
- if (sourceResolver != null) {
- this.manager.release(sourceResolver);
- }
- }
-
- return source;
- }
-
- protected VisitingSourceResolver getSourceVisitor() {
- return new ExistingSourceResolver();
- }
-
- private org.apache.avalon.framework.context.Context context;
-
- /** The ServiceManager */
- private ServiceManager manager;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager _manager) throws ServiceException {
- this.manager = _manager;
- }
-
- /**
- * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
- */
- public void contextualize(org.apache.avalon.framework.context.Context _context)
- throws ContextException {
- this.context = _context;
- }
-
- /**
- * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
- */
- public void release(Source source) {
- // In fact, this method should never be called as this factory
- // returns a source object from a different factory. So that
- // factory should release the source
- if (null != source) {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("Releasing source " + source.getURI());
- }
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
- resolver.release(source);
- } catch (ServiceException ignore) {
- // ignore the exception
- } finally {
- this.manager.release(resolver);
- }
- }
- }
-
- /**
- * @see org.apache.excalibur.source.URIAbsolutizer#absolutize(java.lang.String,
- * java.lang.String)
- */
- public String absolutize(String baseURI, String location) {
- return SourceUtil.absolutize(baseURI, location, true);
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/LenyaSourceFactory.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/LenyaSourceFactory.java
deleted file mode 100644
index 0068970..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/LenyaSourceFactory.java
+++ /dev/null
@@ -1,146 +0,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.
- */
-package org.apache.lenya.cms.cocoon.source;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.DefaultConfiguration;
-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.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.components.flow.FlowHelper;
-import org.apache.cocoon.components.modules.input.JXPathHelper;
-import org.apache.cocoon.components.modules.input.JXPathHelperConfiguration;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceException;
-import org.apache.excalibur.source.SourceFactory;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.Query;
-
-/**
- * A factory for the "lenya" scheme (virtual protocol), which is used to resolve any src="lenya:..."
- * attributes in sitemaps. This implementation constructs the path to the source document from the
- * page envelope and delegates any further resolving to the "context" source resolver of Cocoon.
- *
- * @version $Id$
- */
-public class LenyaSourceFactory extends AbstractLogEnabled implements SourceFactory, ThreadSafe,
- Contextualizable, Serviceable {
-
- protected static final String SCHEME = "lenya:";
-
- /** fallback if no configuration is available */
- protected static final String DEFAULT_DELEGATION_SCHEME = "context:";
- protected static final String DEFAULT_DELEGATION_PREFIX = "/"
- + Publication.PUBLICATION_PREFIX_URI;
-
- private Context context;
- private ServiceManager manager;
-
- /**
- * Used for resolving the object model.
- * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
- */
- public void contextualize(Context _context) throws ContextException {
- this.context = _context;
- }
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager _manager) throws ServiceException {
- this.manager = _manager;
- }
-
- /**
- * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
- */
- public Source getSource(final String location, final Map parameters)
- throws MalformedURLException, IOException, SourceException {
-
- String sessionName = null;
-
- String[] uriAndQuery = location.split("\\?");
- if (uriAndQuery.length > 1) {
- Query query = new Query(uriAndQuery[1]);
- sessionName = query.getValue("session");
- }
-
- Session session;
- try {
- session = getSession(sessionName);
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Creating repository source for URI [" + location + "]");
- }
-
- return new RepositorySource(this.manager, location, session, getLogger());
-
- }
-
- protected Session getSession(String sessionName) throws RepositoryException {
- Map objectModel = ContextHelper.getObjectModel(this.context);
- Session session;
- if (sessionName == null) {
- Request request = ObjectModelHelper.getRequest(objectModel);
- session = RepositoryUtil.getSession(this.manager, request);
- } else if (sessionName.equals("usecase")) {
- session = getUsecaseSession(objectModel);
- } else {
- throw new RepositoryException("Invalid session: [" + sessionName + "]");
- }
-
- return session;
- }
-
- protected Session getUsecaseSession(Map objectModel) throws RepositoryException {
- try {
- Configuration config = new DefaultConfiguration("foo");
- JXPathHelperConfiguration helperConfig = JXPathHelper.setup(config);
- Object contextObject = FlowHelper.getContextObject(objectModel);
- return (Session) JXPathHelper.getAttribute("usecase/session", config, helperConfig,
- contextObject);
- } catch (Exception e) {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * Does nothing because the delegated factory does this.
- * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
- */
- public void release(Source source) {
- // do nothing
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java
deleted file mode 100644
index bdaccba..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java
+++ /dev/null
@@ -1,408 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.source;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.net.MalformedURLException;
-import java.util.Collection;
-
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.environment.Request;
-import org.apache.excalibur.source.ModifiableTraversableSource;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceException;
-import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.excalibur.source.SourceValidity;
-import org.apache.excalibur.source.impl.AbstractSource;
-import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.repository.ContentHolder;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.NodeFactory;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.Query;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Repository source.
- *
- * @version $Id$
- */
-public class RepositorySource extends AbstractSource implements ModifiableTraversableSource {
-
- private ServiceManager manager;
- private ContentHolder content;
- private Session session;
- private Logger logger;
- protected static final String SCHEME = "lenya";
-
- /**
- * @param manager The service manager.
- * @param uri The source URI.
- * @param session The repository session.
- * @param logger The logger.
- * @throws SourceException if an error occurs.
- * @throws MalformedURLException if an error occurs.
- */
- public RepositorySource(ServiceManager manager, String uri, Session session, Logger logger)
- throws SourceException, MalformedURLException {
- this.manager = manager;
- this.logger = logger;
-
- if (getLogger().isDebugEnabled())
- getLogger().debug("Init RepositorySource: " + uri);
-
- if (session == null) {
- throw new IllegalArgumentException("The repository session must not be null!");
- }
- this.session = session;
-
- if (uri == null) {
- throw new MalformedURLException("The source URI must not be null!");
- }
-
- setSystemId(uri);
-
- // Scheme
- int start = 0;
- int end = uri.indexOf(':');
- if (end == -1)
- throw new MalformedURLException("Malformed uri for xmodule source (cannot find scheme) : "
- + uri);
-
- String scheme = uri.substring(start, end);
- if (!SCHEME.equals(scheme))
- throw new MalformedURLException("Malformed uri for a xmodule source : " + uri);
-
- setScheme(scheme);
-
- NodeFactory factory = null;
- try {
- factory = (NodeFactory) this.manager.lookup(NodeFactory.ROLE);
-
- String sourceUri;
- int revisionNumber = -1;
-
- int questionMarkIndex = uri.indexOf("?");
- if (questionMarkIndex > -1) {
- sourceUri = uri.substring(0, questionMarkIndex);
- Query query = new Query(uri.substring(questionMarkIndex + 1));
- String revisionString = query.getValue("rev", null);
- if (revisionString != null) {
-
- ContextUtility util = null;
- try {
- util = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
- Request request = util.getRequest();
- String webappUrl = ServletHelper.getWebappURI(request);
-
- Publication pub = PublicationUtil.getPublication(this.manager, request);
- Document currentDoc = pub.getFactory().getFromURL(webappUrl);
- if (currentDoc.getSourceURI().equals(sourceUri)) {
- revisionNumber = Integer.valueOf(revisionString).intValue();
- }
- }
- finally {
- if (util != null) {
- this.manager.release(util);
- }
- }
- }
- }
- else {
- sourceUri = uri;
- }
-
- if (revisionNumber == -1) {
- this.content = (ContentHolder) session.getRepositoryItem(factory, sourceUri);
- }
- else {
- Node node = (Node) session.getRepositoryItem(factory, sourceUri);
- this.content = node.getHistory().getRevision(revisionNumber);
- }
-
- } catch (Exception e) {
- throw new SourceException("Creating repository node failed: ", e);
- } finally {
- if (factory != null) {
- this.manager.release(factory);
- }
- }
- }
-
- /**
- * @return The repository node which is accessed by this source.
- */
- public Node getNode() {
-
- if (!(this.content instanceof Node)) {
- throw new RuntimeException("This operation can only be invoked on nodes, not on revisions.");
- }
-
- return (Node) this.content;
- }
-
- protected Logger getLogger() {
- return this.logger;
- }
-
- /**
- * @see org.apache.excalibur.source.ModifiableSource#getOutputStream()
- */
- public OutputStream getOutputStream() throws IOException {
- try {
- return getNode().getOutputStream();
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @see org.apache.excalibur.source.ModifiableSource#delete()
- */
- public void delete() {
- try {
- getNode().delete();
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @see org.apache.excalibur.source.ModifiableSource#canCancel(java.io.OutputStream)
- */
- public boolean canCancel(OutputStream arg0) {
- return false;
- }
-
- /**
- * @see org.apache.excalibur.source.ModifiableSource#cancel(java.io.OutputStream)
- */
- public void cancel(OutputStream arg0) throws IOException {
- }
-
- /**
- * @see org.apache.excalibur.source.Source#exists()
- */
- public boolean exists() {
- try {
- if (getContent().exists()) {
- return true;
- } else {
- return isCollection();
- }
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @see org.apache.excalibur.source.Source#getInputStream()
- */
- public InputStream getInputStream() throws IOException, SourceNotFoundException {
- if (getLogger().isDebugEnabled())
- getLogger().debug("Get InputStream for " + getURI());
- if (!exists()) {
- throw new SourceNotFoundException("The source [" + getURI() + "] does not exist!");
- }
- try {
- return getContent().getInputStream();
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
-
- protected InputStream convert(org.w3c.dom.Document edoc) throws IOException {
-
- final org.w3c.dom.Document doc = edoc;
- final PipedOutputStream pos = new PipedOutputStream();
- PipedInputStream pis = new PipedInputStream();
- pis.connect(pos);
-
- (new Thread(new Runnable() {
-
- public void run() {
- try {
- transform(doc, pos);
- } catch (TransformerException e) {
- throw new RuntimeException("Failed to tranform org.w3c.dom.Document to PipedOutputStream",
- e);
- } finally {
- try {
- pos.close();
- } catch (Exception ignore) {
- ignore.printStackTrace();
- }
- }
- }
- },
- getClass().getName() + ".convert(org.w3c.dom.Document edoc)")).start();
-
- return pis;
- }
-
- void transform(org.w3c.dom.Document edoc, PipedOutputStream pos) throws TransformerException {
-
- TransformerFactory tFactory = TransformerFactory.newInstance();
- Transformer transformer = tFactory.newTransformer();
-
- transformer.setOutputProperty("encoding", "UTF-8");
- transformer.setOutputProperty("indent", "yes");
-
- transformer.transform(new DOMSource(edoc), new StreamResult(pos));
-
- }
-
- /**
- * @return The content of this source.
- */
- public ContentHolder getContent() {
- return this.content;
- }
-
- /**
- * @see org.apache.excalibur.source.Source#getContentLength()
- */
- public long getContentLength() {
- try {
- return getContent().getContentLength();
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @see org.apache.excalibur.source.Source#getLastModified()
- */
- public long getLastModified() {
- try {
- return getContent().getLastModified();
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @return The source URI.
- */
- public String getSourceURI() {
- return getContent().getSourceURI();
- }
-
- /**
- * @see org.apache.excalibur.source.Source#getMimeType()
- */
- public String getMimeType() {
- try {
- return getContent().getMimeType();
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- *
- */
- public Source getParent() {
- getLogger().warn("getParent() not implemented yet!");
- return null;
- }
-
- /**
- *
- */
- public void makeCollection() {
- getLogger().warn("RepositorySource().makeCollection() not implemented yet!");
- }
-
- /**
- *
- */
- public String getName() {
- // Quick and dirty
- String name = new java.io.File(getURI()).getName();
- if (getLogger().isDebugEnabled())
- getLogger().debug("getName(): URI: " + name);
- return name;
- }
-
- /**
- *
- */
- public Source getChild(String name) {
- getLogger().warn("getChild() not implemented yet!");
- return null;
- }
-
- /**
- *
- */
- public Collection getChildren() {
- try {
- Collection children = getNode().getChildren();
- java.util.Iterator iterator = children.iterator();
- java.util.Vector newChildren = new java.util.Vector();
- while (iterator.hasNext()) {
- Node child = (Node) iterator.next();
- newChildren.add(new RepositorySource(this.manager,
- child.getSourceURI(),
- this.session,
- getLogger()));
- }
- return newChildren;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- *
- */
- public boolean isCollection() {
- try {
- return getNode().isCollection();
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- }
-
- private SourceValidity validity;
-
- public SourceValidity getValidity() {
- if (this.validity == null) {
- this.validity = new RepositorySourceValidity(this);
- }
- return this.validity;
- }
-
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySourceValidity.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySourceValidity.java
deleted file mode 100644
index f20b439..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySourceValidity.java
+++ /dev/null
@@ -1,71 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.source;
-
-import org.apache.excalibur.source.SourceValidity;
-
-/**
- * Validity for repository sources.
- */
-public class RepositorySourceValidity implements SourceValidity {
-
- private static final long serialVersionUID = 1L;
-
- private String sourceUri;
- private long lastModified;
-
- /**
- * @param source The source this validity is for.
- */
- public RepositorySourceValidity(RepositorySource source) {
- this.sourceUri = source.getSourceURI();
- this.lastModified = source.getLastModified();
- }
-
- public int isValid() {
- return SourceValidity.UNKNOWN;
- }
-
- public int isValid(SourceValidity validity) {
- if (validity instanceof RepositorySourceValidity) {
- RepositorySourceValidity repoValidity = (RepositorySourceValidity) validity;
- String repoValidityUri = repoValidity.getSourceURI();
-
- if (!repoValidityUri.equals(this.sourceUri)) {
- throw new RuntimeException("Wrong source URI: [" + repoValidityUri
- + "] instead of [" + this.sourceUri + "]!");
- }
- if (this.lastModified >= repoValidity.getLastModified()) {
- return SourceValidity.VALID;
- } else {
- return SourceValidity.INVALID;
- }
- } else {
- return SourceValidity.INVALID;
- }
- }
-
- protected long getLastModified() {
- return this.lastModified;
- }
-
- protected String getSourceURI() {
- return this.sourceUri;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/SiteSource.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/SiteSource.java
deleted file mode 100644
index 279a39f..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/SiteSource.java
+++ /dev/null
@@ -1,185 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.source;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.StringTokenizer;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.environment.Request;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.SourceValidity;
-import org.apache.excalibur.source.impl.validity.TimeStampValidity;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.util.Query;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Source for the site:/ protocol.
- */
-public class SiteSource extends AbstractLogEnabled implements Source {
-
- private ServiceManager manager;
- private Source delegate;
- private String scheme;
- private String uri;
-
- /**
- * @param manager The service manager.
- * @param request The cocoon request.
- * @param location The source URI.
- * @param logger The logger.
- */
- public SiteSource(ServiceManager manager, Request request, String location, Logger logger) {
- ContainerUtil.enableLogging(this, logger);
-
- this.manager = manager;
- this.uri = location;
-
- String areaName = null;
- String pubId;
-
- StringTokenizer locationSteps = new StringTokenizer(location, "?");
- String completePath = locationSteps.nextToken();
-
- String relativePath;
- try {
-
- this.scheme = completePath.substring(0, completePath.indexOf(":") + 1);
- final String absolutePath = completePath.substring(scheme.length());
- if (absolutePath.startsWith("//")) {
- final String fullPath = absolutePath.substring(2);
- StringTokenizer steps = new StringTokenizer(fullPath, "/");
- pubId = steps.nextToken();
- areaName = steps.nextToken();
- String prefix = pubId + "/" + areaName;
- relativePath = fullPath.substring(prefix.length());
- } else if (absolutePath.startsWith("/")) {
- String webappUrl = ServletHelper.getWebappURI(request);
- URLInformation info = new URLInformation(webappUrl);
- pubId = info.getPublicationId();
- areaName = info.getArea();
- relativePath = absolutePath;
- } else {
- throw new MalformedURLException("The path [" + absolutePath
- + "] must start with at least one slash.");
- }
-
- DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
- Publication pub = factory.getPublication(pubId);
- SiteStructure site = pub.getArea(areaName).getSite();
-
- String[] steps = relativePath.substring(1).split("/");
-
- String language = steps[0];
- String prefix = "/" + language;
- String path = relativePath.substring(prefix.length());
-
- if (site.contains(path, language)) {
- Document doc = site.getNode(path).getLink(language).getDocument();
- if (locationSteps.hasMoreTokens()) {
- Query query = new Query(locationSteps.nextToken());
- String format = query.getValue("format");
- if (format != null) {
- this.delegate = getFormatSource(doc, format);
- }
- }
- if (this.delegate == null) {
- String lenyaURL = doc.getSourceURI();
- Session session = RepositoryUtil.getSession(this.manager, request);
- this.delegate = new RepositorySource(manager, lenyaURL, session, getLogger());
- }
- }
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public boolean exists() {
- return this.delegate != null;
- }
-
- public long getContentLength() {
- return this.delegate == null ? 0 : this.delegate.getContentLength();
- }
-
- public InputStream getInputStream() throws IOException, SourceNotFoundException {
- return this.delegate.getInputStream();
- }
-
- public long getLastModified() {
- return this.delegate == null ? 0 : this.delegate.getLastModified();
- }
-
- public String getMimeType() {
- return this.delegate == null ? "" : this.delegate.getMimeType();
- }
-
- public String getScheme() {
- return this.scheme;
- }
-
- public String getURI() {
- return this.uri;
- }
-
- public SourceValidity getValidity() {
- return this.delegate.getValidity();
- }
-
- public void refresh() {
- if (this.delegate != null) {
- this.delegate.refresh();
- }
- }
-
- protected Source getFormatSource(Document doc, String format) throws DocumentException,
- ServiceException, MalformedURLException, IOException {
- String formatBaseUri = doc.getResourceType().getFormatURI(format);
- String formatUri = formatBaseUri + "/" + doc.getPublication().getId() + "/" + doc.getArea()
- + "/" + doc.getUUID() + "/" + doc.getLanguage();
-
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
- return resolver.resolveURI(formatUri);
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- }
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/SiteSourceFactory.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/SiteSourceFactory.java
deleted file mode 100644
index c130c6e..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/SiteSourceFactory.java
+++ /dev/null
@@ -1,110 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.source;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-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.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceException;
-import org.apache.excalibur.source.SourceFactory;
-
-/**
- * <p>
- * This source factory allows to access documents based on their path in the site structure.
- * </p>
- * <p>
- * Relative addressing refers to the current publication and area.
- * </p>
- * <p>
- * Syntax:
- * </p>
- * <ul>
- * <li>Absolute: <code>site://{pubId}/{area}/{language}{path}</code></li>
- * <li>Relative: <code>site:/{language}{path}</code></li>
- * </ul>
- * <p>
- * Usage examples:
- * </p>
- * <ul>
- * <li><code>site://default/authoring/en/news/today</code></li>
- * <li><code>site:/en/news/today</code></li>
- * </ul>
- */
-public class SiteSourceFactory extends AbstractLogEnabled implements SourceFactory, ThreadSafe,
- Contextualizable, Serviceable, Configurable {
-
- protected static final String SCHEME = "site";
-
- private Context context;
- private ServiceManager manager;
-
- /**
- * Used for resolving the object model.
- * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
- */
- public void contextualize(Context context) throws ContextException {
- this.context = context;
- }
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
- /**
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration configuration) throws ConfigurationException {
- }
-
- /**
- * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
- */
- public Source getSource(String location, Map parameters) throws MalformedURLException,
- IOException, SourceException {
- Map objectModel = ContextHelper.getObjectModel(this.context);
- Request request = ObjectModelHelper.getRequest(objectModel);
- return new SiteSource(this.manager, request, location, getLogger());
- }
-
- /**
- * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
- */
- public void release(Source source) {
- // Source will be released by delegated source factory.
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/SourceUtil.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/SourceUtil.java
deleted file mode 100644
index 408dabe..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/SourceUtil.java
+++ /dev/null
@@ -1,611 +0,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.
- *
- */
-
-package org.apache.lenya.cms.cocoon.source;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.util.Iterator;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.io.output.ByteArrayOutputStream;
-import org.apache.excalibur.source.ModifiableSource;
-import org.apache.excalibur.source.ModifiableTraversableSource;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceException;
-import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.xml.DocumentHelper;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/**
- * @version $Id$
- */
-public final class SourceUtil {
-
- /**
- * <p>
- * Copies one Source to another using a source buffer i.e. the source Source
- * is buffered before it is copied to its final destination.
- * </p>
- * <p>
- * The optional buffering is sometimes useful, if the source Source somehow
- * depends on the destination Source. This situation may occur e.g. if
- * source Source is a Cocoon pipeline.
- * </p>
- * <p>
- * <em>NOTE:</em> o.a.e..s.SourceUtil.copy does not close streams on an
- * exception!!
- * </p>
- * @param source
- * @param destination
- * @param useBuffer If true, the source data will be read into a buffer
- * before it is written to the final destination.
- * @throws IOException If an error occures.
- */
- public static void copy(Source source, ModifiableSource destination, boolean useBuffer)
- throws IOException {
- InputStream sourceInputStream = null;
- OutputStream destOutputStream = null;
- try {
- sourceInputStream = source.getInputStream();
- destOutputStream = destination.getOutputStream();
-
- if (useBuffer) {
- final ByteArrayOutputStream sourceBos = new ByteArrayOutputStream();
- IOUtils.copy(sourceInputStream, sourceBos);
- IOUtils.write(sourceBos.toByteArray(), destOutputStream);
- } else {
- IOUtils.copy(sourceInputStream, destOutputStream);
- }
- } finally {
- if (destOutputStream != null) {
- destOutputStream.flush();
- destOutputStream.close();
- }
- if (sourceInputStream != null) {
- sourceInputStream.close();
- }
- }
- }
-
- /**
- * Copies one Source to another. The source Source is optionally buffered.
- * @param resolver The SourceResolver to use for lookin up Sources.
- * @param sourceUri The source to be copied.
- * @param destUri The URI to copy to.
- * @param useBuffer If true, the source Source is buffered before copied to
- * the final destination.
- * @throws IOException If an error occures.
- * @throws SourceException If the destination is not modifiable.
- * @see #copy(Source, ModifiableSource, boolean)
- */
- public static void copy(SourceResolver resolver, String sourceUri, String destUri,
- boolean useBuffer) throws IOException, SourceException {
- Source source = null;
- Source dest = null;
- try {
- source = resolver.resolveURI(sourceUri);
- dest = resolver.resolveURI(destUri);
-
- if (!(dest instanceof ModifiableSource))
- throw new SourceException("Destination '" + dest.getURI() + "' is not modifiable.");
-
- copy(source, (ModifiableSource) dest, useBuffer);
- } finally {
- if (source != null)
- resolver.release(source);
- if (dest != null)
- resolver.release(dest);
- }
- }
-
- /**
- * Copies a Source without buffering.
- * @param resolver A SourceResolver instance.
- * @param sourceUri The source URI to copy from.
- * @param destUri The destination URI to copy to.
- * @throws IOException If an error occures.
- * @see #copy(SourceResolver, String, String, boolean)
- */
- public static void copy(SourceResolver resolver, String sourceUri, String destUri)
- throws IOException {
- copy(resolver, sourceUri, destUri, false);
- }
-
- /**
- * Copies a Source without buffering.
- * @param manager A service manager.
- * @param sourceUri The source URI to copy from.
- * @param destUri The destination URI to copy to.
- * @throws IOException If an error occures.
- * @throws ServiceException
- * @see #copy(SourceResolver, String, String, boolean)
- */
- public static void copy(ServiceManager manager, String sourceUri, String destUri)
- throws IOException, ServiceException {
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- copy(resolver, sourceUri, destUri, false);
- } finally {
- if (resolver != null) {
- manager.release(resolver);
- }
- }
- }
-
- /**
- * Reads a DOM from a source.
- * @param sourceUri The source URI.
- * @param manager The service manager.
- * @return A document or <code>null</code> if the source does not exist.
- * @throws ServiceException if an error occurs.
- * @throws SourceNotFoundException if an error occurs.
- * @throws ParserConfigurationException if an error occurs.
- * @throws SAXException if an error occurs.
- * @throws IOException if an error occurs.
- */
- public static Document readDOM(String sourceUri, ServiceManager manager)
- throws ServiceException, SourceNotFoundException, ParserConfigurationException,
- SAXException, IOException {
- SourceResolver resolver = null;
- Source source = null;
- Document document = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = resolver.resolveURI(sourceUri);
-
- if (source.exists()) {
- document = DocumentHelper.readDocument(source.getInputStream());
- }
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- return document;
- }
-
- /**
- * Writes a DOM to a source.
- * @param document The document.
- * @param sourceUri The source URI.
- * @param manager The service manager.
- * @throws TransformerConfigurationException if an error occurs.
- * @throws TransformerException if an error occurs.
- * @throws ServiceException if the source resolver could not be obtained.
- * @throws MalformedURLException if the source URI is not valid.
- * @throws IOException if an error occurs.
- */
- public static void writeDOM(Document document, String sourceUri, ServiceManager manager)
- throws TransformerConfigurationException, TransformerException, ServiceException,
- MalformedURLException, IOException {
- SourceResolver resolver = null;
- ModifiableSource source = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = (ModifiableSource) resolver.resolveURI(sourceUri);
-
- OutputStream oStream = source.getOutputStream();
- writeDOM(document, oStream);
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * @param document The XML document.
- * @param oStream The output stream.
- * @throws TransformerConfigurationException if an error occurs.
- * @throws TransformerException if an error occurs.
- * @throws IOException if an error occurs.
- */
- public static void writeDOM(Document document, OutputStream oStream)
- throws TransformerConfigurationException, TransformerException, IOException {
- DocumentHelper.writeDocument(document, oStream);
- if (oStream != null) {
- oStream.flush();
- try {
- oStream.close();
- } catch (Throwable t) {
- throw new RuntimeException("Could not write document: ", t);
- }
- }
- }
-
- /**
- * Deletes a source if it exists.
- * @param sourceUri The source URI.
- * @param manager The service manager.
- * @throws ServiceException if an error occurs.
- * @throws MalformedURLException if an error occurs.
- * @throws IOException if an error occurs.
- */
- public static void delete(String sourceUri, ServiceManager manager) throws ServiceException,
- MalformedURLException, IOException {
- SourceResolver resolver = null;
- ModifiableTraversableSource source = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = (ModifiableTraversableSource) resolver.resolveURI(sourceUri);
- if (source.exists()) {
- source.delete();
- }
-
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * Deletes all empty collections in a subtree.
- * @param sourceUri The root source URI.
- * @param manager The service manager.
- * @throws ServiceException
- * @throws MalformedURLException
- * @throws IOException
- */
- public static void deleteEmptyCollections(String sourceUri, ServiceManager manager)
- throws ServiceException, MalformedURLException, IOException {
- SourceResolver resolver = null;
- ModifiableTraversableSource source = null;
- try {
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = (ModifiableTraversableSource) resolver.resolveURI(sourceUri);
- if (source.isCollection()) {
- for (Iterator i = source.getChildren().iterator(); i.hasNext();) {
- ModifiableTraversableSource child = (ModifiableTraversableSource) i.next();
- deleteEmptyCollections(child.getURI(), manager);
- }
- if (source.getChildren().size() == 0) {
- source.delete();
- }
- }
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * Checks if a source exists.
- * @param sourceUri The source URI.
- * @param manager The service manager.
- * @return A boolean value.
- * @throws ServiceException if an error occurs.
- * @throws MalformedURLException if an error occurs.
- * @throws IOException if an error occurs.
- */
- public static boolean exists(String sourceUri, ServiceManager manager) throws ServiceException,
- MalformedURLException, IOException {
- SourceResolver resolver = null;
- Source source = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = resolver.resolveURI(sourceUri);
-
- return source.exists();
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * Returns the last modification date of a source.
- * @param sourceUri The source URI.
- * @param manager The service manager.
- * @return A long value.
- * @throws ServiceException if an error occurs.
- * @throws MalformedURLException if an error occurs.
- * @throws IOException if an error occurs.
- */
- public static long getLastModified(String sourceUri, ServiceManager manager)
- throws ServiceException, MalformedURLException, IOException {
- SourceResolver resolver = null;
- Source source = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = resolver.resolveURI(sourceUri);
-
- return source.getLastModified();
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * Checks out a repository source.
- * @param sourceUri The source URI.
- * @param manager The service manager.
- * @throws RepositoryException If an error occurs.
- * @throws ServiceException If an error occurs.
- * @throws MalformedURLException If an error occurs.
- * @throws IOException If an error occurs.
- */
- public static void checkout(String sourceUri, ServiceManager manager)
- throws RepositoryException, ServiceException, MalformedURLException, IOException {
- SourceResolver resolver = null;
- RepositorySource source = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = (RepositorySource) resolver.resolveURI(sourceUri);
-
- source.getNode().checkout();
-
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * Checks in a transactionable source.
- * @param sourceUri The source URI.
- * @param manager The service manager.
- * @throws RepositoryException If an error occurs.
- * @throws ServiceException If an error occurs.
- * @throws MalformedURLException If an error occurs.
- * @throws IOException If an error occurs.
- */
- public static void checkin(String sourceUri, ServiceManager manager)
- throws RepositoryException, ServiceException, MalformedURLException, IOException {
- SourceResolver resolver = null;
- RepositorySource source = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = (RepositorySource) resolver.resolveURI(sourceUri);
-
- source.getNode().checkin();
-
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * Locks a transactionable source.
- * @param sourceUri The source URI.
- * @param manager The service manager.
- * @throws RepositoryException If an error occurs.
- */
- public static void lock(String sourceUri, ServiceManager manager) throws RepositoryException {
- SourceResolver resolver = null;
- RepositorySource source = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = (RepositorySource) resolver.resolveURI(sourceUri);
-
- source.getNode().lock();
-
- } catch (RepositoryException e) {
- throw e;
- } catch (Exception e) {
- throw new RepositoryException(e);
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * Unlocks a transactionable source.
- * @param sourceUri The source URI.
- * @param manager The service manager.
- * @throws RepositoryException If an error occurs.
- */
- public static void unlock(String sourceUri, ServiceManager manager) throws RepositoryException {
- SourceResolver resolver = null;
- RepositorySource source = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = (RepositorySource) resolver.resolveURI(sourceUri);
-
- source.getNode().unlock();
-
- } catch (RepositoryException e) {
- throw e;
- } catch (Exception e) {
- throw new RepositoryException(e);
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * Registers a source as dirty.
- * @param sourceUri The source URI.
- * @param manager The service manager.
- */
- public static void registerDirty(String sourceUri, ServiceManager manager) {
- SourceResolver resolver = null;
- RepositorySource source = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = (RepositorySource) resolver.resolveURI(sourceUri);
- source.getNode().registerDirty();
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * @param sourceUri The source URI.
- * @param manager The service manager.
- * @return A content length.
- * @throws ServiceException
- * @throws MalformedURLException
- * @throws IOException
- */
- public static long getContentLength(String sourceUri, ServiceManager manager)
- throws ServiceException, MalformedURLException, IOException {
- SourceResolver resolver = null;
- Source source = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = resolver.resolveURI(sourceUri);
-
- return source.getContentLength();
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * @param sourceUri The source URI.
- * @param manager The service manager.
- * @return A mime type.
- * @throws ServiceException
- * @throws IOException
- * @throws MalformedURLException
- */
- public static String getMimeType(String sourceUri, ServiceManager manager)
- throws ServiceException, MalformedURLException, IOException {
- SourceResolver resolver = null;
- Source source = null;
- try {
-
- resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- source = resolver.resolveURI(sourceUri);
-
- return source.getMimeType();
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- manager.release(resolver);
- }
- }
- }
-
- /**
- * @param resolver
- * @param sourceUri
- * @param destOutputStream
- * @throws MalformedURLException
- * @throws IOException
- */
- public static void copy(SourceResolver resolver, String sourceUri, OutputStream destOutputStream) throws MalformedURLException, IOException {
- boolean useBuffer = true;
- InputStream sourceInputStream = null;
- Source source = null;
- try {
- source = resolver.resolveURI(sourceUri);
- sourceInputStream = source.getInputStream();
-
- if (useBuffer) {
- final ByteArrayOutputStream sourceBos = new ByteArrayOutputStream();
- IOUtils.copy(sourceInputStream, sourceBos);
- IOUtils.write(sourceBos.toByteArray(), destOutputStream);
- } else {
- IOUtils.copy(sourceInputStream, destOutputStream);
- }
- } finally {
- if (destOutputStream != null) {
- destOutputStream.flush();
- destOutputStream.close();
- }
- if (sourceInputStream != null) {
- sourceInputStream.close();
- }
- if (source != null) {
- resolver.release(source);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/TemplateFallbackSourceFactory.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/TemplateFallbackSourceFactory.java
deleted file mode 100644
index efd3fc9..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/TemplateFallbackSourceFactory.java
+++ /dev/null
@@ -1,35 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.source;
-
-import org.apache.lenya.cms.publication.templating.ExistingAncestorSourceResolver;
-import org.apache.lenya.cms.publication.templating.VisitingSourceResolver;
-
-/**
- * Source factory following the fallback principle, resolving the existing ancestor of the existing resource.
- * For more information about the URL syntax, see {@link FallbackSourceFactory}.
- *
- * @version $Id: FallbackSourceFactory.java 264153 2005-08-29 15:11:14Z andreas $
- */
-public class TemplateFallbackSourceFactory extends FallbackSourceFactory {
-
- protected VisitingSourceResolver getSourceVisitor() {
- return new ExistingAncestorSourceResolver();
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSource.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSource.java
deleted file mode 100644
index aeff3e7..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSource.java
+++ /dev/null
@@ -1,157 +0,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.
- */
-package org.apache.lenya.cms.cocoon.source;
-//package org.apache.cocoon.components.source.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.cocoon.util.MIMEUtils;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.excalibur.source.SourceValidity;
-
-/**
- * @author <a href="http://apache.org/~reinhard">Reinhard Poetz</a>
- * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: ZipSource.java 30932 2004-07-29 17:35:38Z vgritsenko $
- * @since 2.1.4
- */
-public class ZipSource extends AbstractLogEnabled implements Source {
-
- Source archive;
- String documentName;
-
- /**
- * Ctor.
- * @param archive The archive source.
- * @param fileName The filename.
- */
- public ZipSource(Source archive, String fileName) {
- this.archive = archive;
- this.documentName = fileName;
- }
-
- public boolean exists() {
- if(!this.archive.exists()) {
- return false;
- }
- ZipInputStream zipStream = null;
- ZipEntry document = null;
- boolean found = false;
- try {
- zipStream = new ZipInputStream(this.archive.getInputStream());
- do {
- document = zipStream.getNextEntry();
- if (document != null) {
- if (document.getName().equals(this.documentName)) {
- found = true;
- } else {
- zipStream.closeEntry();
- }
- }
- } while (document != null && found == false);
- } catch(IOException ioe) {
- return false;
- } finally {
- try {
- zipStream.close();
- } catch (IOException ioe) {
- this.getLogger().error("Error while closing ZipInputStream: " + this.documentName);
- }
- }
- return found;
- }
-
- public InputStream getInputStream()
- throws IOException, SourceNotFoundException {
-
- ZipInputStream zipStream =
- new ZipInputStream(this.archive.getInputStream());
- ZipEntry document = null;
- boolean found = false;
- do {
- document = zipStream.getNextEntry();
- if (document != null) {
- if (document.getName().equals(this.documentName)) {
- found = true;
- } else {
- // go to next entry
- zipStream.closeEntry();
- }
- }
- } while (document != null && found == false);
-
- if (document == null) {
- throw new SourceNotFoundException(
- "The document "
- + documentName
- + " is not in the archive "
- + this.archive.getURI());
- }
-
- // now we will extract the document and write it into a byte array
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buffer = new byte[8192];
- int length = -1;
- while (zipStream.available() > 0) {
- length = zipStream.read(buffer, 0, 8192);
- if (length > 0) {
- baos.write(buffer, 0, length);
- }
- }
- zipStream.close();
- baos.flush();
-
- // return an input stream
- return new ByteArrayInputStream(baos.toByteArray());
- }
-
- public String getURI() {
- return this.archive.getURI() + "/" + this.documentName;
- }
-
- public String getScheme() {
- return ZipSourceFactory.ZIP_SOURCE_SCHEME;
- }
-
- public SourceValidity getValidity() {
- return this.archive.getValidity();
- }
-
- public void refresh() {
- }
-
- public String getMimeType() {
- String ext = this.documentName.substring( this.documentName.lastIndexOf(".") );
- return MIMEUtils.getMIMEType( ext );
- }
-
- public long getContentLength() {
- return -1;
- }
-
- public long getLastModified() {
- return this.archive.getLastModified();
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSourceFactory.java b/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSourceFactory.java
deleted file mode 100644
index 73376ea..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSourceFactory.java
+++ /dev/null
@@ -1,97 +0,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.
- */
-//package org.apache.cocoon.components.source.impl;
-package org.apache.lenya.cms.cocoon.source;
-
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceException;
-import org.apache.excalibur.source.SourceFactory;
-import org.apache.excalibur.source.SourceResolver;
-
-
-/** Implementation of a {@link Source} that gets its content from
- * and ZIP archive.
- *
- * A ZIP source can be reached using the zip:// pseudo-protocol. The syntax is
- * zip://myFile.xml@myZip.zip (zip://[file]@[archive])
- *
- * @author <a href="http://apache.org/~reinhard">Reinhard Poetz</a>
- * @version CVS $Id: ZipSourceFactory.java 30932 2004-07-29 17:35:38Z vgritsenko $
- * @since 2.1.4
- */
-public class ZipSourceFactory extends AbstractLogEnabled
- implements SourceFactory, ThreadSafe, Serviceable {
-
- protected ServiceManager manager;
- /**
- * The URL scheme, including the colon.
- */
- public static final String ZIP_SOURCE_SCHEME = "zip:";
-
- public Source getSource(String location, Map parameters)
- throws IOException, MalformedURLException {
-
- if ( this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("Processing " + location);
- }
-
- // syntax checks
- int separatorPos = location.indexOf('@');
- if (separatorPos == -1) {
- throw new MalformedURLException("@ required in URI: " + location);
- }
- int protocolEnd = location.indexOf("://");
- if (protocolEnd == -1) {
- throw new MalformedURLException("URI does not contain '://' : " + location);
- }
-
- // get the source of the archive and return the ZipSource passing
- // a source retrieved from the SourceResolver
- String documentName = location.substring(protocolEnd + 3, separatorPos);
- Source archive;
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver)this.manager.lookup( SourceResolver.ROLE );
- archive = resolver.resolveURI(location.substring(separatorPos + 1));
- } catch (ServiceException se) {
- throw new SourceException("SourceResolver is not available.", se);
- } finally {
- this.manager.release(resolver);
- }
- return new ZipSource(archive, documentName);
- }
-
-
- public void release(Source source) {
- // not necessary here
- }
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/MetaDataTransformer.java b/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/MetaDataTransformer.java
deleted file mode 100644
index 21a0775..0000000
--- a/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/MetaDataTransformer.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.apache.lenya.cms.cocoon.transformation;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.transformation.AbstractSAXTransformer;
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.metadata.MetaDataException;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- * Meta data transformer.
- */
-public class MetaDataTransformer extends AbstractSAXTransformer implements
- Disposable {
- /**
- * The namespace for the meta data is http://apache.org/lenya/meta/1.0
- */
- static public final String NAMESPACE_URI = "http://apache.org/lenya/meta/1.0/";
-
- /**
- * The namespace prefix for this namespace.
- */
- static public final String PREFIX = "meta";
-
- /**
- * The value element is getting the value for a specific ns and key. It is
- * the only method implemented so far.
- */
- static public final String VALUE_ELEMENT = "value";
-
- /**
- * ELEMENT_ATT - which meta data key do we want to look up
- */
- static public final String ELEMENT_ATT = "element";
-
- /**
- * NS_ATT - in which namespace should we look
- */
- static public final String NS_ATT = "ns";
-
- /**
- * UUID_ATT - for which uuid?
- */
- static public final String UUID_ATT = "uuid";
-
- /**
- * LANG_ATT - in which language this is optional (when not found use
- * publication default)
- */
- static public final String LANG_ATT = "lang";
-
- /** Helper for lenya document retrival */
- protected String publicationId = null;
-
- protected String area = null;
-
- protected String language = null;
-
- protected String uuid = null;
-
- protected Publication pub;
-
- private DocumentFactory factory;
-
- /**
- * Setup the MetaDataTransformer.
- */
- public void setup(SourceResolver resolver, Map objectModel, String src,
- Parameters par) throws ProcessingException, SAXException,
- IOException {
- super.setup(resolver, objectModel, src, par);
- this.publicationId = par.getParameter("pubid", null);
- if (this.publicationId == null) {
- throw new ProcessingException(
- "The pubid is not set! Please set like e.g. <map:parameter name='pubid' value='{request-param:pubid}'/>");
- }
-
- this.area = par.getParameter("area", null);
- if (this.area == null) {
- throw new ProcessingException(
- "The area is not set! Please set like e.g. <map:parameter name='area' value='{request-param:area}'/>");
- }
- Request request = ObjectModelHelper.getRequest(objectModel);
- factory = DocumentUtil.getDocumentFactory(this.manager, request);
- try {
- pub = factory.getPublication(this.publicationId);
- } catch (PublicationException e) {
- throw new ProcessingException(
- "Error geting publication id / area from page envelope", e);
- }
- }
-
- public void startElement(String uri, String name, String raw,
- Attributes attr) throws SAXException {
- if (NAMESPACE_URI.equals(uri)) {
- if (VALUE_ELEMENT.equals(name)) {
- String lang = null, uuid = null, ns = null, key = null;
- for (int i = 0; i < attr.getLength(); i++) {
- String localName = attr.getLocalName(i);
- String value = attr.getValue(i);
- if (ELEMENT_ATT.equals(localName))
- key = value;
- else if (NS_ATT.equals(localName))
- ns = value;
- else if (UUID_ATT.equals(localName))
- uuid = value;
- else if (LANG_ATT.equals(localName))
- lang = value;
- }//end for
- if(uuid==null||ns==null||key==null)
- throw new SAXException("Error by setting up the transformation. Please fix the calling code.");
- if (lang==null)
- lang=pub.getDefaultLanguage();
- try {
- Document document = pub.getArea(area).getDocument(uuid, lang);
- MetaData metaData = document.getMetaData(ns);
- String [] returnValue=metaData.getValues(key);
- if (returnValue.length>1){
- for (int i = 0; i < returnValue.length; i++) {
- AttributesImpl attributes = new AttributesImpl();
- attributes.addAttribute("", VALUE_ELEMENT, VALUE_ELEMENT, "CDATA", returnValue[i]);
- attributes.addAttribute("", ELEMENT_ATT, ELEMENT_ATT, "CDATA", key);
- this.contentHandler.startElement(ns, VALUE_ELEMENT, PREFIX+":"+VALUE_ELEMENT, attributes);
- this.contentHandler.endElement(ns, VALUE_ELEMENT, PREFIX+":"+VALUE_ELEMENT);
- }
- }else if (returnValue.length==1){
- this.contentHandler.characters(returnValue[0].toCharArray(), 0, returnValue[0].toCharArray().length);
- }
- } catch (PublicationException e) {
- throw new SAXException("Error by getting document for [ "+lang+"/"+uuid+" ]");
- } catch (MetaDataException e) {
- throw new SAXException("Error by getting meta data with ns [ "+ns+" ] for document for [ "+lang+"/"+uuid+" ]");
- }
-
- } else {
- String warn = "Could not find method for " + name
- + ". Ignoring.";
- getLogger().warn(warn);
- }
- } else {
- super.startElement(uri, name, raw, attr);
- }
- }
-
- public void endElement(String uri, String name, String raw)
- throws SAXException {
- if (!NAMESPACE_URI.equals(uri)) {
- super.endElement(uri, name, raw);
- }
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/metadata/Element.java b/trunk/src/java/org/apache/lenya/cms/metadata/Element.java
deleted file mode 100644
index 7c748a4..0000000
--- a/trunk/src/java/org/apache/lenya/cms/metadata/Element.java
+++ /dev/null
@@ -1,65 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata;
-
-/**
- * A meta data element.
- */
-public interface Element {
-
- /**
- * @return the name of the element.
- */
- String getName();
-
- /**
- * @return if the element can have multiple values.
- */
- boolean isMultiple();
-
- /**
- * @return the description of the element.
- */
- String getDescription();
-
- /**
- * @return if the element value can be edited.
- */
- boolean isEditable();
-
- /**
- * Copy all values if the meta data are copied.
- */
- int ONCOPY_COPY = 0;
-
- /**
- * Don't copy the values of this element if the meta data are copied.
- */
- int ONCOPY_IGNORE = 1;
-
- /**
- * Delete all values of this element if the meta data are copied.
- */
- int ONCOPY_DELETE = 2;
-
- /**
- * @return The action to be taken when meta data are copied from one owner to another.
- */
- int getActionOnCopy();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/metadata/ElementSet.java b/trunk/src/java/org/apache/lenya/cms/metadata/ElementSet.java
deleted file mode 100644
index bbc1a61..0000000
--- a/trunk/src/java/org/apache/lenya/cms/metadata/ElementSet.java
+++ /dev/null
@@ -1,49 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata;
-
-/**
- * Definition of a set of meta data elements.
- */
-public interface ElementSet {
-
- /**
- * @return The supported elements.
- */
- Element[] getElements();
-
- /**
- * @param name The name.
- * @return The element.
- * @throws MetaDataException if the element with this name does not exist.
- */
- Element getElement(String name) throws MetaDataException;
-
- /**
- * @return The namespace URI of this element set.
- */
- String getNamespaceUri();
-
- /**
- * Checks if an element with a certain name is contained.
- * @param name The name.
- * @return A boolean value.
- */
- boolean containsElement(String name);
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/metadata/MetaData.java b/trunk/src/java/org/apache/lenya/cms/metadata/MetaData.java
deleted file mode 100644
index 2207aa4..0000000
--- a/trunk/src/java/org/apache/lenya/cms/metadata/MetaData.java
+++ /dev/null
@@ -1,111 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata;
-
-/**
- * Generic meta data interface.
- *
- * @version $Id$
- */
-public interface MetaData {
-
- /**
- * Returns the values for a certain key.
- * @param key The key.
- * @return An array of strings.
- * @throws MetaDataException when something went wrong.
- */
- String[] getValues(String key) throws MetaDataException;
-
- /**
- * Returns the first value for a certain key.
- * @param key The key.
- * @return A string or <code>null</code> if no value is set for this key.
- * @throws MetaDataException if an error occurs.
- */
- String getFirstValue(String key) throws MetaDataException;
-
- /**
- * Get all available keys.
- * @return The keys available in this MetaData object.
- */
- String[] getAvailableKeys();
-
- /**
- * Sets the value for a certain key. All existing values will be removed.
- * @param key The key.
- * @param value The value to set.
- * @throws MetaDataException when something went wrong.
- */
- void setValue(String key, String value) throws MetaDataException;
-
- /**
- * Addds a value for a certain key. The existing values will not be removed.
- * @param key The key.
- * @param value The value to add.
- * @throws MetaDataException if there's already a value set and the element doesn't support multiple values.
- */
- void addValue(String key, String value) throws MetaDataException;
-
- /**
- * Replace the contents of the current meta data by the contents of other.
- * @param other The other meta data manager.
- * @throws MetaDataException if an error occurs.
- */
- void replaceBy(MetaData other) throws MetaDataException;
-
- /**
- * Replace the contents of the current meta data by the contents of other.
- * All meta data is replaced, disregarding the rules given by element.getActionOnCopy().
- * @param other The other meta data manager.
- * @throws MetaDataException if an error occurs.
- */
- void forcedReplaceBy(MetaData other) throws MetaDataException;
-
- /**
- * @return All keys that can be used.
- */
- String[] getPossibleKeys();
-
- /**
- * Checks if a key represents a valid metadata attribute.
- * @param key The key.
- * @return A boolean value.
- */
- boolean isValidAttribute(String key);
-
- /**
- * Get last modification date.
- * @return last modification date
- * @throws MetaDataException if an error occurs.
- */
- long getLastModified() throws MetaDataException;
-
- /**
- * @return The element set this meta data object belongs to.
- */
- ElementSet getElementSet();
-
- /**
- * Removes all values for a certain key.
- * @param key The key.
- * @throws MetaDataException if the key is not supported.
- */
- void removeAllValues(String key) throws MetaDataException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/metadata/MetaDataException.java b/trunk/src/java/org/apache/lenya/cms/metadata/MetaDataException.java
deleted file mode 100644
index fdec9dd..0000000
--- a/trunk/src/java/org/apache/lenya/cms/metadata/MetaDataException.java
+++ /dev/null
@@ -1,54 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata;
-
-/**
- * Meta data exception.
- */
-public class MetaDataException extends Exception {
-
- /**
- *
- */
- public MetaDataException() {
- super();
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public MetaDataException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- /**
- * @param arg0
- */
- public MetaDataException(String arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- */
- public MetaDataException(Throwable arg0) {
- super(arg0);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/metadata/MetaDataOwner.java b/trunk/src/java/org/apache/lenya/cms/metadata/MetaDataOwner.java
deleted file mode 100644
index 16ba4c5..0000000
--- a/trunk/src/java/org/apache/lenya/cms/metadata/MetaDataOwner.java
+++ /dev/null
@@ -1,42 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata;
-
-/**
- * Owner of meta-data.
- *
- * @version $Id$
- */
-public interface MetaDataOwner {
-
- /**
- * Returns a meta data object.
- * @param namespaceUri The namespace URI.
- * @return A meta data object.
- * @throws MetaDataException if an error occurs.
- */
- MetaData getMetaData(String namespaceUri) throws MetaDataException;
-
- /**
- * Returns the URIs of the meta data currently supported by the owner.
- * @return An array of strings.
- * @throws MetaDataException if an error occurs.
- */
- String[] getMetaDataNamespaceUris() throws MetaDataException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/metadata/MetaDataRegistry.java b/trunk/src/java/org/apache/lenya/cms/metadata/MetaDataRegistry.java
deleted file mode 100644
index cc64b44..0000000
--- a/trunk/src/java/org/apache/lenya/cms/metadata/MetaDataRegistry.java
+++ /dev/null
@@ -1,59 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata;
-
-/**
- * Meta data registry.
- */
-public interface MetaDataRegistry {
-
- /**
- * The Avalon role.
- */
- String ROLE = MetaDataRegistry.class.getName();
-
- /**
- * @param namespaceUri The namespace URI of the element set.
- * @return the element set.
- * @throws MetaDataException if an error occurs.
- */
- ElementSet getElementSet(String namespaceUri) throws MetaDataException;
-
- /**
- * Checks if an element set is registered.
- * @param namespaceUri The namespace URI.
- * @return A boolean value.
- * @throws MetaDataException if an error occurs.
- */
- boolean isRegistered(String namespaceUri) throws MetaDataException;
-
- /**
- * Register an element set.
- * @param namespaceUri The namespace URI.
- * @param elementSet The element set.
- * @throws MetaDataException if a set is already registered for this name.
- */
- void register(String namespaceUri, ElementSet elementSet) throws MetaDataException;
-
- /**
- * @return The registered namespace URIs.
- * @throws MetaDataException if an error occurs.
- */
- String[] getNamespaceUris() throws MetaDataException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/metadata/dublincore/DublinCore.java b/trunk/src/java/org/apache/lenya/cms/metadata/dublincore/DublinCore.java
deleted file mode 100644
index 772c9eb..0000000
--- a/trunk/src/java/org/apache/lenya/cms/metadata/dublincore/DublinCore.java
+++ /dev/null
@@ -1,360 +0,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.
- *
- */
-
-package org.apache.lenya.cms.metadata.dublincore;
-
-import org.apache.lenya.cms.metadata.MetaData;
-
-/**
- * <p>
- * Dublin core metadata interface.
- * </p>
- * <p>
- * The descriptions are citing the <a href="http://www.dublincore.org">Dublin Core website </a>.
- * </p>
- *
- * @version $Id$
- */
-public interface DublinCore extends MetaData {
-
- /**
- * The dublin core elements namespace.
- */
- String DC_NAMESPACE = "http://purl.org/dc/elements/1.1/";
-
- /**
- * The dublin core terms namespace.
- */
- String DCTERMS_NAMESPACE = "http://purl.org/dc/terms/";
-
- /**
- * A name given to the resource. Typically, Title will be a name by which the resource is
- * formally known.
- */
- static final String ELEMENT_TITLE = "title";
-
- /**
- * An entity primarily responsible for making the content of the resource. Examples of Creator
- * include a person, an organization, or a service. Typically, the name of a Creator should be
- * used to indicate the entity.
- */
- static final String ELEMENT_CREATOR = "creator";
-
- /**
- * A topic of the content of the resource. Typically, Subject will be expressed as keywords, key
- * phrases or classification codes that describe a topic of the resource. Recommended best
- * practice is to select a value from a controlled vocabulary or formal classification scheme.
- */
- static final String ELEMENT_SUBJECT = "subject";
-
- /**
- * An account of the content of the resource. Examples of Description include, but is not
- * limited to: an abstract, table of contents, reference to a graphical representation of
- * content or a free-text account of the content.
- */
- static final String ELEMENT_DESCRIPTION = "description";
-
- /**
- * An entity responsible for making the resource available. Examples of Publisher include a
- * person, an organization, or a service. Typically, the name of a Publisher should be used to
- * indicate the entity.
- */
- static final String ELEMENT_PUBLISHER = "publisher";
-
- /**
- * An entity responsible for making contributions to the content of the resource. Examples of
- * Contributor include a person, an organization, or a service. Typically, the name of a
- * Contributor should be used to indicate the entity.
- */
- static final String ELEMENT_CONTRIBUTOR = "contributor";
-
- /**
- * A date of an event in the lifecycle of the resource. Typically, Date will be associated with
- * the creation or availability of the resource. Recommended best practice for encoding the date
- * value is defined in a profile of ISO 8601 [W3CDTF] and includes (among others) dates of the
- * form YYYY-MM-DD.
- */
- static final String ELEMENT_DATE = "date";
-
- /**
- * The nature or genre of the content of the resource. Type includes terms describing general
- * categories, functions, genres, or aggregation levels for content. Recommended best practice
- * is to select a value from a controlled vocabulary (for example, the DCMI Type Vocabulary
- * [DCT1]). To describe the physical or digital manifestation of the resource, use the FORMAT
- * element.
- */
- static final String ELEMENT_TYPE = "type";
-
- /**
- * The physical or digital manifestation of the resource. Typically, Format may include the
- * media-type or dimensions of the resource. Format may be used to identify the software,
- * hardware, or other equipment needed to display or operate the resource. Examples of
- * dimensions include size and duration. Recommended best practice is to select a value from a
- * controlled vocabulary (for example, the list of Internet Media Types [MIME] defining computer
- * media formats).
- */
- static final String ELEMENT_FORMAT = "format";
-
- /**
- * An unambiguous reference to the resource within a given context. Recommended best practice is
- * to identify the resource by means of a string or number conforming to a formal identification
- * system. Formal identification systems include but are not limited to the Uniform Resource
- * Identifier (URI) (including the Uniform Resource Locator (URL)), the Digital Object
- * Identifier (DOI) and the International Standard Book Number (ISBN).
- */
- static final String ELEMENT_IDENTIFIER = "identifier";
-
- /**
- * A Reference to a resource from which the present resource is derived. The present resource
- * may be derived from the Source resource in whole or in part. Recommended best practice is to
- * identify the referenced resource by means of a string or number conforming to a formal
- * identification system.
- */
- static final String ELEMENT_SOURCE = "source";
-
- /**
- * A language of the intellectual content of the resource. Recommended best practice is to use
- * RFC 3066 [RFC3066] which, in conjunction with ISO639 [ISO639]), defines two- and three-letter
- * primary language tags with optional subtags. Examples include "en" or "eng" for English,
- * "akk" for Akkadian", and "en-GB" for English used in the United Kingdom.
- */
- static final String ELEMENT_LANGUAGE = "language";
-
- /**
- * A reference to a related resource. Recommended best practice is to identify the referenced
- * resource by means of a string or number conforming to a formal identification system.
- */
- static final String ELEMENT_RELATION = "relation";
-
- /**
- * The extent or scope of the content of the resource. Typically, Coverage will include spatial
- * location (a place name or geographic coordinates), temporal period (a period label, date, or
- * date range) or jurisdiction (such as a named administrative entity). Recommended best
- * practice is to select a value from a controlled vocabulary (for example, the Thesaurus of
- * Geographic Names [TGN]) and to use, where appropriate, named places or time periods in
- * preference to numeric identifiers such as sets of coordinates or date ranges.
- */
- static final String ELEMENT_COVERAGE = "coverage";
-
- /**
- * Information about rights held in and over the resource. Typically, Rights will contain a
- * rights management statement for the resource, or reference a service providing such
- * information. Rights information often encompasses Intellectual Property Rights (IPR),
- * Copyright, and various Property Rights. If the Rights element is absent, no assumptions may
- * be made about any rights held in or over the resource.
- */
- static final String ELEMENT_RIGHTS = "rights";
-
- /**
- * A summary of the content of the resource.
- */
- static final String TERM_ABSTRACT = "abstract";
-
- /**
- * Information about who can access the resource or an indication of its security status. Access
- * Rights may include information regarding access or restrictions based on privacy, security or
- * other regulations.
- */
- static final String TERM_ACCESSRIGHTS = "accessRights";
-
- /**
- * Any form of the title used as a substitute or alternative to the formal title of the
- * resource. This qualifier can include Title abbreviations as well as translations.
- */
- static final String TERM_ALTERNATIVE = "alternative";
-
- /**
- * A class of entity for whom the resource is intended or useful. A class of entity may be
- * determined by the creator or the publisher or by a third party.
- */
- static final String TERM_AUDIENCE = "audience";
-
- /**
- * Date (often a range) that the resource will become or did become available.
- */
- static final String TERM_AVAILABLE = "available";
-
- /**
- * A bibliographic reference for the resource. Recommended practice is to include sufficient
- * bibliographic detail to identify the resource as unambiguously as possible, whether or not
- * the citation is in a standard form.
- */
- static final String TERM_BIBLIOGRAPHICCITATION = "bibliographicCitation";
-
- /**
- * A reference to an established standard to which the resource conforms.
- */
- static final String TERM_CONFORMSTO = "conformsTo";
-
- /**
- * Date of creation of the resource.
- */
- static final String TERM_CREATED = "created";
-
- /**
- * Date of acceptance of the resource (e.g. of thesis by university department, of article by
- * journal, etc.).
- */
- static final String TERM_DATEACCEPTED = "dateAccepted";
-
- /**
- * Date of a statement of copyright.
- */
- static final String TERM_DATECOPYRIGHTED = "dateCopyrighted";
-
- /**
- * Date of submission of the resource (e.g. thesis, articles, etc.).
- */
- static final String TERM_DATESUBMITTED = "dateSubmitted";
-
- /**
- * A general statement describing the education or training context. Alternatively, a more
- * specific statement of the location of the audience in terms of its progression through an
- * education or training context.
- */
- static final String TERM_EDUCATIONLEVEL = "educationLevel";
-
- /**
- * The size or duration of the resource.
- */
- static final String TERM_EXTENT = "extent";
-
- /**
- * The described resource pre-existed the referenced resource, which is essentially the same
- * intellectual content presented in another format.
- */
- static final String TERM_HASFORMAT = "hasFormat";
-
- /**
- * The described resource includes the referenced resource either physically or logically.
- */
- static final String TERM_HASPART = "hasPart";
-
- /**
- * The described resource has a version, edition, or adaptation, namely, the referenced
- * resource.
- */
- static final String TERM_HASVERSION = "hasVersion";
-
- /**
- * The described resource is the same intellectual content of the referenced resource, but
- * presented in another format.
- */
- static final String TERM_ISFORMATOF = "isFormatOf";
-
- /**
- * The described resource is a physical or logical part of the referenced resource.
- */
- static final String TERM_ISPARTOF = "isPartOf";
-
- /**
- * The described resource is referenced, cited, or otherwise pointed to by the referenced
- * resource.
- */
- static final String TERM_ISREFERENCEDBY = "isReferencedBy";
-
- /**
- * The described resource is supplanted, displaced, or superseded by the referenced resource.
- */
- static final String TERM_ISREPLACEDBY = "isReplacedBy";
-
- /**
- * The described resource is required by the referenced resource, either physically or
- * logically.
- */
- static final String TERM_ISREQUIREDBY = "isRequiredBy";
-
- /**
- * Date of formal issuance (e.g., publication) of the resource.
- */
- static final String TERM_ISSUED = "issued";
-
- /**
- * The described resource is a version, edition, or adaptation of the referenced resource.
- * Changes in version imply substantive changes in content rather than differences in format.
- */
- static final String TERM_ISVERSIONOF = "isVersionOf";
-
- /**
- * A legal document giving official permission to do something with the resource. Recommended
- * best practice is to identify the license using a URI. Examples of such licenses can be found
- * at http://creativecommons.org/licenses/.
- */
- static final String TERM_LICENSE = "license";
-
- /**
- * A class of entity that mediates access to the resource and for whom the resource is intended
- * or useful. The audiences for a resource are of two basic classes: (1) an ultimate beneficiary
- * of the resource, and (2) frequently, an entity that mediates access to the resource. The
- * mediator element refinement represents the second of these two classes.
- */
- static final String TERM_MEDIATOR = "mediator";
-
- /**
- * The material or physical carrier of the resource.
- */
- static final String TERM_MEDIUM = "medium";
-
- /**
- * Date on which the resource was changed.
- */
- static final String TERM_MODIFIED = "modified";
-
- /**
- * The described resource references, cites, or otherwise points to the referenced resource.
- */
- static final String TERM_REFERENCES = "references";
-
- /**
- * The described resource supplants, displaces, or supersedes the referenced resource.
- */
- static final String TERM_REPLACES = "replaces";
-
- /**
- * The described resource requires the referenced resource to support its function, delivery, or
- * coherence of content.
- */
- static final String TERM_REQUIRES = "requires";
-
- /**
- * A person or organization owning or managing rights over the resource. Recommended best
- * practice is to use the URI or name of the Rights Holder to indicate the entity.
- */
- static final String TERM_RIGHTSHOLDER = "rightsHolder";
-
- /**
- * Spatial characteristics of the intellectual content of the resource.
- */
- static final String TERM_SPATIAL = "spatial";
-
- /**
- * A list of subunits of the content of the resource.
- */
- static final String TERM_TABLEOFCONTENTS = "tableOfContents";
-
- /**
- * Temporal characteristics of the intellectual content of the resource.
- */
- static final String TERM_TEMPORAL = "temporal";
-
- /**
- * Date (often a range) of validity of a resource.
- */
- static final String TERM_VALID = "valid";
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/metadata/dublincore/DublinCoreHelper.java b/trunk/src/java/org/apache/lenya/cms/metadata/dublincore/DublinCoreHelper.java
deleted file mode 100644
index deb9fe6..0000000
--- a/trunk/src/java/org/apache/lenya/cms/metadata/dublincore/DublinCoreHelper.java
+++ /dev/null
@@ -1,54 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata.dublincore;
-
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.metadata.MetaDataException;
-import org.apache.lenya.cms.metadata.MetaDataOwner;
-import org.apache.lenya.cms.publication.Document;
-
-/**
- * Helper class to access dublin core meta data.
- */
-public class DublinCoreHelper {
-
- /**
- * @param owner The owner.
- * @return The dublin core title or <code>null</code> if the title is not set.
- * @throws MetaDataException if the owner has no dublin core meta data.
- */
- public static String getTitle(MetaDataOwner owner) throws MetaDataException {
- return getDublinCore(owner).getFirstValue(DublinCore.ELEMENT_TITLE);
- }
-
- /**
- * @param doc The document.
- * @param fallbackToUuid If the dublin core title is <code>null</code>, the document's UUID is returned.
- * @return The dublin core title.
- * @throws MetaDataException if the document has no dublin core meta data.
- */
- public static String getTitle(Document doc, boolean fallbackToUuid) throws MetaDataException {
- String title = DublinCoreHelper.getTitle(doc);
- return title == null ? doc.getUUID() : title;
- }
-
- protected static MetaData getDublinCore(MetaDataOwner owner) throws MetaDataException {
- return owner.getMetaData(DublinCore.DC_NAMESPACE);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/module/ModuleException.java b/trunk/src/java/org/apache/lenya/cms/module/ModuleException.java
deleted file mode 100644
index dee3225..0000000
--- a/trunk/src/java/org/apache/lenya/cms/module/ModuleException.java
+++ /dev/null
@@ -1,54 +0,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.
- *
- */
-package org.apache.lenya.cms.module;
-
-/**
- * Module exception.
- */
-public class ModuleException extends Exception {
-
- /**
- *
- */
- public ModuleException() {
- super();
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public ModuleException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- /**
- * @param arg0
- */
- public ModuleException(String arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- */
- public ModuleException(Throwable arg0) {
- super(arg0);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/module/ModuleManager.java b/trunk/src/java/org/apache/lenya/cms/module/ModuleManager.java
deleted file mode 100644
index f76d3eb..0000000
--- a/trunk/src/java/org/apache/lenya/cms/module/ModuleManager.java
+++ /dev/null
@@ -1,44 +0,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.
- *
- */
-package org.apache.lenya.cms.module;
-
-/**
- * Module manager.
- */
-public interface ModuleManager {
-
- /**
- * The Avalon role.
- */
- String ROLE = ModuleManager.class.getName();
-
- /**
- * Returns the base URI of a module directory.
- * @param moduleShortcut The module shortcut.
- * @return A string.
- * @throws ModuleException if there is no module for this shortcut.
- */
- String getBaseURI(String moduleShortcut) throws ModuleException;
-
- /**
- * Returns a listing of all module id (shortcuts)
- * @return Map
- */
- String[] getModuleIds();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/observation/AbstractRepositoryListener.java b/trunk/src/java/org/apache/lenya/cms/observation/AbstractRepositoryListener.java
deleted file mode 100644
index dac3e0f..0000000
--- a/trunk/src/java/org/apache/lenya/cms/observation/AbstractRepositoryListener.java
+++ /dev/null
@@ -1,55 +0,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.
- *
- */
-package org.apache.lenya.cms.observation;
-
-import org.apache.avalon.framework.activity.Startable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-
-/**
- * Abstract repository listener implementation which registeres with the observation
- * registry at startup.
- */
-public abstract class AbstractRepositoryListener extends AbstractLogEnabled implements Serviceable,
- Startable, ThreadSafe, RepositoryListener {
-
- public void start() throws Exception {
- ObservationRegistry registry = null;
- try {
- registry = (ObservationRegistry) this.manager.lookup(ObservationRegistry.ROLE);
- registry.registerListener(this);
- } finally {
- if (registry != null) {
- this.manager.release(registry);
- }
- }
- }
-
- public void stop() throws Exception {
- }
-
- protected ServiceManager manager;
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/observation/DocumentEvent.java b/trunk/src/java/org/apache/lenya/cms/observation/DocumentEvent.java
deleted file mode 100644
index d88799a..0000000
--- a/trunk/src/java/org/apache/lenya/cms/observation/DocumentEvent.java
+++ /dev/null
@@ -1,100 +0,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.
- *
- */
-package org.apache.lenya.cms.observation;
-
-import org.apache.lenya.cms.publication.ResourceType;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * Document-related event.
- */
-public class DocumentEvent extends RepositoryEvent {
-
- private String pubId;
- private String area;
- private String uuid;
- private String language;
- private ResourceType resourceType;
-
-
- /**
- * The change action.
- */
- public static final Object CHANGED = "changed";
- /**
- * The removal action.
- */
- public static final Object REMOVED = "removed";
-
- /**
- * Ctor.
- * @param session The session.
- * @param pubId The publication ID.
- * @param area The area.
- * @param uuid The UUID.
- * @param language The language.
- * @param resourceType The resource type.
- * @param descriptor More information about the event, for example
- * {@link #CHANGED} or {@link #REMOVED}.
- */
- public DocumentEvent(Session session, String pubId, String area, String uuid, String language,
- ResourceType resourceType, Object descriptor) {
- super(session, descriptor);
- this.pubId = pubId;
- this.area = area;
- this.uuid = uuid;
- this.language = language;
- this.resourceType = resourceType;
- }
-
- /**
- * @return The area.
- */
- public String getArea() {
- return area;
- }
-
- /**
- * @return The publication ID.
- */
- public String getPublicationId() {
- return pubId;
- }
-
- /**
- * @return The UUID.
- */
- public String getUuid() {
- return uuid;
- }
-
- /**
- * @return The language.
- */
- public String getLanguage() {
- return language;
- }
-
- /**
- * @return The resource type.
- */
- public ResourceType getResourceType() {
- return this.resourceType;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/observation/ObservationException.java b/trunk/src/java/org/apache/lenya/cms/observation/ObservationException.java
deleted file mode 100644
index 01c1ce9..0000000
--- a/trunk/src/java/org/apache/lenya/cms/observation/ObservationException.java
+++ /dev/null
@@ -1,56 +0,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.
- *
- */
-package org.apache.lenya.cms.observation;
-
-/**
- * Observation-specific exception.
- */
-public class ObservationException extends Exception {
-
- private static final long serialVersionUID = -4025029670092614593L;
-
- /**
- *
- */
- public ObservationException() {
- super();
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public ObservationException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- /**
- * @param arg0
- */
- public ObservationException(String arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- */
- public ObservationException(Throwable arg0) {
- super(arg0);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/observation/ObservationRegistry.java b/trunk/src/java/org/apache/lenya/cms/observation/ObservationRegistry.java
deleted file mode 100644
index a81f54d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/observation/ObservationRegistry.java
+++ /dev/null
@@ -1,46 +0,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.
- *
- */
-package org.apache.lenya.cms.observation;
-
-import org.apache.lenya.cms.publication.Document;
-
-/**
- * Observation registry.
- */
-public interface ObservationRegistry extends RepositoryListener {
-
- /**
- * The Avalon service role.
- */
- String ROLE = ObservationRegistry.class.getName();
-
- /**
- * @param listener The listener.
- * @param document The document to listen to.
- * @throws ObservationException if the listener is already registered for this document.
- */
- void registerListener(RepositoryListener listener, Document document) throws ObservationException;
-
- /**
- * Registers a listener which is notified for all events.
- * @param listener The listener.
- * @throws ObservationException if the listener is already registered.
- */
- void registerListener(RepositoryListener listener) throws ObservationException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java b/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java
deleted file mode 100644
index d52daa7..0000000
--- a/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java
+++ /dev/null
@@ -1,59 +0,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.
- *
- */
-package org.apache.lenya.cms.observation;
-
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.Assert;
-
-/**
- * A repository event provides additional information if a document was added, changed, or removed.
- */
-public class RepositoryEvent {
-
- private Session session;
- private Object descriptor = null;
-
- /**
- * Ctor.
- * @param session The session.
- * @param descriptor More information about the event.
- */
- public RepositoryEvent(Session session, Object descriptor) {
-
- Assert.notNull("session", session);
- this.session = session;
-
- Assert.notNull("descriptor", descriptor);
- this.descriptor = descriptor;
- }
-
- /**
- * @return The session.
- */
- public Session getSession() {
- return this.session;
- }
-
- /**
- * @return The descriptor.
- */
- public Object getDescriptor() {
- return this.descriptor;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java b/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java
deleted file mode 100644
index 1bf0d54..0000000
--- a/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java
+++ /dev/null
@@ -1,141 +0,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.
- *
- */
-package org.apache.lenya.cms.observation;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * Factory to create repository events.
- */
-public class RepositoryEventFactory {
-
- /**
- * Creates a repository event for a node.
- * @param manager The service manager.
- * @param session The session.
- * @param logger The logger.
- * @param descriptor The descriptor.
- * @return An event.
- */
- public static final RepositoryEvent createEvent(ServiceManager manager,
- Session session, Logger logger, Object descriptor) {
- return new RepositoryEvent(session, descriptor);
- }
-
- /**
- * Creates a repository event for a node.
- * @param manager The service manager.
- * @param doc The document.
- * @param logger The logger.
- * @param descriptor The descriptor.
- * @return An event.
- */
- public static final RepositoryEvent createEvent(ServiceManager manager, Document doc,
- Logger logger, Object descriptor) {
- try {
- return new DocumentEvent(doc.getRepositoryNode().getSession(), doc.getPublication()
- .getId(), doc.getArea(), doc.getUUID(), doc.getLanguage(), doc
- .getResourceType(), descriptor);
- } catch (DocumentException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- /**
- * Creates a repository event for a node.
- * @param manager The service manager.
- * @param node The node.
- * @param logger The logger.
- * @param descriptor The descriptor.
- * @return An event.
- */
- public static final RepositoryEvent createEvent(ServiceManager manager, Node node,
- Logger logger, Object descriptor) {
- RepositoryEvent event;
- Document doc = null;
- if (!node.getSourceURI().endsWith("meta")) {
- doc = getDocument(manager, node, logger);
- }
- if (doc != null) {
- event = createEvent(manager, doc, logger, descriptor);
- } else {
- event = new RepositoryEvent(node.getSession(), descriptor);
- }
- return event;
- }
-
- /**
- * @param manager The service manager.
- * @param node The node.
- * @param logger The logger.
- * @return The document represented by the node or <code>null</code> if
- * the node doesn't represent a document.
- */
- protected static final Document getDocument(ServiceManager manager, Node node, Logger logger) {
-
- final String sourceUri = node.getSourceURI();
- if (sourceUri.endsWith(".xml")) {
- return null;
- }
-
- Document doc = null;
-
- if (!sourceUri.startsWith("lenya://")) {
- throw new IllegalStateException("The source URI [" + sourceUri
- + "] doesn't start with lenya://");
- }
-
- String path = sourceUri.substring("lenya://lenya/pubs/".length());
-
- String[] steps = path.split("/");
- String pubId = steps[0];
- String area = steps[2];
-
- try {
-
- DocumentFactory factory = DocumentUtil
- .createDocumentFactory(manager, node.getSession());
- Publication pub = factory.getPublication(pubId);
- String docPath = path.substring((pubId + "/content/" + area).length());
-
- String uuid = docPath.substring(1, docPath.length() - "/en".length());
- String language = docPath.substring(docPath.length() - "en".length());
-
- doc = factory.get(pub, area, uuid, language);
-
- if (doc == null) {
- // this happens if the node was not a document node
- logger.info("No document found for node [" + sourceUri + "]");
- }
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return doc;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/observation/RepositoryListener.java b/trunk/src/java/org/apache/lenya/cms/observation/RepositoryListener.java
deleted file mode 100644
index 463d023..0000000
--- a/trunk/src/java/org/apache/lenya/cms/observation/RepositoryListener.java
+++ /dev/null
@@ -1,31 +0,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.
- *
- */
-package org.apache.lenya.cms.observation;
-
-/**
- * Listener to repository events.
- */
-public interface RepositoryListener {
-
- /**
- * Called when an event was fired.
- * @param event The event.
- */
- void eventFired(RepositoryEvent event);
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/Area.java b/trunk/src/java/org/apache/lenya/cms/publication/Area.java
deleted file mode 100644
index f80bf39..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/Area.java
+++ /dev/null
@@ -1,63 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import org.apache.lenya.cms.site.SiteStructure;
-
-/**
- * An area.
- */
-public interface Area {
-
- /**
- * @return The name of the area ("authoring", "live", etc.).
- */
- String getName();
-
- /**
- * @return The publication the area belongs to.
- */
- Publication getPublication();
-
- /**
- * @return The site structure of the area.
- */
- SiteStructure getSite();
-
- /**
- * @param uuid The UUID.
- * @param language The language.
- * @return A document.
- * @throws PublicationException if the document is not contained.
- */
- Document getDocument(String uuid, String language) throws PublicationException;
-
- /**
- * Checks if a document is contained.
- * @param uuid The UUID.
- * @param language The language.
- * @return A boolean value.
- */
- boolean contains(String uuid, String language);
-
- /**
- * @return All documents in this area.
- */
- Document[] getDocuments();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java b/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java
deleted file mode 100644
index 3be08bb..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java
+++ /dev/null
@@ -1,225 +0,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.
- *
- */
-
-package org.apache.lenya.cms.publication;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.lenya.cms.site.SiteNode;
-
-/**
- * Default document builder implementation.
- *
- * @version $Id$
- */
-public class DefaultDocumentBuilder extends AbstractLogEnabled implements DocumentBuilder,
- Serviceable, ThreadSafe {
-
- /**
- * Ctor.
- */
- public DefaultDocumentBuilder() {
- }
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager manager) {
- this.manager = manager;
- }
-
- protected ServiceManager manager;
-
- /**
- * Removes all "."-separated extensions from a URL (e.g.,
- * <code>/foo.print.html</code> is transformed to <code>/foo</code>).
- * @param url The URL to trim.
- * @return A URL string.
- */
- protected String removeExtensions(String url) {
- int dotIndex = url.indexOf(".");
- if (dotIndex > -1) {
- url = url.substring(0, dotIndex);
- }
- return url;
- }
-
- /**
- * Returns the language of a URL.
- * @param urlWithoutSuffix The URL without the suffix.
- * @return A string.
- */
- protected String getLanguage(String urlWithoutSuffix) {
-
- String language = "";
- String url = urlWithoutSuffix;
-
- int languageSeparatorIndex = url.lastIndexOf("_");
- if (languageSeparatorIndex > -1) {
- String suffix = url.substring(languageSeparatorIndex + 1);
- if (suffix.length() <= 5) {
- language = suffix;
- }
- }
- return language;
- }
-
- /**
- * Returns the extension of a URL.
- * @param url The URL.
- * @return The extension.
- */
- protected String getExtension(String url) {
- int startOfSuffix = url.lastIndexOf('.');
- String suffix = "";
-
- if ((startOfSuffix > -1) && !url.endsWith(".")) {
- suffix = url.substring(startOfSuffix + 1);
- }
-
- return suffix;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentBuilder#isDocument(DocumentFactory,
- * String)
- */
- public boolean isDocument(DocumentFactory factory, String url) throws DocumentBuildException {
- try {
- DocumentLocator locator = getLocatorWithoutCheck(factory, url);
- if (locator != null) {
- Publication pub = factory.getPublication(locator.getPublicationId());
- String path = locator.getPath();
- Area area = pub.getArea(locator.getArea());
- if (area.getSite().contains(path)) {
- SiteNode node = area.getSite().getNode(path);
- if (node.hasLink(locator.getLanguage())) {
- return true;
- }
- }
- }
- } catch (Exception e) {
- throw new DocumentBuildException(e);
- }
-
- return false;
- }
-
- /**
- * Builds the canonical document URL.
- * @param factory The document factory.
- * @param locator The document locator.
- * @return A string.
- */
- protected String buildCanonicalDocumentUrl(DocumentFactory factory, DocumentLocator locator) {
-
- String languageSuffix = "";
- String language = locator.getLanguage();
-
- Publication pub;
- try {
- pub = factory.getPublication(locator.getPublicationId());
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
-
- if (!language.equals(pub.getDefaultLanguage())) {
- languageSuffix = "_" + language;
- }
-
- String url = locator.getPath() + languageSuffix + ".html";
- return url;
- }
-
- public String buildCanonicalUrl(DocumentFactory factory, DocumentLocator doc) {
-
- String documentUrl = buildCanonicalDocumentUrl(factory, doc);
- String url = "/" + doc.getPublicationId() + "/" + doc.getArea() + documentUrl;
- return url;
- }
-
- public DocumentLocator getLocator(DocumentFactory factory, String webappUrl)
- throws DocumentBuildException {
-
- DocumentLocator locator = getLocatorWithoutCheck(factory, webappUrl);
- if (locator == null) {
- throw new DocumentBuildException("The webapp URL [" + webappUrl
- + "] does not refer to a document!");
- }
- return locator;
- }
-
- /**
- * Creates a document locator for a webapp URL without checking if the
- * webapp URL refers to a locator first.
- * @param factory The document factory.
- * @param webappUrl The webapp URL.
- * @return A document locator or <code>null</code> if the URL doesn't
- * refer to a locator.
- * @throws DocumentBuildException if an error occurs.
- */
- protected DocumentLocator getLocatorWithoutCheck(DocumentFactory factory, String webappUrl)
- throws DocumentBuildException {
-
- if (!webappUrl.startsWith("/")) {
- return null;
- }
- if (webappUrl.substring(1).split("/").length < 3) {
- return null;
- }
-
- URLInformation info = new URLInformation(webappUrl);
-
- Publication publication;
- try {
- publication = PublicationUtil.getPublicationFromUrl(this.manager, factory, webappUrl);
- } catch (PublicationException e) {
- throw new DocumentBuildException(e);
- }
-
- String documentURL = info.getDocumentUrl();
-
- documentURL = removeExtensions(documentURL);
-
- String language = getLanguage(documentURL);
- String fullLanguage = "".equals(language) ? "" : ("_" + language);
- documentURL = documentURL.substring(0, documentURL.length() - fullLanguage.length());
-
- if ("".equals(language)) {
- language = publication.getDefaultLanguage();
- }
-
- String path = documentURL;
-
- if (!path.startsWith("/")) {
- throw new DocumentBuildException("Path [" + path + "] does not start with '/'!");
- }
-
- return DocumentLocator.getLocator(publication.getId(), info.getArea(), path, language);
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentBuilder#isValidDocumentName(java.lang.String)
- */
- public boolean isValidDocumentName(String documentName) {
- return documentName.matches("[a-zA-Z0-9\\-]+");
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentIdToPathMapper.java b/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentIdToPathMapper.java
deleted file mode 100644
index 70fe502..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentIdToPathMapper.java
+++ /dev/null
@@ -1,133 +0,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.
- *
- */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-
-/**
- * Default DocumentIdToPathMapper implementation.
- *
- * @version $Id$
- */
-public class DefaultDocumentIdToPathMapper implements DocumentIdToPathMapper,
- PathToDocumentIdMapper {
-
- /**
- * The file name.
- */
- public static final String BASE_FILENAME_PREFIX = "index";
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentIdToPathMapper#getFile(org.apache.lenya.cms.publication.Publication,
- * java.lang.String, java.lang.String, java.lang.String)
- */
- public File getFile(Publication publication, String area, String uuid, String language) {
- File file = new File(getDirectory(publication, area), getPath(uuid, language));
- return file;
- }
-
- protected File getDirectory(Publication publication, String area) {
-
- File file = new File(publication.getDirectory(), Publication.CONTENT_PATH + File.separator
- + area);
-
- return file;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentIdToPathMapper#getPath(java.lang.String,
- * java.lang.String)
- */
- public String getPath(String uuid, String language) {
- if (uuid.startsWith("/")) {
- return uuid.substring(1) + "/" + getFilename(language);
- }
- else {
- return uuid + "/" + language;
- }
- }
-
- /**
- * Constructs the filename for a given language.
- *
- * @param language The language.
- * @return A string value.
- */
- protected String getFilename(String language) {
- String languageSuffix = "";
- if (language != null && !"".equals(language)) {
- languageSuffix = "_" + language;
- }
- return BASE_FILENAME_PREFIX + languageSuffix;
- }
-
- /**
- * Returns the document ID for a certain file.
- * @param publication The publication.
- * @param area The area.
- * @param file The file representing the document.
- * @return A string.
- * @throws DocumentDoesNotExistException when the document referenced by the file does not
- * exist.
- */
- public String getDocumentId(Publication publication, String area, File file)
- throws DocumentDoesNotExistException {
-
- String fileName = file.getAbsolutePath();
- String contentDirName = publication.getContentDirectory(area).getAbsolutePath();
- if (fileName.startsWith(contentDirName)) {
- // trim everything up to the documentId
- String relativeFileName = fileName.substring(contentDirName.length());
- // trim everything after the documentId
- relativeFileName = relativeFileName.substring(0,
- relativeFileName.lastIndexOf(File.separator));
- // and replace the os specific separator by '/'
- return relativeFileName.replace(File.separatorChar, '/');
- }
- // Document does not seem to exist
- throw new DocumentDoesNotExistException("No document associated with file" + fileName);
- }
-
- /**
- * Returns the language for a certain file
- *
- * @param file the document file
- *
- * @return the language for the given document file or null if the file has no language.
- */
- public String getLanguage(File file) {
- String fileName = file.getName();
- String language = null;
-
- int lastDotIndex = fileName.lastIndexOf(".");
- String suffix = fileName.substring(lastDotIndex);
-
- // check if the file is of the form index.html or index_en.html
-
- if (fileName.startsWith(BASE_FILENAME_PREFIX) && fileName.endsWith(suffix)) {
- String languageSuffix = fileName.substring(BASE_FILENAME_PREFIX.length(),
- fileName.indexOf(suffix));
- if (languageSuffix.length() > 0) {
- // trim the leading '_'
- language = languageSuffix.substring(1);
- }
- }
- return language;
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/Document.java b/trunk/src/java/org/apache/lenya/cms/publication/Document.java
deleted file mode 100644
index aada0d1..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/Document.java
+++ /dev/null
@@ -1,326 +0,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.
- *
- */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Date;
-
-import org.apache.lenya.cms.metadata.MetaDataOwner;
-import org.apache.lenya.cms.publication.util.DocumentVisitor;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.RepositoryItem;
-import org.apache.lenya.cms.site.Link;
-
-/**
- * A CMS document.
- * @version $Id$
- */
-public interface Document extends MetaDataOwner, RepositoryItem {
-
- /**
- * The document namespace URI.
- */
- String NAMESPACE = "http://apache.org/cocoon/lenya/document/1.0";
-
- /**
- * The default namespace prefix.
- */
- String DEFAULT_PREFIX = "lenya";
-
- /**
- * The transactionable type for document objects.
- */
- String TRANSACTIONABLE_TYPE = "document";
-
- /**
- * <code>DOCUMENT_META_SUFFIX</code> The suffix for document meta Uris
- */
- final String DOCUMENT_META_SUFFIX = ".meta";
-
- /**
- * Returns the date at which point the requested document is considered expired
- * @return a string in RFC 1123 date format
- * @throws DocumentException if an error occurs.
- */
- Date getExpires() throws DocumentException;
-
- /**
- * Returns the document name of this document.
- * @return the document-name of this document.
- */
- String getName();
-
- /**
- * Returns the publication this document belongs to.
- * @return A publication object.
- */
- Publication getPublication();
-
- /**
- * Returns the canonical web application URL.
- * @return A string.
- */
- String getCanonicalWebappURL();
-
- /**
- * Returns the canonical document URL.
- * @return A string.
- */
- String getCanonicalDocumentURL();
-
- /**
- * Returns the language of this document.
- * Each document has one language associated to it.
- * @return A string denoting the language.
- */
- String getLanguage();
-
- /**
- * Returns all the languages this document is available in.
- * A document has one associated language (@see Document#getLanguage)
- * but there are possibly a number of other languages for which a
- * document with the same document-uuid is also available in.
- *
- * @return An array of strings denoting the languages.
- *
- * @throws DocumentException if an error occurs
- */
- String[] getLanguages() throws DocumentException;
-
- /**
- * Returns the date of the last modification of this document.
- * @return A date denoting the date of the last modification.
- * @throws DocumentException if an error occurs.
- */
- long getLastModified() throws DocumentException;
-
- /**
- * Returns the area this document belongs to.
- * @return The area.
- */
- String getArea();
-
- /**
- * Returns the file for this document.
- * @return A file object.
- * @deprecated This implies the usage of a filesystem based storage. Use {@link #getSourceURI()} instead.
- */
- File getFile();
-
- /**
- * Returns the extension in the URL without the dot.
- * @return A string.
- */
- String getExtension();
-
- /**
- * Returns the UUID.
- * @return A string.
- */
- String getUUID();
-
- /**
- * Check if a document with the given document-uuid, language and in the given
- * area actually exists.
- *
- * @return true if the document exists, false otherwise
- *
- * @throws DocumentException if an error occurs
- */
- boolean exists() throws DocumentException;
-
- /**
- * Check if a document exists with the given document-uuid and the given area
- * independently of the given language.
- *
- * @return true if a document with the given document-uuid and area exists, false otherwise
- *
- * @throws DocumentException if an error occurs
- */
- boolean existsInAnyLanguage() throws DocumentException;
-
- /**
- * Returns the identity map this document belongs to.
- * @return A document identity map.
- */
- DocumentFactory getFactory();
-
- /**
- * Returns the URI to resolve the document's source.
- * The source can only be used for read-only access.
- * For write access, use {@link #getOutputStream()}.
- * @return A string.
- */
- String getSourceURI();
-
- /**
- * @return The output stream to write the document content to.
- */
- OutputStream getOutputStream();
-
- /**
- * Accepts a document visitor.
- * @param visitor The visitor.
- * @throws PublicationException if an error occurs.
- */
- void accept(DocumentVisitor visitor) throws PublicationException;
-
- /**
- * Deletes the document.
- * @throws DocumentException if an error occurs.
- */
- void delete() throws DocumentException;
-
- /**
- * @return The repository node that represents this document.
- */
- Node getRepositoryNode();
-
- /**
- * @return The resource type of this document (formerly known as doctype)
- * @throws DocumentException if an error occurs.
- */
- ResourceType getResourceType() throws DocumentException;
-
- /**
- * @param resourceType The resource type of this document.
- */
- void setResourceType(ResourceType resourceType);
-
- /**
- * @return The source extension used by this document, without the dot.
- */
- String getSourceExtension();
-
- /**
- * @param extension The source extension used by this document, without the dot.
- */
- void setSourceExtension(String extension);
-
- /**
- * Sets the mime type of this document.
- * @param mimeType The mime type.
- * @throws DocumentException if an error occurs.
- */
- void setMimeType(String mimeType) throws DocumentException;
-
- /**
- * @return The mime type of this document.
- * @throws DocumentException if an error occurs.
- */
- String getMimeType() throws DocumentException;
-
- /**
- * @return The content length of the document.
- * @throws DocumentException if an error occurs.
- */
- long getContentLength() throws DocumentException;
-
- /**
- * @return The document identifier for this document.
- */
- DocumentIdentifier getIdentifier();
-
- /**
- * This is a shortcut to getLink().getNode().getPath().
- * @return The path of this document in the site structure.
- * @throws DocumentException if the document is not linked in the site structure.
- */
- String getPath() throws DocumentException;
-
- /**
- * Checks if a certain translation (language version) of this document exists.
- * @param language The language.
- * @return A boolean value.
- */
- boolean existsTranslation(String language);
-
- /**
- * Returns a certain translation (language version) of this document.
- * @param language The language.
- * @return A document.
- * @throws DocumentException if the language version doesn't exist.
- */
- Document getTranslation(String language) throws DocumentException;
-
- /**
- * Checks if this document exists in a certain area.
- * @param area The area.
- * @return A boolean value.
- */
- boolean existsAreaVersion(String area);
-
- /**
- * Returns the document in a certain area.
- * @param area The area.
- * @return A document.
- * @throws DocumentException if the area version doesn't exist.
- */
- Document getAreaVersion(String area) throws DocumentException;
-
- /**
- * Checks if a translation of this document exists in a certain area.
- * @param area The area.
- * @param language The language.
- * @return A boolean value.
- */
- boolean existsVersion(String area, String language);
-
- /**
- * Returns a translation of this document in a certain area.
- * @param area The area.
- * @param language The language.
- * @return A document.
- * @throws DocumentException if the area version doesn't exist.
- */
- Document getVersion(String area, String language) throws DocumentException;
-
- /**
- * @return A document locator.
- */
- DocumentLocator getLocator();
-
- /**
- * @return The link to this document in the site structure.
- * @throws DocumentException if the document is not referenced in the site structure.
- */
- Link getLink() throws DocumentException;
-
- /**
- * @return The area the document belongs to.
- */
- Area area();
-
- /**
- * @return if the document is linked in the site structure.
- */
- boolean hasLink();
-
- /**
- * @return The input stream to obtain the document's content.
- */
- InputStream getInputStream();
-
- /**
- * @return The revision number of this document.
- */
- int getRevisionNumber();
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DocumentBuildException.java b/trunk/src/java/org/apache/lenya/cms/publication/DocumentBuildException.java
deleted file mode 100644
index 59ebdb8..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DocumentBuildException.java
+++ /dev/null
@@ -1,63 +0,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.
- *
- */
-
-package org.apache.lenya.cms.publication;
-
-/**
- * Document build exception.
- *
- * @version $Id$
- */
-public class DocumentBuildException extends PublicationException {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor.
- */
- public DocumentBuildException() {
- super();
- }
-
- /**
- * Constructor.
- * @param message A message.
- */
- public DocumentBuildException(String message) {
- super(message);
- }
-
- /**
- * Constructor.
- * @param cause The cause of the exception.
- */
- public DocumentBuildException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Constructor.
- * @param message A message.
- * @param cause The cause of the exception.
- */
- public DocumentBuildException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DocumentBuilder.java b/trunk/src/java/org/apache/lenya/cms/publication/DocumentBuilder.java
deleted file mode 100644
index e04b34d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DocumentBuilder.java
+++ /dev/null
@@ -1,66 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-/**
- * A document builder builds a document from a URL.
- */
-public interface DocumentBuilder {
-
- /**
- * The Avalon role.
- */
- String ROLE = DocumentBuilder.class.getName();
-
- /**
- * Returns a document for a web application URL.
- * @param factory The factory.
- * @param webappUrl The web application URL.
- * @return A document identifier.
- * @throws DocumentBuildException if an error occurs.
- */
- DocumentLocator getLocator(DocumentFactory factory, String webappUrl) throws DocumentBuildException;
-
- /**
- * Checks if an URL corresponds to a CMS document.
- * @param factory The document factory.
- * @param url The URL of the form /{publication-id}/...
- * @return A boolean value.
- * @throws DocumentBuildException when something went wrong.
- */
- boolean isDocument(DocumentFactory factory, String url) throws DocumentBuildException;
-
- /**
- * Builds an URL corresponding to a CMS document.
- * @param factory The document factory.
- * @param locator The locator.
- * @return a String The corresponding URL.
- */
- String buildCanonicalUrl(DocumentFactory factory, DocumentLocator locator);
-
- /**
- * Checks if a document name is valid.
- * @param documentName The document name.
- * @return A boolean value.
- */
- boolean isValidDocumentName(String documentName);
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DocumentDoesNotExistException.java b/trunk/src/java/org/apache/lenya/cms/publication/DocumentDoesNotExistException.java
deleted file mode 100644
index 7f4f15c..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DocumentDoesNotExistException.java
+++ /dev/null
@@ -1,66 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-/**
- * Document does not exist exception
- */
-public class DocumentDoesNotExistException extends DocumentException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates a new DocumentDoesNotExistException
- *
- */
- public DocumentDoesNotExistException() {
- super();
- }
-
- /**
- * Creates a new DocumentDoesNotExistException
- * @param message the exception message
- */
- public DocumentDoesNotExistException(String message) {
- super(message);
- }
-
- /**
- * Creates a new DocumentDoesNotExistException
- * @param message the exception message
- * @param cause the cause of the exception
- */
- public DocumentDoesNotExistException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Creates a new DocumentDoesNotExistException
- * @param cause the cause of the exception
- */
- public DocumentDoesNotExistException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DocumentException.java b/trunk/src/java/org/apache/lenya/cms/publication/DocumentException.java
deleted file mode 100644
index 35ab77d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DocumentException.java
+++ /dev/null
@@ -1,69 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-/**
- * Document exception
- */
-public class DocumentException extends PublicationException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates a new DocumentException
- *
- */
- public DocumentException() {
- super();
- }
-
- /**
- * Creates a new DocumentException
- *
- * @param message the exception message
- */
- public DocumentException(String message) {
- super(message);
- }
-
- /**
- * Creates a new DocumentException
- *
- * @param message the exception message
- * @param cause the cause of the exception
- */
- public DocumentException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Creates a new DocumentException
- *
- * @param cause the cause of the exception
- */
- public DocumentException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DocumentFactory.java b/trunk/src/java/org/apache/lenya/cms/publication/DocumentFactory.java
deleted file mode 100644
index 07ba614..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DocumentFactory.java
+++ /dev/null
@@ -1,139 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import org.apache.lenya.cms.repository.RepositoryItemFactory;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * A DocumentIdentityMap avoids the multiple instanciation of a document object.
- *
- * @version $Id$
- */
-public interface DocumentFactory extends RepositoryItemFactory {
-
- /**
- * Returns a document.
- * @param identifier The identifier of the document.
- * @return A document.
- * @throws DocumentBuildException if the document does not exist.
- */
- Document get(DocumentIdentifier identifier) throws DocumentBuildException;
-
- /**
- * Returns a document.
- * @param publication The publication.
- * @param area The area.
- * @param uuid The document ID.
- * @param language The language.
- * @return A document.
- * @throws DocumentBuildException if the document does not exist.
- */
- Document get(Publication publication, String area, String uuid, String language)
- throws DocumentBuildException;
-
- /**
- * Returns a revision of a document.
- * @param publication The publication.
- * @param area The area.
- * @param uuid The document ID.
- * @param language The language.
- * @param revision The revision..
- * @return A document.
- * @throws DocumentBuildException if the document does not exist.
- */
- Document get(Publication publication, String area, String uuid, String language, int revision)
- throws DocumentBuildException;
-
- /**
- * Returns the document identified by a certain web application URL.
- * @param webappUrl The web application URL.
- * @return A document.
- * @throws DocumentBuildException if an error occurs.
- */
- Document getFromURL(String webappUrl) throws DocumentBuildException;
-
- /**
- * Builds a clone of a document for another language.
- * @param document The document to clone.
- * @param language The language of the target document.
- * @return A document.
- * @throws DocumentBuildException if an error occurs.
- * @deprecated use {@link DocumentLocator#getLanguageVersion(String)} instead.
- */
- Document getLanguageVersion(Document document, String language) throws DocumentBuildException;
-
- /**
- * Builds a clone of a document for another area.
- * @param document The document to clone.
- * @param area The area of the target document.
- * @return A document.
- * @throws DocumentBuildException if an error occurs.
- * @deprecated use {@link DocumentLocator#getAreaVersion(String)} instead.
- */
- Document getAreaVersion(Document document, String area) throws DocumentBuildException;
-
- /**
- * Builds a document for the default language.
- * @param publication The publication.
- * @param area The area.
- * @param uuid The document UUID.
- * @return A document.
- * @throws DocumentBuildException if an error occurs.
- */
- Document get(Publication publication, String area, String uuid)
- throws DocumentBuildException;
-
- /**
- * Checks if a webapp URL represents a document.
- * @param webappUrl A web application URL.
- * @return A boolean value.
- * @throws DocumentBuildException if an error occurs.
- */
- boolean isDocument(String webappUrl) throws DocumentBuildException;
-
- /**
- * @return The session.
- */
- Session getSession();
-
- /**
- * @param locator The locator.
- * @return A document.
- * @throws DocumentBuildException if an error occurs.
- */
- Document get(DocumentLocator locator) throws DocumentBuildException;
-
- /**
- * @param id The publication ID.
- * @return A publication.
- * @throws PublicationException if the publication does not exist.
- */
- Publication getPublication(String id) throws PublicationException;
-
- /**
- * @return All publications.
- */
- Publication[] getPublications();
-
- /**
- * @param id The publication ID.
- * @return If a publication with this ID exists.
- */
- boolean existsPublication(String id);
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DocumentFactoryBuilder.java b/trunk/src/java/org/apache/lenya/cms/publication/DocumentFactoryBuilder.java
deleted file mode 100644
index 8124157..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DocumentFactoryBuilder.java
+++ /dev/null
@@ -1,39 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * Document factory builder.
- */
-public interface DocumentFactoryBuilder {
-
- /**
- * The Avalon service role.
- */
- String ROLE = DocumentFactoryBuilder.class.getName();
-
- /**
- * Creates a new document factory.
- * @param session The session.
- * @return A document identity map.
- */
- DocumentFactory createDocumentFactory(Session session);
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdToPathMapper.java b/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdToPathMapper.java
deleted file mode 100644
index b2bd56f..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdToPathMapper.java
+++ /dev/null
@@ -1,53 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-
-/**
- * Document Id to Path mapper interface
- */
-public interface DocumentIdToPathMapper {
-
- /**
- * Compute the document-path for a given publication, area and document-uuid. The file separator
- * is the slash (/).
- *
- * @param uuid the UUID of the document
- * @param language the language of the document
- *
- * @return the path to the document, without publication ID and area
- */
- String getPath(String uuid, String language);
-
- /**
- * Compute the document-path for a given publication, area, document-uuid and language
- *
- * @param publication the publication of the document
- * @param area the area of the document
- * @param uuid the uuid of the document
- * @param language the language of the document
- *
- * @return the path to the document
- */
- File getFile(Publication publication, String area, String uuid, String language);
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentifier.java b/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentifier.java
deleted file mode 100644
index 38cac3e..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentifier.java
+++ /dev/null
@@ -1,97 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-/**
- * Value object to identify documents.
- */
-public class DocumentIdentifier {
-
- private String publicationId;
- private String area;
- private String language;
- private String uuid;
-
- /**
- * Ctor.
- * @param pubId The publication ID.
- * @param area The area.
- * @param uuid The document UUID.
- * @param language The language.
- */
- public DocumentIdentifier(String pubId, String area, String uuid, String language) {
-
- if (uuid.startsWith("/") && uuid.split("-").length == 4) {
- throw new IllegalArgumentException("The UUID [" + uuid + "] must not begin with a '/'!");
- }
- if (uuid.indexOf("/") > 0) {
- throw new IllegalArgumentException("The UUID [" + uuid
- + "] must not contain a '/' after the first position!");
- }
-
- this.publicationId = pubId;
- this.area = area;
- this.language = language;
- this.uuid = uuid;
- }
-
- /**
- * @return The UUID.
- */
- public String getUUID() {
- return this.uuid;
- }
-
- /**
- * @return The area.
- */
- public String getArea() {
- return area;
- }
-
- /**
- * @return The language.
- */
- public String getLanguage() {
- return language;
- }
-
- /**
- * @return The publication ID.
- */
- public String getPublicationId() {
- return publicationId;
- }
-
- public boolean equals(Object obj) {
- return (obj instanceof DocumentIdentifier) && obj.hashCode() == hashCode();
- }
-
- public int hashCode() {
- return getKey().hashCode();
- }
-
- protected String getKey() {
- return this.publicationId + ":" + this.area + ":" + this.uuid + ":" + this.language;
- }
-
- public String toString() {
- return getKey();
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DocumentLocator.java b/trunk/src/java/org/apache/lenya/cms/publication/DocumentLocator.java
deleted file mode 100644
index c5b3bca..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DocumentLocator.java
+++ /dev/null
@@ -1,199 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-/**
- * A DocumentLocator describes a document based on its path in the site structure. The actual
- * document doesn't have to exist.
- */
-public class DocumentLocator {
-
- private static Map locators = new WeakHashMap();
-
- /**
- * Returns a specific document locator.
- * @param pubId The publication ID.
- * @param area The area of the document.
- * @param path The path of the document in the site structure.
- * @param language The language of the document.
- * @return A document locator.
- */
- public static DocumentLocator getLocator(String pubId, String area, String path, String language) {
- String key = DocumentLocator.getKey(pubId, area, path, language);
- DocumentLocator locator = (DocumentLocator) locators.get(key);
- if (locator == null) {
- locator = new DocumentLocator(pubId, area, path, language);
- locators.put(key, locator);
- }
- return locator;
- }
-
- protected static final String getKey(String pubId, String area, String path, String language) {
- return pubId + ":" + area + ":" + path + ":" + language;
- }
-
- private String pubId;
- private String area;
- private String path;
- private String language;
-
- protected DocumentLocator(String pubId, String area, String path, String language) {
- this.path = path;
- this.pubId = pubId;
- this.area = area;
- this.language = language;
- }
-
- /**
- * @return The area of the document.
- */
- public String getArea() {
- return area;
- }
-
- /**
- * @return The language of the document.
- */
- public String getLanguage() {
- return language;
- }
-
- /**
- * @return The path of the document in the site structure.
- */
- public String getPath() {
- return path;
- }
-
- /**
- * @return The publication ID.
- */
- public String getPublicationId() {
- return pubId;
- }
-
- /**
- * Returns a locator with the same publication ID, area, and language, but a different path in
- * the site structure.
- * @param path The path.
- * @return A document locator.
- */
- public DocumentLocator getPathVersion(String path) {
- return DocumentLocator.getLocator(getPublicationId(), getArea(), path, getLanguage());
- }
-
- /**
- * Returns a descendant of this locator.
- * @param relativePath The relative path which must not begin with a slash and must not be
- * empty.
- * @return A document locator.
- */
- public DocumentLocator getDescendant(String relativePath) {
- if (relativePath.length() == 0) {
- throw new IllegalArgumentException("The relative path must not be empty!");
- }
- if (relativePath.startsWith("/")) {
- throw new IllegalArgumentException("The relative path must not start with a slash!");
- }
- return getPathVersion(getPath() + "/" + relativePath);
- }
-
- /**
- * Returns a child of this locator.
- * @param step The relative path to the child, it must not contain a slash.
- * @return A document locator.
- */
- public DocumentLocator getChild(String step) {
- if (step.indexOf("/") > -1) {
- throw new IllegalArgumentException("The step [" + step + "] must not contain a slash!");
- }
- return getDescendant(step);
- }
-
- /**
- * Returns the parent of this locator.
- * @return A document locator or <code>null</code> if this is the root locator.
- */
- public DocumentLocator getParent() {
- int lastSlashIndex = getPath().lastIndexOf("/");
- if (lastSlashIndex > -1) {
- String parentPath = getPath().substring(0, lastSlashIndex);
- return getPathVersion(parentPath);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the parent of this locator.
- * @param defaultPath The path of the locator to return if this is the root locator.
- * @return A document locator.
- */
- public DocumentLocator getParent(String defaultPath) {
- DocumentLocator parent = getParent();
- if (parent != null) {
- return parent;
- } else {
- return getPathVersion(defaultPath);
- }
- }
-
- /**
- * Returns a locator with the same publication ID, area, and path, but with a different
- * language.
- * @param language The language.
- * @return A document locator.
- */
- public DocumentLocator getLanguageVersion(String language) {
- return DocumentLocator.getLocator(getPublicationId(), getArea(), getPath(), language);
- }
-
- protected String getKey() {
- return DocumentLocator.getKey(getPublicationId(), getArea(), getPath(), getLanguage());
- }
-
- public boolean equals(Object obj) {
- if (!(obj instanceof DocumentLocator)) {
- return false;
- }
- DocumentLocator locator = (DocumentLocator) obj;
- return locator.getKey().equals(getKey());
- }
-
- public int hashCode() {
- return getKey().hashCode();
- }
-
- public String toString() {
- return getKey();
- }
-
- /**
- * Returns a locator with the same publication ID, path, and language, but with a different
- * area.
- * @param area The area.
- * @return A document locator.
- */
- public DocumentLocator getAreaVersion(String area) {
- return DocumentLocator.getLocator(getPublicationId(), area, getPath(), getLanguage());
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DocumentManager.java b/trunk/src/java/org/apache/lenya/cms/publication/DocumentManager.java
deleted file mode 100644
index 7eead02..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DocumentManager.java
+++ /dev/null
@@ -1,267 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import org.apache.lenya.cms.publication.util.DocumentSet;
-
-/**
- * Helper to manage documents. It takes care of attachments etc.
- *
- * @version $Id$
- */
-public interface DocumentManager {
-
- /**
- * The Avalon component role.
- */
- String ROLE = DocumentManager.class.getName();
-
- /**
- * Checks if a document exists.
- * @param factory The document factory.
- * @param pub The publication.
- * @param area The area.
- * @param uuid The UUID.
- * @param language The language.
- * @return A boolean value.
- * @throws PublicationException if an error occurs.
- */
- boolean exists(DocumentFactory factory, Publication pub, String area, String uuid,
- String language) throws PublicationException;
-
- /**
- * Copies a document from one location to another location.
- * @param sourceDocument The document to copy.
- * @param destination The destination document.
- * @throws PublicationException if a document which destinationDocument depends on does not
- * exist.
- */
- void copy(Document sourceDocument, DocumentLocator destination) throws PublicationException;
-
- /**
- * Copies a document to another area.
- * @param sourceDocument The document to copy.
- * @param destinationArea The destination area.
- * @throws PublicationException if a document which the destination document depends on does not
- * exist.
- */
- void copyToArea(Document sourceDocument, String destinationArea) throws PublicationException;
-
- /**
- * Copies a document set to another area.
- * @param documentSet The document set to copy.
- * @param destinationArea The destination area.
- * @throws PublicationException if a document which one of the destination documents depends on
- * does not exist.
- */
- void copyToArea(DocumentSet documentSet, String destinationArea) throws PublicationException;
-
- /**
- * Creates a new document in the same publication the <code>parentDocument</code> belongs to
- * with the given parameters:
- *
- * @param sourceDocument The document to initialize the contents and meta data from.
- * @param area The target area.
- * @param path The target path.
- * @param language The target language.
- * @param extension The extension to use for the document source.
- * @param navigationTitle navigation title
- * @param visibleInNav determines the visibility of a node in the navigation
- * @return The added document.
- *
- * @throws DocumentBuildException if the document can not be created
- * @throws PublicationException if the document is already contained.
- */
- Document add(Document sourceDocument, String area, String path, String language,
- String extension, String navigationTitle, boolean visibleInNav)
- throws DocumentBuildException, PublicationException;
-
- /**
- * Creates a new document with the given parameters:
- * @param factory The document factory.
- * @param resourceType the document type (aka resource type) of the new document
- * @param contentSourceUri The URI to read the content from.
- * @param pub The publication.
- * @param area The area.
- * @param path The path.
- * @param language The language.
- * @param extension The extension to use for the document source, without the leading dot.
- * @param navigationTitle The navigation title.
- * @param visibleInNav The navigation visibility.
- * @return The added document.
- *
- * @throws DocumentBuildException if the document can not be created
- * @throws PublicationException if the document is already contained.
- */
- Document add(DocumentFactory factory, ResourceType resourceType, String contentSourceUri,
- Publication pub, String area, String path, String language, String extension,
- String navigationTitle, boolean visibleInNav) throws DocumentBuildException,
- PublicationException;
-
- /**
- * Creates a new document without adding it to the site structure.
- * @param factory The document factory.
- * @param resourceType the document type (aka resource type) of the new document
- * @param contentSourceUri The URI to read the content from.
- * @param pub The publication.
- * @param area The area.
- * @param language The language.
- * @param extension The extension to use for the document source, without the leading dot.
- * @return The added document.
- *
- * @throws DocumentBuildException if the document can not be created
- * @throws PublicationException if the document is already contained.
- */
- Document add(DocumentFactory factory, ResourceType resourceType, String contentSourceUri,
- Publication pub, String area, String language, String extension)
- throws DocumentBuildException, PublicationException;
-
- /**
- * Adds a new version of a document with a different language and / or in a different area.
- *
- * @param sourceDocument The document to initialize the contents and meta data from.
- * @param area The area.
- * @param language The language of the new document.
- * @return The added document.
- *
- * @throws DocumentBuildException if the document can not be created
- * @throws PublicationException if the document is already contained.
- */
- Document addVersion(Document sourceDocument, String area, String language)
- throws DocumentBuildException, PublicationException;
-
- /**
- * Adds a new version of a document with a different language and / or in a different area.
- *
- * @param sourceDocument The document to initialize the contents and meta data from.
- * @param area The area.
- * @param language The language of the new document.
- * @param addToSite If the new version should be added to the site structure.
- * @return The added document.
- *
- * @throws DocumentBuildException if the document can not be created
- * @throws PublicationException if the document is already contained.
- */
- Document addVersion(Document sourceDocument, String area, String language, boolean addToSite)
- throws DocumentBuildException, PublicationException;
-
- /**
- * Deletes a document from the content repository and from the site structure.
- * @param document The document to delete.
- * @throws PublicationException when something went wrong.
- */
- void delete(Document document) throws PublicationException;
-
- /**
- * Moves a document from one location to another.
- * @param sourceDocument The source document.
- * @param destination The destination document.
- * @throws PublicationException if a document which the destination document depends on does not
- * exist.
- */
- void move(Document sourceDocument, DocumentLocator destination) throws PublicationException;
-
- /**
- * Moves a document set from one location to another. A source is moved to the destination of
- * the same position in the set.
- * @param sources The source documents.
- * @param destinations The destination documents.
- * @throws PublicationException if a document which the destination document depends on does not
- * exist.
- */
- void move(DocumentSet sources, DocumentSet destinations) throws PublicationException;
-
- /**
- * Copies a document set from one location to another. A source is copied to the destination of
- * the same position in the set.
- * @param sources The source documents.
- * @param destinations The destination documents.
- * @throws PublicationException if a document which the destination document depends on does not
- * exist.
- */
- void copy(DocumentSet sources, DocumentSet destinations) throws PublicationException;
-
- /**
- * Moves a document to another location, incl. all requiring documents. If a sitetree is used,
- * this means that the whole subtree is moved.
- * @param sourceArea The source area.
- * @param sourcePath The source path.
- * @param targetArea The target area.
- * @param targetPath The target path.
- * @throws PublicationException if an error occurs.
- */
- void moveAll(Area sourceArea, String sourcePath, Area targetArea, String targetPath)
- throws PublicationException;
-
- /**
- * Moves all language versions of a document to another location.
- * @param sourceArea The source area.
- * @param sourcePath The source path.
- * @param targetArea The target area.
- * @param targetPath The target path.
- * @throws PublicationException if the documents could not be moved.
- */
- void moveAllLanguageVersions(Area sourceArea, String sourcePath, Area targetArea,
- String targetPath) throws PublicationException;
-
- /**
- * Copies a document to another location, incl. all requiring documents. If a sitetree is used,
- * this means that the whole subtree is copied.
- * @param sourceArea The source area.
- * @param sourcePath The source path.
- * @param targetArea The target area.
- * @param targetPath The target path.
- * @throws PublicationException if an error occurs.
- */
- void copyAll(Area sourceArea, String sourcePath, Area targetArea, String targetPath)
- throws PublicationException;
-
- /**
- * Copies all language versions of a document to another location.
- * @param sourceArea The source area.
- * @param sourcePath The source path.
- * @param targetArea The target area.
- * @param targetPath The target path.
- * @throws PublicationException if the documents could not be copied.
- */
- void copyAllLanguageVersions(Area sourceArea, String sourcePath, Area targetArea,
- String targetPath) throws PublicationException;
-
- /**
- * Deletes a document, incl. all requiring documents. If a sitetree is used, this means that the
- * whole subtree is deleted.
- * @param document The document.
- * @throws PublicationException if an error occurs.
- */
- void deleteAll(Document document) throws PublicationException;
-
- /**
- * Deletes all language versions of a document.
- * @param document The document.
- * @throws PublicationException if the documents could not be copied.
- */
- void deleteAllLanguageVersions(Document document) throws PublicationException;
-
- /**
- * Deletes a set of documents.
- * @param documents The documents.
- * @throws PublicationException if an error occurs.
- */
- void delete(DocumentSet documents) throws PublicationException;
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/DocumentUtil.java b/trunk/src/java/org/apache/lenya/cms/publication/DocumentUtil.java
deleted file mode 100644
index 4035b68..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/DocumentUtil.java
+++ /dev/null
@@ -1,96 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Document utility class.
- */
-public final class DocumentUtil {
-
- private static DocumentFactoryBuilder builder;
-
- /**
- * Creates a document factory.
- * @param manager The service manager.
- * @param session The session.
- * @return a document factory.
- */
- public static final DocumentFactory createDocumentFactory(ServiceManager manager,
- Session session) {
- DocumentFactoryBuilder builder = getBuilder(manager);
- return builder.createDocumentFactory(session);
- }
-
- protected static DocumentFactoryBuilder getBuilder(ServiceManager manager) {
- if (DocumentUtil.builder == null) {
- try {
- DocumentUtil.builder = (DocumentFactoryBuilder) manager.lookup(DocumentFactoryBuilder.ROLE);
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- }
- }
- return DocumentUtil.builder;
- }
-
- /**
- * Returns a document factory for the session which is attached to the
- * request. If no session exists, it is created.
- * @param manager The service manager.
- * @param request The request.
- * @return A document factory.
- */
- public static DocumentFactory getDocumentFactory(ServiceManager manager, Request request) {
- Session session;
- try {
- session = RepositoryUtil.getSession(manager, request);
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- return createDocumentFactory(manager, session);
- }
-
- /**
- * Returns the currently requested document or <code>null</code> if no
- * document is requested.
- * @param manager The service manager.
- * @param request The request.
- * @return A document.
- * @throws RepositoryException if an error occurs.
- * @throws DocumentBuildException if an error occurs.
- */
- public static Document getCurrentDocument(ServiceManager manager, Request request)
- throws RepositoryException, DocumentBuildException {
- Session session = RepositoryUtil.getSession(manager, request);
- DocumentFactory factory = DocumentUtil.createDocumentFactory(manager, session);
- String url = ServletHelper.getWebappURI(request);
- Document doc = null;
- if (factory.isDocument(url)) {
- doc = factory.getFromURL(url);
- }
- return doc;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/IdentityDocumentIdToPathMapper.java b/trunk/src/java/org/apache/lenya/cms/publication/IdentityDocumentIdToPathMapper.java
deleted file mode 100644
index 1dc97dd..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/IdentityDocumentIdToPathMapper.java
+++ /dev/null
@@ -1,65 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-
-/**
- * Identity Document Id to path mapper
- */
-public class IdentityDocumentIdToPathMapper implements DocumentIdToPathMapper {
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentIdToPathMapper#getFile(org.apache.lenya.cms.publication.Publication,
- * java.lang.String, java.lang.String, java.lang.String)
- */
- public File getFile(Publication publication, String area, String documentId, String language) {
- File areaDirectory = new File(publication.getDirectory(), Publication.CONTENT_PATH
- + File.separator + area);
- File file = new File(areaDirectory, getPath(documentId, language));
- return file;
- }
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentIdToPathMapper#getPath(java.lang.String,
- * java.lang.String)
- */
- public String getPath(String documentId, String language) {
- assert documentId.startsWith("/");
- // remove leading slash
- documentId = documentId.substring(1);
- return documentId + getSuffix(language);
- }
-
- /**
- * Constructs the filename for a given language.
- * @param language The language.
- * @return A string value.
- */
- protected String getSuffix(String language) {
- String languageSuffix = "";
- if (language != null && !"".equals(language)) {
- languageSuffix = "_" + language;
- }
- return languageSuffix;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java b/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java
deleted file mode 100644
index d432d5d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java
+++ /dev/null
@@ -1,330 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-
-import org.apache.avalon.framework.logger.ConsoleLogger;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.cms.rc.RCEnvironment;
-
-/**
- * A page envelope carries a set of information that are needed during the presentation of a
- * document.
- */
-public class PageEnvelope {
- /**
- * The names of the page envelope parameters.
- */
- public static final String[] PARAMETER_NAMES = { PageEnvelope.AREA, PageEnvelope.CONTEXT,
- PageEnvelope.PUBLICATION_ID, PageEnvelope.PUBLICATION, PageEnvelope.IS_PUBLICATION,
- PageEnvelope.PUBLICATION_LANGUAGES_CSV, PageEnvelope.DOCUMENT,
- PageEnvelope.DOCUMENT_ID, PageEnvelope.DOCUMENT_PARENT, PageEnvelope.DOCUMENT_NAME,
- PageEnvelope.DOCUMENT_LABEL, PageEnvelope.DOCUMENT_URL,
- PageEnvelope.DOCUMENT_URL_WITHOUT_LANGUAGE, PageEnvelope.DOCUMENT_PATH,
- PageEnvelope.DOCUMENT_EXTENSION, PageEnvelope.DOCUMENT_SOURCE_EXTENSION,
- PageEnvelope.DOCUMENT_UUID, PageEnvelope.DOCUMENT_TYPE, PageEnvelope.DEFAULT_LANGUAGE,
- PageEnvelope.DOCUMENT_LANGUAGE, PageEnvelope.DOCUMENT_LANGUAGES,
- PageEnvelope.DOCUMENT_LANGUAGES_CSV, PageEnvelope.DOCUMENT_LASTMODIFIED,
- PageEnvelope.BREADCRUMB_PREFIX, PageEnvelope.SSL_PREFIX, PageEnvelope.LANGUAGE };
- /**
- * <code>PUBLICATION_ID</code> The publication id
- */
- public static final String PUBLICATION_ID = "publication-id";
- /**
- * <code>PUBLICATION</code> The publication
- */
- public static final String PUBLICATION = "publication";
- /**
- * <code>IS_PUBLICATION</code> If the current URL refers to a publication ("true" or "false").
- */
- public static final String IS_PUBLICATION = "is-publication";
- /**
- * <code>PUBLICATION_LANGUAGES_CSV</code> A list of the publication's languages,
- * comma-seperated
- */
- public static final String PUBLICATION_LANGUAGES_CSV = "publication-languages-csv";
- /**
- * <code>CONTEXT</code> The context prefix
- */
- public static final String CONTEXT = "context-prefix";
- /**
- * <code>AREA</code> The area
- */
- public static final String AREA = "area";
- /**
- * <code>DEFAULT_LANGUAGE</code> The default language of the publication
- */
- public static final String DEFAULT_LANGUAGE = "default-language";
- /**
- * <code>DOCUMENT</code> The current document
- */
- public static final String DOCUMENT = "document";
- /**
- * <code>DOCUMENT_ID</code> The document id of the current document
- */
- public static final String DOCUMENT_ID = "document-id";
- /**
- * <code>DOCUMENT_PARENT</code> The document id of the parent document
- */
- public static final String DOCUMENT_PARENT = "document-parent";
- /**
- * <code>DOCUMENT_NAME</code> The name of the current document
- */
- public static final String DOCUMENT_NAME = "document-name";
- /**
- * <code>DOCUMENT_TYPE</code> The type of the current document
- */
- public static final String DOCUMENT_TYPE = "document-type";
- /**
- * <code>DOCUMENT_LABEL</code> The label of the current document
- */
- public static final String DOCUMENT_LABEL = "document-label";
- /**
- * <code>DOCUMENT_URL</code> The URL of the current document
- */
- public static final String DOCUMENT_URL = "document-url";
- /**
- * <code>DOCUMENT_URL_WITHOUT_LANGUAGE</code> The URL of the current document without a
- * language extension.
- */
- public static final String DOCUMENT_URL_WITHOUT_LANGUAGE = "document-url-without-language";
- /**
- * <code>DOCUMENT_FILE</code> The file of the current document
- */
- public static final String DOCUMENT_FILE = "document-file";
- /**
- * <code>DOCUMENT_PATH</code> The path of the current document
- */
- public static final String DOCUMENT_PATH = "document-path";
- /**
- * <code>DOCUMENT_EXTENSION</code> The extension of the current document
- */
- public static final String DOCUMENT_EXTENSION = "document-extension";
- /**
- * <code>DOCUMENT_SOURCE_EXTENSION</code> The source extension of the current document
- */
- public static final String DOCUMENT_SOURCE_EXTENSION = "document-source-extension";
- /**
- * <code>DOCUMENT_UUID</code> The uuid of the current document
- */
- public static final String DOCUMENT_UUID = "document-uuid";
- /**
- * <code>DOCUMENT_LANGUAGE</code> The language of the current document
- */
- public static final String DOCUMENT_LANGUAGE = "document-language";
- /**
- * This attribute returns the document language if the document exists, or the
- * default language otherwise. This makes it suitable for 404 pages.
- */
- public static final String LANGUAGE = "language";
- /**
- * <code>DOCUMENT_LANGUAGES</code> The languages the current document is available in
- */
- public static final String DOCUMENT_LANGUAGES = "document-languages";
- /**
- * <code>DOCUMENT_LANGUAGES_CSV</code> The languages the current document is available in,
- * comma-seperated
- */
- public static final String DOCUMENT_LANGUAGES_CSV = "document-languages-csv";
- /**
- * <code>DOCUMENT_LASTMODIFIED</code> The last modified date of the current document
- */
- public static final String DOCUMENT_LASTMODIFIED = "document-lastmodified";
- /**
- * <code>BREADCRUMB_PREFIX</code> The breadcrumb prefix of the publication, used for
- * navigation
- */
- public static final String BREADCRUMB_PREFIX = "breadcrumb-prefix";
- /**
- * <code>SSL_PREFIX</code> The SSL prefix of the publication
- */
- public static final String SSL_PREFIX = "ssl-prefix";
- /**
- * <code>NAMESPACE</code> The page envelope namespace
- */
- public static final String NAMESPACE = "http://apache.org/cocoon/lenya/page-envelope/1.0";
- /**
- * <code>DEFAULT_PREFIX</code> The default prefix
- */
- public static final String DEFAULT_PREFIX = "lenya";
-
- private String context;
- private String area;
- private Publication publication;
-
- /**
- * Constructor.
- */
- protected PageEnvelope() {
- }
-
- /**
- * Creates a page envelope from an object model.
- * @param map The identity map to use.
- * @param contextPath The servlet context prefix.
- * @param webappUrl The web application URL.
- * @param servletContext The servlet context directory.
- * @param publication The publication.
- * @throws PageEnvelopeException when something went wrong.
- */
- public PageEnvelope(DocumentFactory map, String contextPath,
- String webappUrl, File servletContext, Publication publication)
- throws PageEnvelopeException {
- this.factory = map;
- this.context = contextPath;
- this.webappUrl = webappUrl;
- this.publication = publication;
- }
-
- private String webappUrl;
-
- private DocumentFactory factory;
-
- /**
- * Returns the document factory.
- * @return A document factory.
- */
- public DocumentFactory getDocumentFactory() {
- return this.factory;
- }
-
- /**
- * Creates the message to report when creating the envelope failed.
- * @param request The request.
- * @return A string.
- */
- protected String createExceptionMessage(Request request) {
- return "Resolving page envelope failed:" + "\n URI: " + request.getRequestURI()
- + "\n Context: " + getContext() + "\n Publication ID: "
- + getPublication().getId() + "\n Area: " + this.document.getArea()
- + "\n Document UUID: " + this.document.getUUID();
- }
-
- /**
- * Returns the publication of this PageEnvelope.
- * @return a <code>Publication</code> value
- */
- public Publication getPublication() {
- /*
- * if (this.publication == null) { try { Publication pub =
- * PublicationManagerImpl.getInstance(new ConsoleLogger()) .getPublication(this.webappUrl,
- * this.servletContext); if (pub.exists()) { this.publication = pub; if
- * (getIdentityMap().isDocument(this.webappUrl)) { Document _document =
- * getIdentityMap().getFromURL(this.webappUrl); setDocument(_document); } } } catch
- * (Exception e) { throw new RuntimeException(e); } }
- */
- return this.publication;
- }
-
- /**
- * @return The current area.
- */
- public String getArea() {
- if (this.area == null) {
- URLInformation info = new URLInformation(this.webappUrl);
- this.area = info.getArea();
- }
- return this.area;
- }
-
- /**
- * Returns the rcEnvironment.
- *
- * @return a <code>RCEnvironment</code> value
- * @deprecated We should detach the RC environment from the page envelope.
- */
- public RCEnvironment getRCEnvironment() {
- return RCEnvironment.getInstance(getPublication().getServletContext().getAbsolutePath(),
- new ConsoleLogger());
- }
-
- /**
- * Returns the context, e.g. "/lenya".
- * @return a <code>String</code> value
- */
- public String getContext() {
- return this.context;
- }
-
- /**
- * Returns the document-path.
- * @return a <code>File<code> value
- */
- public String getDocumentPath() {
- return getPublication().getPathMapper().getPath(getDocument().getUUID(),
- getDocument().getLanguage());
- }
-
- /**
- * @param string The context.
- */
- protected void setContext(String string) {
- this.context = string;
- }
-
- private Document document;
- private boolean documentChecked = false;
-
- /**
- * Returns the document or <code>null</code> if the current URL does not represent a document.
- * @return A document
- */
- public Document getDocument() {
- if (!documentChecked) {
- try {
- documentChecked = true;
- if (getDocumentFactory().isDocument(this.webappUrl)) {
- this.document = getDocumentFactory().getFromURL(this.webappUrl);
- }
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- }
- return this.document;
- }
-
- /**
- * Sets the document.
- * @param _document A document.
- */
- public void setDocument(Document _document) {
- this.document = _document;
- }
-
- /**
- * @return The document language or the default language if the document doesn't exist.
- * @see #LANGUAGE
- */
- public String getLanguage() {
- Document document = getDocument();
- if (document == null) {
- Publication pub = getPublication();
- if (pub == null) {
- throw new RuntimeException("The language attribute can't be used outside a publication.");
- }
- return pub.getDefaultLanguage();
- } else {
- return document.getLanguage();
- }
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelopeException.java b/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelopeException.java
deleted file mode 100644
index 8bc9443..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelopeException.java
+++ /dev/null
@@ -1,64 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-
-/**
- * This exception is thrown when the creation of a {@link PageEnvelope} object fails.
- */
-public class PageEnvelopeException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates a new PageEnvelopeException.
- */
- public PageEnvelopeException() {
- // do nothing
- }
-
- /**
- * Creates a new PageEnvelopeException.
- * @param message the exception message
- */
- public PageEnvelopeException(String message) {
- super(message);
- }
-
- /**
- * Creates a new PageEnvelopeException.
- * @param message the exception message
- * @param cause the cause of the exception
- */
- public PageEnvelopeException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Creates a new PageEnvelopeException.
- * @param cause the cause of the exception
- */
- public PageEnvelopeException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelopeFactory.java b/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelopeFactory.java
deleted file mode 100644
index 3264648..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelopeFactory.java
+++ /dev/null
@@ -1,89 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-import java.util.Map;
-
-import org.apache.cocoon.environment.Context;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Common entry point for creating page envelopes.
- */
-public class PageEnvelopeFactory {
- /**
- * Creates a new PageEnvelopeFactory.
- */
- protected PageEnvelopeFactory() {
- // do nothing
- }
-
- private static PageEnvelopeFactory instance;
-
- /**
- * Returns the singleton PageEnvelopeFactory.
- * @return The factory.
- */
- public static PageEnvelopeFactory getInstance() {
- if (instance == null) {
- instance = new PageEnvelopeFactory();
- }
- return instance;
- }
-
- /**
- * Returns the page envelope for the object model of a Cocoon component.
- * @param map The document identity map to use.
- * @param objectModel The object model.
- * @param pub The publication.
- * @return A page envelope.
- * @throws PageEnvelopeException if something went wrong.
- */
- public PageEnvelope getPageEnvelope(DocumentFactory map, Map objectModel, Publication pub)
- throws PageEnvelopeException {
- Request request = ObjectModelHelper.getRequest(objectModel);
- String contextPath = request.getContextPath();
- Context context = ObjectModelHelper.getContext(objectModel);
- String webappUrl = ServletHelper.getWebappURI(request);
- String servletContextPath = context.getRealPath("");
- return getPageEnvelope(map, contextPath, webappUrl, new File(servletContextPath), pub);
- }
-
- /**
- * Creates a page envelope.
- * @param map The document identity map to use.
- * @param contextPath The servlet context prefix.
- * @param webappUrl The web application URL.
- * @param servletContext The servlet context directory.
- * @param pub The publication.
- * @return A page envelope.
- * @throws PageEnvelopeException if something went wrong.
- */
- public PageEnvelope getPageEnvelope(DocumentFactory map, String contextPath, String webappUrl,
- File servletContext, Publication pub) throws PageEnvelopeException {
- PageEnvelope envelope = new PageEnvelope(map, contextPath, webappUrl, servletContext, pub);
- return envelope;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/PathToDocumentIdMapper.java b/trunk/src/java/org/apache/lenya/cms/publication/PathToDocumentIdMapper.java
deleted file mode 100644
index 2eb4f3e..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/PathToDocumentIdMapper.java
+++ /dev/null
@@ -1,49 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-
-/**
- * This interface is basically the reverse of DocumentIdToPathMapper.
- */
-public interface PathToDocumentIdMapper {
-
- /**
- * Compute the document-id for a given file.
- * @param publication the publication where the file is.
- * @param area the area where the file is.
- * @param file the file that is associated with the document
- * @return the document-id of the document associated with the given file.
- * @throws DocumentDoesNotExistException if there is no document associated with this file.
- */
- String getDocumentId(Publication publication, String area, File file)
- throws DocumentDoesNotExistException;
-
- /**
- * Returns the language for a given file
- * @param file the document file
- * @return the language for the given document file or null if the file
- * has no language.
- */
- public String getLanguage(File file);
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/Proxy.java b/trunk/src/java/org/apache/lenya/cms/publication/Proxy.java
deleted file mode 100644
index 93b9f96..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/Proxy.java
+++ /dev/null
@@ -1,73 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-/**
- * <p>
- * An object of this class represents a proxy configuration.
- * </p>
- * <p>
- * Configuration example (<code>$PUB_HOME/config/publication.xml</code>):
- * </p>
- * <pre>
- * <proxies>
- * <proxy area="live" ssl="true" url="https://www.host.com/ssl/default"/>
- * <proxy area="live" ssl="false" url="http://www.host.com/default"/>
- * <proxy area="authoring" ssl="true" url="https://www.host.com/lenya/default/authoring"/>
- * <proxy area="authoring" ssl="false" url="http://www.host.com/lenya/default/authoring"/>
- * <proxies;>
- * </pre>
- *
- * @version $Id$
- */
-public class Proxy {
-
- private String url;
-
- /**
- * Returns the absolute URL of a particular document.
- * @param document The document.
- * @return A string.
- */
- public String getURL(Document document) {
- return getUrl() + document.getCanonicalDocumentURL();
- }
-
- /**
- * Returns the proxy URL.
- * @return A string.
- */
- public String getUrl() {
- return this.url;
- }
-
- /**
- * Sets the proxy URL.
- * @param _url The url to set.
- */
- public void setUrl(String _url) {
- this.url = _url;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "Proxy URL=[" + getUrl() + "]";
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/Publication.java b/trunk/src/java/org/apache/lenya/cms/publication/Publication.java
deleted file mode 100644
index d2b1aef..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/Publication.java
+++ /dev/null
@@ -1,258 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-
-import org.apache.lenya.cms.repository.RepositoryItem;
-
-/**
- * A Lenya publication.
- */
-public interface Publication extends RepositoryItem {
-
- /**
- * <code>AUTHORING_AREA</code> The authoring area
- */
- String AUTHORING_AREA = "authoring";
- /**
- * <code>DAV_AREA</code> The webDAV authoring area
- */
- String DAV_AREA = "webdav";
- /**
- * <code>STAGING_AREA</code> The staging area
- */
- String STAGING_AREA = "staging";
- /**
- * <code>LIVE_AREA</code> The live area
- */
- String LIVE_AREA = "live";
- /**
- * <code>ARCHIVE_AREA</code> The archive area
- */
- String ARCHIVE_AREA = "archive";
- /**
- * <code>TRASH_AREA</code> The trash area
- */
- String TRASH_AREA = "trash";
- /**
- * <code>PUBLICATION_PREFIX</code> The publication prefix
- */
- String PUBLICATION_PREFIX = "lenya" + File.separator + "pubs";
- /**
- * <code>PUBLICATION_PREFIX_URI</code> The publication prefix URI
- */
- String PUBLICATION_PREFIX_URI = "lenya/pubs";
- /**
- * <code>CONFIGURATION_PATH</code> The configuration path
- */
- String CONFIGURATION_PATH = "config";
- /**
- * <code>CONTENT_PATH</code> The content path
- */
- String CONTENT_PATH = "content";
- /**
- * <code>PENDING_PATH</code> The pending path
- */
- String PENDING_PATH = "pending";
- /**
- * <code>DELETE_PATH</code> The delete path
- */
- String DELETE_PATH = "delete";
-
- /**
- * The item type.
- */
- String ITEM_TYPE = "publication";
-
- /**
- * Returns the publication ID.
- * @return A string value.
- */
- String getId();
-
- /**
- * @return The name of the publication as specified in the configuration file.
- */
- String getName();
-
- /**
- * Returns the servlet context this publication belongs to (usually, the
- * <code>webapps/lenya</code> directory).
- * @return A <code>File</code> object.
- */
- File getServletContext();
-
- /**
- * @return if this publication exists.
- */
- boolean exists();
-
- /**
- * Returns the publication directory.
- * @return A <code>File</code> object.
- */
- File getDirectory();
-
- /**
- * Return the directory of a specific area.
- * @param area a <code>File</code> representing the root of the area content directory.
- * @return the directory of the given content area.
- */
- File getContentDirectory(String area);
-
- /**
- * Set the path mapper
- * @param mapper The path mapper
- */
- void setPathMapper(DefaultDocumentIdToPathMapper mapper);
-
- /**
- * Returns the path mapper.
- * @return a <code>DocumentIdToPathMapper</code>
- */
- DocumentIdToPathMapper getPathMapper();
-
- /**
- * Get the default language
- * @return the default language
- */
- String getDefaultLanguage();
-
- /**
- * Set the default language
- * @param language the default language
- */
- void setDefaultLanguage(String language);
-
- /**
- * Get all available languages for this publication
- * @return an <code>Array</code> of languages
- */
- String[] getLanguages();
-
- /**
- * Get the breadcrumb prefix. It can be used as a prefix if a publication is part of a larger
- * site
- * @return the breadcrumb prefix
- */
- String getBreadcrumbPrefix();
-
- /**
- * Returns the hint of the site manager service that is used by this publication.
- * @return A hint to use for service selection.
- */
- String getSiteManagerHint();
-
- /**
- * Returns the document builder of this instance.
- * @return A hint to use for service selection.
- */
- DocumentBuilder getDocumentBuilder();
-
- /**
- * Returns the publication template instantiator hint. If the publication does not allow
- * templating, <code>null</code> is returned.
- * @return A hint to use for service selection.
- */
- String getInstantiatorHint();
-
- /**
- * Returns the content dir.
- * If the publication does not specify a content dir, then <code>null</code> is returned.
- * @return A base directory where all the content is located.
- */
- String getContentDir();
-
- /**
- * Returns the proxy which is used for a particular document's area
- * (see {@link #getProxy(String, boolean)}).
- * @param document The document.
- * @param isSslProtected A boolean value.
- * @return A proxy.
- */
- Proxy getProxy(Document document, boolean isSslProtected);
-
- /**
- * <p>
- * Returns the proxy which is used for the given area and the ssl parameter.
- * </p>
- * <p>
- * If no proxy is defined in the publication configuration file, a default proxy
- * with the URL <code>{contextPath}/{pubId}/{area}</code> is returned.
- * </p>
- * <p>
- * If the area string is "root", the global proxy is returned. If no global proxy
- * is defined, a default global proxy with the URL <code>{contextPath}</code>
- * is returned.
- * </p>
- * @param area area
- * @param isSslProtected A boolean value.
- * @return A proxy.
- */
- Proxy getProxy(String area, boolean isSslProtected);
-
- /**
- * @return The templates of the publication.
- */
- String[] getTemplateIds();
-
- /**
- * @return the URI base for this publication
- */
- String getSourceURI();
-
- /**
- * @param area The area.
- * @return the URI base under which contents in this publication are accessed
- */
- String getContentURI(String area);
-
- /**
- * @param resourceType The resource type or <code>null</code> if no workflow is registered for
- * this resource type.
- * @return The workflow schema to use for this resource type.
- */
- String getWorkflowSchema(ResourceType resourceType);
-
- /**
- * @return The resource types that are supported by this publication.
- */
- String[] getResourceTypeNames();
-
- /**
- * @param name The name.
- * @return An area object.
- * @throws PublicationException if an error occurs.
- */
- Area getArea(String name) throws PublicationException;
-
- /**
- * @return The names of all available areas.
- */
- String[] getAreaNames();
-
- /**
- * @return The document factory.
- */
- public DocumentFactory getFactory();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/PublicationException.java b/trunk/src/java/org/apache/lenya/cms/publication/PublicationException.java
deleted file mode 100644
index 0d78c0a..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/PublicationException.java
+++ /dev/null
@@ -1,67 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-import org.apache.lenya.cms.repository.RepositoryException;
-
-/**
- * Publication Exception
- */
-public class PublicationException extends RepositoryException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates a new PublicationException.
- */
- public PublicationException() {
- super();
- }
-
- /**
- * Creates a new PublicationException.
- * @param message the exception message
- */
- public PublicationException(String message) {
- super(message);
- }
-
- /**
- * Creates a new PublicationException.
- * @param message the exception message
- * @param cause the cause of the exception
- */
- public PublicationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Creates a new PublicationException.
- * @param cause the cause of the exception
- */
- public PublicationException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/PublicationManager.java b/trunk/src/java/org/apache/lenya/cms/publication/PublicationManager.java
deleted file mode 100644
index bcb4c83..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/PublicationManager.java
+++ /dev/null
@@ -1,56 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-/**
- * Publication manager.
- */
-public interface PublicationManager {
-
- /**
- * The service's role.
- */
- String ROLE = PublicationManager.class.getName();
-
- /**
- * @param factory The factory.
- * @return All publications.
- */
- Publication[] getPublications(DocumentFactory factory);
-
- /**
- * @param factory The factory.
- * @param id The publication ID.
- * @return A publication.
- * @throws PublicationException if the publication does not exist.
- */
- Publication getPublication(DocumentFactory factory, String id) throws PublicationException;
-
- /**
- * @return The IDs of all available publications.
- */
- String[] getPublicationIds();
-
- /**
- * Adds a publication.
- * @param id The publication ID.
- * @throws PublicationException if the publication already exists.
- */
- void addPublication(String id) throws PublicationException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/PublicationUtil.java b/trunk/src/java/org/apache/lenya/cms/publication/PublicationUtil.java
deleted file mode 100644
index 213affa..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/PublicationUtil.java
+++ /dev/null
@@ -1,130 +0,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.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import java.util.Arrays;
-import java.util.Map;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Publication utility.
- */
-public class PublicationUtil {
-
- /**
- * Creates a new publication. The publication ID is resolved from the request URI. The servlet
- * context path is resolved from the context object.
- * @param manager The service manager.
- * @param objectModel The object model of the Cocoon component.
- * @return a <code>Publication</code>
- * @throws PublicationException if there was a problem creating the publication.
- */
- public static Publication getPublication(ServiceManager manager, Map objectModel)
- throws PublicationException {
- return getPublication(manager, ObjectModelHelper.getRequest(objectModel));
- }
-
- /**
- * Creates a new publication based on a request.
- * @param manager The service manager.
- * @param request A request.
- * @return A publication.
- * @throws PublicationException if there was a problem creating the publication.
- */
- public static Publication getPublication(ServiceManager manager, Request request)
- throws PublicationException {
- Session session;
- try {
- session = RepositoryUtil.getSession(manager, request);
- } catch (RepositoryException e) {
- throw new PublicationException(e);
- }
- DocumentFactory factory = DocumentUtil.createDocumentFactory(manager, session);
- String webappUrl = ServletHelper.getWebappURI(request);
- return getPublicationFromUrl(manager, factory, webappUrl);
- }
-
- /**
- * Creates a publication from a webapp URL and a servlet context directory.
- * @param manager The service manager.
- * @param factory The factory.
- * @param webappUrl The URL within the web application (without context prefix)
- * @return A publication
- * @throws PublicationException when something went wrong
- */
- public static Publication getPublicationFromUrl(ServiceManager manager,
- DocumentFactory factory, String webappUrl) throws PublicationException {
- URLInformation info = new URLInformation(webappUrl);
- String pubId = info.getPublicationId();
- return factory.getPublication(pubId);
- }
-
- /**
- * Returns a list of all available publications.
- * @param manager The service manager.
- * @param factory The document factory.
- * @return An array of publications.
- * @throws PublicationException if an error occurs.
- */
- public static Publication[] getPublications(ServiceManager manager, DocumentFactory factory)
- throws PublicationException {
- PublicationManager pubManager = null;
- try {
- pubManager = (PublicationManager) manager.lookup(PublicationManager.ROLE);
- return pubManager.getPublications(factory);
- } catch (ServiceException e) {
- throw new PublicationException(e);
- } finally {
- if (pubManager != null) {
- manager.release(pubManager);
- }
- }
- }
-
- /**
- * Checks if a publication id is valid.
- * @param id
- * @return true if the id contains only lowercase letters and/or numbers, and is not an empty
- * string.
- */
- public static boolean isValidPublicationID(String id) {
- return id.matches("[a-z0-9]+");
- }
-
- private static final String[] areas = { Publication.AUTHORING_AREA, Publication.DAV_AREA,
- Publication.STAGING_AREA, Publication.LIVE_AREA, Publication.ARCHIVE_AREA,
- Publication.TRASH_AREA };
-
- /**
- * Returns if a given string is a valid area name.
- * @param area The area string to test.
- * @return A boolean value.
- */
- public static boolean isValidArea(String area) {
- return area != null && Arrays.asList(areas).contains(area);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/ResourceType.java b/trunk/src/java/org/apache/lenya/cms/publication/ResourceType.java
deleted file mode 100644
index c0895dd..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/ResourceType.java
+++ /dev/null
@@ -1,152 +0,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.
- *
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.lenya.cms.publication;
-
-import java.util.Date;
-
-import org.apache.lenya.util.Assert;
-import org.apache.lenya.xml.Schema;
-
-/**
- * @version $Id:$
- */
-public interface ResourceType {
-
- /**
- * The Avalon service role.
- */
- String ROLE = ResourceType.class.getName();
-
- /**
- * Prefix for translating the resource type name, e.g.
- * <i18n:text>resourceType-<jx:out
- * value="${resourceType.getName()}"/></i18n:text>
- */
- String I18N_PREFIX = "resourceType-";
-
- /**
- * Returns the date at which point the requested resource is considered
- * expired
- * @return a string in RFC 1123 date format
- */
- Date getExpires();
-
- /**
- * Returns the name of this document type.
- * @return A string value.
- */
- String getName();
-
- /**
- * @return The source URI of the RelaxNG schema.
- */
- Schema getSchema();
-
- /**
- * Returns an array of XPaths representing attributes to be rewritten when a
- * document URL has changed.
- * @return An array of strings.
- */
- String[] getLinkAttributeXPaths();
-
- /**
- * @return The names of all available samples. The first one is the default sample.
- */
- String[] getSampleNames();
-
- /**
- * @param name The name.
- * @return The sample with the specified name.
- */
- Sample getSample(String name);
-
- /**
- * @param name The name of the resource type.
- */
- void setName(String name);
-
- /**
- * @return All supported formats.
- */
- String[] getFormats();
-
- /**
- * @param format The format.
- * @return The URI to get the formatted content at.
- */
- String getFormatURI(String format);
-
- /**
- * A resource type sample.
- */
- public static class Sample {
-
- protected Sample(String name, String mimeType, String uri) {
- Assert.notNull("name", name);
- this.name = name;
- Assert.notNull("mimeType", mimeType);
- this.mimeType = mimeType;
- Assert.notNull("uri", uri);
- this.uri = uri;
- }
-
- private String name;
- private String mimeType;
- private String uri;
-
- /**
- * @return The name of the sample.
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * @return The MIME type of the sample.
- */
- public String getMimeType() {
- return this.mimeType;
- }
-
- /**
- * @return The URI of the sample source.
- */
- public String getUri() {
- return this.uri;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/SingleLanguageIdentityMapper.java b/trunk/src/java/org/apache/lenya/cms/publication/SingleLanguageIdentityMapper.java
deleted file mode 100644
index a9fd0dc..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/SingleLanguageIdentityMapper.java
+++ /dev/null
@@ -1,40 +0,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.
- *
- */
-
-
-package org.apache.lenya.cms.publication;
-
-/**
- * Single Language Identity mapper.
- * Similar to the {@link DefaultDocumentIdToPathMapper}, but doesn't add
- * a language suffix to the source URIs. This is useful for publications
- * which do not have multiple language version of the same document,
- * such as the "blog" publication.
- * @version $Id$
- */
-public class SingleLanguageIdentityMapper extends IdentityDocumentIdToPathMapper {
-
- /**
- * The parameter <code>language</code> is ignored, since this mapper is used for situations where only one language version of a document exists
- * @see org.apache.lenya.cms.publication.IdentityDocumentIdToPathMapper#getSuffix(java.lang.String)
- */
- protected String getSuffix(String language) {
- return "";
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/URLInformation.java b/trunk/src/java/org/apache/lenya/cms/publication/URLInformation.java
deleted file mode 100644
index bc8f53d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/URLInformation.java
+++ /dev/null
@@ -1,123 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication;
-
-/**
- * This class resolves all Lenya-specific information from a webapp URL.
- */
-public class URLInformation {
-
- private String publicationId = null;
- private String area = null;
- private String completeArea = null;
- private String documentUrl = null;
-
- private String url;
-
- /**
- * Returns the area (without the "webdav" prefix).
- * @return A string.
- */
- public String getArea() {
- if (this.area == null) {
- String completeArea = getCompleteArea();
- if (Publication.DAV_AREA.equals(completeArea)) {
- this.area = Publication.AUTHORING_AREA;
- } else {
- this.area = completeArea;
- }
- }
- return this.area;
- }
-
- /**
- * Returns the complete area (including the "webdav" prefix).
- * @return A string.
- */
- public String getCompleteArea() {
- String pubId = getPublicationId();
- if (this.completeArea == null && pubId != null) {
- String pubUrl = this.url.substring(pubId.length());
- if (pubUrl.startsWith("/")) {
- this.completeArea = extractBeforeSlash(pubUrl.substring(1));
- } else {
- this.completeArea = null;
- }
- }
- return this.completeArea;
- }
-
- /**
- * Returns the document URL.
- * @return A string.
- */
- public String getDocumentUrl() {
- if (this.documentUrl == null) {
- String pubId = getPublicationId();
- String area = getCompleteArea();
- if (pubId != null && area != null) {
- String prefix = pubId + "/" + area;
- this.documentUrl = this.url.substring(prefix.length());
- }
- }
- return this.documentUrl;
- }
-
- /**
- * Returns the publication ID.
- * @return A string.
- */
- public String getPublicationId() {
- if (this.publicationId == null) {
- this.publicationId = extractBeforeSlash(this.url);
- }
- return this.publicationId;
- }
-
- protected String extractBeforeSlash(String remaining) {
-
- if (remaining.length() == 0) {
- return null;
- }
-
- String step;
- int slashIndex = remaining.indexOf('/');
- if (slashIndex == -1) {
- step = remaining;
- } else {
- step = remaining.substring(0, slashIndex);
- }
- return step;
- }
-
- /**
- * Ctor.
- * @param webappUrl A webapp URL (without context prefix).
- */
- public URLInformation(String webappUrl) {
-
- if (!webappUrl.startsWith("/")) {
- throw new RuntimeException("The URL [" + webappUrl + "] doesn't start with a slash!");
- }
-
- this.url = webappUrl.substring(1);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/templating/AllExistingSourceResolver.java b/trunk/src/java/org/apache/lenya/cms/publication/templating/AllExistingSourceResolver.java
deleted file mode 100644
index 3c5f4bc..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/templating/AllExistingSourceResolver.java
+++ /dev/null
@@ -1,56 +0,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.
- *
- */
-package org.apache.lenya.cms.publication.templating;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-
-/**
- * Source visitor to obtain all existing sources.
- */
-public class AllExistingSourceResolver implements SourceVisitor {
-
- public void visit(SourceResolver resolver, String sourceUri) {
- Source source = null;
- try {
- source = resolver.resolveURI(sourceUri);
- if (source.exists()) {
- this.uris.add(sourceUri);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (source != null) {
- resolver.release(source);
- }
- }
- }
-
- private List uris = new ArrayList();
-
- /**
- * @return All existing source URIs.
- */
- public String[] getUris() {
- return (String[]) this.uris.toArray(new String[this.uris.size()]);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/templating/ExistingAncestorSourceResolver.java b/trunk/src/java/org/apache/lenya/cms/publication/templating/ExistingAncestorSourceResolver.java
deleted file mode 100644
index 1fdf614..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/templating/ExistingAncestorSourceResolver.java
+++ /dev/null
@@ -1,68 +0,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.
- *
- */
-
-package org.apache.lenya.cms.publication.templating;
-
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-
-/**
- * Source visitor to obtain the first existing source.
- *
- * @version $Id: ExistingSourceResolver.java 179568 2005-06-02 09:27:26Z jwkaltz $
- */
-public class ExistingAncestorSourceResolver implements VisitingSourceResolver {
-
- private Source source;
-
- /**
- * Ctor.
- */
- public ExistingAncestorSourceResolver() {
- super();
- }
-
- /**
- * @return the ancestor of the first existing source.
- */
- public Source getSource() {
- return this.source;
- }
-
- private int matches = 0;
-
- public void visit(SourceResolver resolver, String sourceUri) {
- Source source = null;
- try {
- source = resolver.resolveURI(sourceUri);
- if (source.exists()) {
- matches++;
- if (matches == 2) {
- this.source = source;
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (source != null) {
- resolver.release(source);
- }
- }
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/templating/ExistingSourceResolver.java b/trunk/src/java/org/apache/lenya/cms/publication/templating/ExistingSourceResolver.java
deleted file mode 100644
index cedc91c..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/templating/ExistingSourceResolver.java
+++ /dev/null
@@ -1,65 +0,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.
- *
- */
-
-package org.apache.lenya.cms.publication.templating;
-
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-
-/**
- * Source visitor to obtain the first existing source.
- *
- * @version $Id$
- */
-public class ExistingSourceResolver implements VisitingSourceResolver {
-
- private Source source;
-
- /**
- * Ctor.
- */
- public ExistingSourceResolver() {
- super();
- }
-
- /**
- * @return the first existing source.
- */
- public Source getSource() {
- return this.source;
- }
-
- public void visit(SourceResolver resolver, String sourceUri) {
- if (this.source == null) {
- Source source = null;
- try {
- source = resolver.resolveURI(sourceUri);
- if (source.exists()) {
- this.source = source;
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (source != null) {
- resolver.release(source);
- }
- }
- }
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/templating/Instantiator.java b/trunk/src/java/org/apache/lenya/cms/publication/templating/Instantiator.java
deleted file mode 100644
index aae205a..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/templating/Instantiator.java
+++ /dev/null
@@ -1,44 +0,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.
- *
- */
-package org.apache.lenya.cms.publication.templating;
-
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * Object to create an instance of a templating-enabled publication.
- *
- * @version $Id$
- */
-public interface Instantiator {
-
- /**
- * The Avalon role.
- */
- String ROLE = Instantiator.class.getName();
-
- /**
- * Instantiate a publication.
- * @param templatePublication The template publication.
- * @param newPublicationId The ID of the new publication instance.
- * @param newPublicationName The name of the new publication.
- * @throws Exception if an error occurs.
- */
- void instantiate(Publication templatePublication, String newPublicationId,
- String newPublicationName) throws Exception;
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/templating/PublicationTemplateManager.java b/trunk/src/java/org/apache/lenya/cms/publication/templating/PublicationTemplateManager.java
deleted file mode 100644
index 4fcf508..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/templating/PublicationTemplateManager.java
+++ /dev/null
@@ -1,74 +0,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.
- *
- */
-package org.apache.lenya.cms.publication.templating;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * <p>
- * Component to manage publication templates.
- * </p>
- * <p>
- * When a source is obtained, the traversing order is
- * </p>
- * <ol>
- * <li>the publication itself,</li>
- * <li>all its templates,</li>
- * <li>the core.</li>
- * </ol>
- * @version $Id$
- */
-public interface PublicationTemplateManager {
-
- /**
- * The avalon role.
- */
- String ROLE = PublicationTemplateManager.class.getName();
-
- /**
- * <p>
- * Visits the versions of a source in traversing order. The source doesn't have to exist to be
- * visited.
- * </p>
- * @param publication The original publication.
- * @param path The path of the source, relatively to the publication directory.
- * @param visitor The visitor.
- */
- void visit(Publication publication, String path, SourceVisitor visitor);
-
- /**
- * Visits the publications in traversing order. The core is not visited.
- * @param publication The original publication.
- * @param visitor The visitor.
- */
- void visit(Publication publication, PublicationVisitor visitor);
-
- /**
- * Returns the hint for the publiation which declares a service.
- * @param publication The original publication.
- * @param selector The service selector.
- * @param originalHint The original hint.
- * @return An object.
- * @throws ServiceException if an error occurs.
- */
- Object getSelectableHint(Publication publication, ServiceSelector selector, String originalHint)
- throws ServiceException;
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/templating/PublicationVisitor.java b/trunk/src/java/org/apache/lenya/cms/publication/templating/PublicationVisitor.java
deleted file mode 100644
index d7a93c7..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/templating/PublicationVisitor.java
+++ /dev/null
@@ -1,36 +0,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.
- *
- */
-
-package org.apache.lenya.cms.publication.templating;
-
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * Publication visitor interface.
- *
- * @version $Id$
- */
-public interface PublicationVisitor {
-
- /**
- * Visits a publication.
- * @param publication The publication.
- */
- void visit(Publication publication);
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/templating/SourceVisitor.java b/trunk/src/java/org/apache/lenya/cms/publication/templating/SourceVisitor.java
deleted file mode 100644
index 0515695..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/templating/SourceVisitor.java
+++ /dev/null
@@ -1,36 +0,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.
- *
- */
-package org.apache.lenya.cms.publication.templating;
-
-import org.apache.excalibur.source.SourceResolver;
-
-/**
- * @version $Id$
- */
-public interface SourceVisitor {
-
- /**
- * Visits a source. We pass the resolver and the URI so that the visitor can
- * decide if it wants to resolve the source (mainly for performance
- * reasons).
- * @param resolver The resolver.
- * @param sourceUri The source URI.
- */
- void visit(SourceResolver resolver, String sourceUri);
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/templating/TemplatingException.java b/trunk/src/java/org/apache/lenya/cms/publication/templating/TemplatingException.java
deleted file mode 100644
index f7403c6..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/templating/TemplatingException.java
+++ /dev/null
@@ -1,62 +0,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.
- *
- */
-package org.apache.lenya.cms.publication.templating;
-
-/**
- * @version $Id$
- */
-public class TemplatingException extends RuntimeException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Ctor.
- */
- public TemplatingException() {
- super();
- }
-
- /**
- * Ctor.
- * @param message The message.
- */
- public TemplatingException(String message) {
- super(message);
- }
-
- /**
- * Ctor.
- * @param message The message.
- * @param cause The cause.
- */
- public TemplatingException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Ctor.
- * @param cause The cause.
- */
- public TemplatingException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/templating/VisitingSourceResolver.java b/trunk/src/java/org/apache/lenya/cms/publication/templating/VisitingSourceResolver.java
deleted file mode 100644
index 905449a..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/templating/VisitingSourceResolver.java
+++ /dev/null
@@ -1,32 +0,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.
- *
- */
-package org.apache.lenya.cms.publication.templating;
-
-import org.apache.excalibur.source.Source;
-
-/**
- * URI resolver.
- */
-public interface VisitingSourceResolver extends SourceVisitor {
-
- /**
- * @return The resolved source.
- */
- Source getSource();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentHelper.java b/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentHelper.java
deleted file mode 100644
index 41fec6e..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentHelper.java
+++ /dev/null
@@ -1,216 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication.util;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Helper class to handle documents from XSP.
- */
-public class DocumentHelper {
-
- private Map objectModel;
- private DocumentFactory identityMap;
- private Publication publication;
-
- /**
- * Ctor.
- * @param manager The service manager.
- * @param _objectModel The Cocoon object model.
- */
- public DocumentHelper(ServiceManager manager, Map _objectModel) {
- this.objectModel = _objectModel;
- try {
- this.publication = PublicationUtil.getPublication(manager, _objectModel);
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- Request request = ObjectModelHelper.getRequest(_objectModel);
- Session session;
- try {
- session = RepositoryUtil.getSession(manager, request);
- } catch (RepositoryException e) {
- throw new RuntimeException(e);
- }
- this.identityMap = DocumentUtil.createDocumentFactory(manager, session);
- }
-
- /**
- * Creates a document URL. <br/>If the document ID is null, the current document ID is used.
- * <br/>If the document area is null, the current area is used. <br/>If the language is null,
- * the current language is used.
- * @param uuid The target document UUID.
- * @param documentArea The target area.
- * @param language The target language.
- * @return A string.
- * @throws ProcessingException if something went wrong.
- */
- public String getDocumentUrl(String uuid, String documentArea, String language)
- throws ProcessingException {
-
- String url = null;
-
- try {
- Request request = ObjectModelHelper.getRequest(this.objectModel);
- String webappUrl = ServletHelper.getWebappURI(request);
- Document envDocument = this.identityMap.getFromURL(webappUrl);
- if (uuid == null) {
- uuid = envDocument.getUUID();
- }
-
- if (documentArea == null) {
- URLInformation info = new URLInformation(webappUrl);
- String completeArea = info.getCompleteArea();
- documentArea = completeArea;
- }
-
- if (language == null) {
- language = envDocument.getLanguage();
- }
-
- Document document = this.identityMap.get(this.publication, documentArea, uuid, language);
- url = document.getCanonicalWebappURL();
-
- String contextPath = request.getContextPath();
- if (contextPath == null) {
- contextPath = "";
- }
-
- url = contextPath + url;
- } catch (final DocumentBuildException e) {
- throw new ProcessingException(e);
- }
-
- return url;
-
- }
-
- /**
- * Returns the complete URL of the parent document. If the document is a top-level document, the
- * /index document is chosen. If the parent does not exist in the appropriate language, the
- * default language is chosen.
- * @return A string.
- * @throws ProcessingException when something went wrong.
- */
- public String getCompleteParentUrl() throws ProcessingException {
-
- String parentUrl;
- String contextPath;
- try {
- Request request = ObjectModelHelper.getRequest(this.objectModel);
- String webappUrl = ServletHelper.getWebappURI(request);
- Document document = this.identityMap.getFromURL(webappUrl);
-
- contextPath = request.getContextPath();
-
- DocumentLocator parentLocator = document.getLocator().getParent("/index");
- Document parent = this.identityMap.get(parentLocator);
- parentUrl = parent.getCanonicalWebappURL();
- } catch (final DocumentBuildException e) {
- throw new ProcessingException(e);
- }
- if (contextPath == null) {
- contextPath = "";
- }
-
- return contextPath + parentUrl;
- }
-
- /**
- * Returns an existing language version of a document. If the document exists in the default
- * language, the default language version is returned. Otherwise, a random language version is
- * returned. If no language version exists, a DocumentException is thrown.
- *
- * @param document The document.
- * @return A document.
- * @throws DocumentException when an error occurs.
- */
- public static Document getExistingLanguageVersion(Document document) throws DocumentException {
- return getExistingLanguageVersion(document, document.getPublication().getDefaultLanguage());
- }
-
- /**
- * Returns an existing language version of a document. If the document exists in the preferred
- * language, this version is returned. Otherwise, if the document exists in the default
- * language, the default language version is returned. Otherwise, a random language version is
- * returned. If no language version exists, a DocumentException is thrown.
- *
- * @param document The document.
- * @param preferredLanguage The preferred language.
- * @return A document.
- * @throws DocumentException when an error occurs.
- */
- public static Document getExistingLanguageVersion(final Document document,
- String preferredLanguage) throws DocumentException {
-
- Publication publication = document.getPublication();
-
- String[] languages = document.getLanguages();
-
- if (languages.length == 0) {
- throw new DocumentException("The document [" + document
- + "] does not exist in any language!");
- }
-
- List languageList = Arrays.asList(languages);
-
- String existingLanguage = null;
-
- if (languageList.contains(preferredLanguage)) {
- existingLanguage = preferredLanguage;
- } else if (languageList.contains(publication.getDefaultLanguage())) {
- existingLanguage = publication.getDefaultLanguage();
- } else {
- existingLanguage = languages[0];
- }
-
- Document existingVersion = null;
- try {
- existingVersion = document.getTranslation(existingLanguage);
- } catch (DocumentException e) {
- throw new DocumentException(e);
- }
-
- return existingVersion;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentLanguagesHelper.java b/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentLanguagesHelper.java
deleted file mode 100644
index 64715eb..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentLanguagesHelper.java
+++ /dev/null
@@ -1,147 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication.util;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Helper class for the policy GUI.
- */
-public class DocumentLanguagesHelper {
-
- private DocumentFactory factory;
- private ServiceManager manager;
- private Publication pub;
- private String url;
- private String contextPath;
-
- /**
- * Create a new DocumentlanguageHelper.
- * @param objectModel the objectModel
- * @param manager The service manager.
- * @throws ProcessingException if the page envelope could not be created.
- */
- public DocumentLanguagesHelper(Map objectModel, ServiceManager manager)
- throws ProcessingException {
-
- this.manager = manager;
- Request request = ObjectModelHelper.getRequest(objectModel);
- this.url = ServletHelper.getWebappURI(request);
- this.contextPath = request.getContextPath();
-
- try {
- Session session = RepositoryUtil.getSession(manager, request);
- this.factory = DocumentUtil.createDocumentFactory(this.manager, session);
-
- this.pub = PublicationUtil.getPublication(manager, objectModel);
- } catch (Exception e) {
- throw new ProcessingException(e);
- }
- }
-
- /**
- * @return The requested language.
- * @throws ProcessingException if an error occurs.
- */
- public String getLanguage() throws ProcessingException {
- try {
- return getLocator().getLanguage();
- } catch (DocumentBuildException e) {
- throw new ProcessingException(e);
- }
- }
-
- /**
- * All available languages for the current URL.
- * @return A string array.
- * @throws ProcessingException
- */
- public String[] getLanguages() throws ProcessingException {
- List availableLanguages = new ArrayList();
-
- try {
- DocumentLocator locator = getLocator();
- String[] languages = pub.getLanguages();
- for (int i = 0; i < languages.length; i++) {
- DocumentLocator version = locator.getLanguageVersion(languages[i]);
- Publication pub = factory.getPublication(locator.getPublicationId());
- if (pub.getArea(version.getArea()).getSite().contains(version.getPath(), version.getLanguage())) {
- availableLanguages.add(languages[i]);
- }
- }
-
- } catch (Exception e) {
- throw new ProcessingException(e);
- }
- return (String[]) availableLanguages.toArray(new String[availableLanguages.size()]);
- }
-
- /**
- * Compute the URL for a given language and the parameters given in the contructor.
- * @param language the language
- * @return the url for the given language
- * @throws ProcessingException if the document for the given language could not be created.
- */
- public String getUrl(String language) throws ProcessingException {
- Document doc = getDocument(language);
- return this.contextPath + doc.getCanonicalWebappURL();
- }
-
- /**
- * Create a document for a given language and the parameters given in the contructor.
- * @param language the language
- * @return the document with the given language
- * @throws ProcessingException if the document for the given language could not be created.
- */
- protected Document getDocument(String language) throws ProcessingException {
- Document document;
- try {
- DocumentLocator locator = getLocator();
- DocumentLocator version = locator.getLanguageVersion(language);
- document = this.factory.get(version);
- } catch (Exception e) {
- throw new ProcessingException(e);
- }
- return document;
- }
-
- protected DocumentLocator getLocator() throws DocumentBuildException {
- DocumentLocator locator = this.pub.getDocumentBuilder().getLocator(this.factory, this.url);
- return locator;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentSet.java b/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentSet.java
deleted file mode 100644
index 67ae82e..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentSet.java
+++ /dev/null
@@ -1,177 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.PublicationException;
-
-/**
- * An ordered set of documents without duplicates.
- */
-public class DocumentSet {
-
- /**
- * Ctor.
- */
- public DocumentSet() {
- // do nothing
- }
-
- /**
- * Ctor.
- *
- * @param _documents The initial documents.
- */
- public DocumentSet(Document[] _documents) {
- for (int i = 0; i < _documents.length; i++) {
- add(_documents[i]);
- }
- }
-
- private List documents = new ArrayList();
-
- /**
- * Returns the list object that stores the documents.
- *
- * @return A list.
- */
- protected List getList() {
- return this.documents;
- }
-
- /**
- * Returns the documents contained in this set.
- *
- * @return An array of documents.
- */
- public Document[] getDocuments() {
- return (Document[]) this.documents.toArray(new Document[this.documents.size()]);
- }
-
- /**
- * Adds a document to this set.
- *
- * @param document The document to add.
- * @throws IllegalArgumentException if the document is <code>null</code> or already contained.
- */
- public void add(Document document) {
- if (document == null) {
- throw new IllegalArgumentException("The document is null!");
- }
- if (this.documents.contains(document)) {
- throw new IllegalArgumentException("The document [" + document
- + "] is already contained!");
- }
- this.documents.add(document);
- }
-
- /**
- * Adds a document set to this set.
- *
- * @param set The documents to add.
- */
- public void addAll(DocumentSet set) {
- assert set != null;
- Document[] documents = set.getDocuments();
- for (int i = 0; i < documents.length; i++) {
- if (!contains(documents[i])) {
- add(documents[i]);
- }
- }
- }
-
- /**
- * @param document The document.
- * @return if the document is contained.
- */
- public boolean contains(Document document) {
- return getList().contains(document);
- }
-
- /**
- * Checks if this set is empty.
- *
- * @return A boolean value.
- */
- public boolean isEmpty() {
- return getList().isEmpty();
- }
-
- /**
- * Visits the set.
- *
- * @param visitor The visitor.
- * @throws PublicationException if an error occurs during visiting.
- */
- public void visit(DocumentVisitor visitor) throws PublicationException {
- Document[] resources = getDocuments();
- for (int i = 0; i < resources.length; i++) {
- resources[i].accept(visitor);
- }
- }
-
- /**
- * Removes a document.
- *
- * @param resource The document.
- * @throws PublicationException if an error occurs.
- */
- public void remove(Document resource) throws PublicationException {
- if (resource == null) {
- throw new IllegalArgumentException("The resource is null!");
- }
- if (!getList().contains(resource)) {
- throw new IllegalArgumentException("The resource [" + resource + "] is not contained!");
- }
- getList().remove(resource);
- }
-
- /**
- * Removes all documents in a set from this set.
- * @param set The set.
- * @throws PublicationException if an error occurs.
- */
- public void removeAll(DocumentSet set) throws PublicationException {
- Document[] documents = set.getDocuments();
- for (int i = 0; i < documents.length; i++) {
- remove(documents[i]);
- }
- }
-
- /**
- * Removes all documents.
- */
- public void clear() {
- getList().clear();
- }
-
- /**
- * Reverses the document order.
- */
- public void reverse() {
- Collections.reverse(getList());
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentVisitor.java b/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentVisitor.java
deleted file mode 100644
index eea3de0..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/util/DocumentVisitor.java
+++ /dev/null
@@ -1,39 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication.util;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.PublicationException;
-
-/**
- * Visitor for resources.
- *
- */
-public interface DocumentVisitor {
-
- /**
- * Visits a resource.
- * @param document The resource.
- * @throws PublicationException if something went wrong.
- */
- void visitDocument(Document document) throws PublicationException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/publication/util/LanguageVersions.java b/trunk/src/java/org/apache/lenya/cms/publication/util/LanguageVersions.java
deleted file mode 100644
index 4a597dc..0000000
--- a/trunk/src/java/org/apache/lenya/cms/publication/util/LanguageVersions.java
+++ /dev/null
@@ -1,55 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.publication.util;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentException;
-
-/**
- * Document set containing all language versions of a document.
- */
-public class LanguageVersions extends DocumentSet {
-
- /**
- * Ctor.
- * @param document The document.
- * @throws DocumentException when something went wrong.
- */
- public LanguageVersions(Document document) throws DocumentException {
- String[] languages = document.getLanguages();
- add(document);
-
- for (int i = 0; i < languages.length; i++) {
- if (!document.getLanguage().equals(languages[i])) {
- Document languageVersion;
- try {
- languageVersion = document.getFactory()
- .getLanguageVersion(document, languages[i]);
- } catch (DocumentBuildException e) {
- throw new DocumentException(e);
- }
- add(languageVersion);
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/rc/CheckInEntry.java b/trunk/src/java/org/apache/lenya/cms/rc/CheckInEntry.java
deleted file mode 100644
index 77454df..0000000
--- a/trunk/src/java/org/apache/lenya/cms/rc/CheckInEntry.java
+++ /dev/null
@@ -1,57 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.rc;
-
-
-/**
- * A checkin entry
- */
-public class CheckInEntry extends RCMLEntry {
- /**
- * Creates a new CheckInEntry object.
- * @param sessionId The session ID.
- * @param identity The identity to use
- * @param time The time
- * @param version The version number.
- * @param backup If this entry has a backup.
- */
- public CheckInEntry(String sessionId, String identity, long time, int version, boolean backup) {
- super(sessionId, identity, time);
- setType(RCML.ci);
- this.version = version;
- this.backup = backup;
- }
-
- /**
- * @return The version number.
- */
- public int getVersion() {
- return this.version;
- }
-
- private int version = 0;
- private boolean backup;
-
- public boolean hasBackup() {
- return this.backup;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/rc/CheckOutEntry.java b/trunk/src/java/org/apache/lenya/cms/rc/CheckOutEntry.java
deleted file mode 100644
index e687792..0000000
--- a/trunk/src/java/org/apache/lenya/cms/rc/CheckOutEntry.java
+++ /dev/null
@@ -1,37 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.rc;
-
-/**
- * A Checkout entry
- */
-public class CheckOutEntry extends RCMLEntry {
- /**
- * Creates a new CheckOutEntry object.
- * @param sessionId The session ID.
- * @param identity The identity
- * @param time The time
- */
- public CheckOutEntry(String sessionId, String identity, long time) {
- super(sessionId, identity, time);
- setType(RCML.co);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/rc/FileReservedCheckInException.java b/trunk/src/java/org/apache/lenya/cms/rc/FileReservedCheckInException.java
deleted file mode 100644
index e55e4a5..0000000
--- a/trunk/src/java/org/apache/lenya/cms/rc/FileReservedCheckInException.java
+++ /dev/null
@@ -1,108 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.rc;
-
-import java.util.Date;
-
-
-/**
- * Reserved check-in exception
- */
-public class FileReservedCheckInException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String source = null;
- private Date date = null;
- private String username = null;
- private String typeString = null;
- private short type;
-
- /**
- * Creates a new FileReservedCheckInException object.
- *
- * @param _source The source document
- * @param rcml The RCML
- *
- * @throws Exception if an error occurs
- */
- public FileReservedCheckInException(String _source, RCML rcml)
- throws Exception {
- this.source = _source;
-
- try {
- RCMLEntry rcmlEntry = rcml.getLatestEntry();
-
- this.username = rcmlEntry.getIdentity();
- this.date = new Date(rcmlEntry.getTime());
- this.type = rcmlEntry.getType();
-
- if (this.type == RCML.co) {
- this.typeString = "Checkout";
- } else {
- this.typeString = "Checkin";
- }
- } catch (Exception exception) {
- throw new Exception("Unable to create FileReservedCheckInException object!");
- }
- }
-
- /**
- * Returns the exception message
- * @return The exception message
- */
- public String getMessage() {
- return "Unable to check in the file " + this.source + " because of a " + this.typeString +
- " by user " + this.username + " at " + this.date;
- }
- /**
- * Get the date
- * @return the date
- */
- public Date getDate() {
- return new Date(this.date.getTime());
- }
-
- /**
- * Get the typeString
- * @return the type string
- */
- public String getTypeString() {
- return this.typeString;
- }
-
- /**
- * Get the user name.
- * @return the user name
- */
- public String getUsername() {
- return this.username;
- }
-
- /**
- * Get the source
- * @return The source
- */
- public String getSource() {
- return this.source;
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/rc/FileReservedCheckOutException.java b/trunk/src/java/org/apache/lenya/cms/rc/FileReservedCheckOutException.java
deleted file mode 100644
index 8b86efe..0000000
--- a/trunk/src/java/org/apache/lenya/cms/rc/FileReservedCheckOutException.java
+++ /dev/null
@@ -1,82 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.rc;
-
-import java.util.Date;
-
-
-/**
- * Exception for already checked out files
- */
-public class FileReservedCheckOutException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String source = null;
- private Date checkOutDate = null;
- private String checkOutUsername = null;
-
- /**
- * Creates a new FileReservedCheckOutException object.
- * @param _source The source
- * @param rcml The RCML
- * @throws Exception if an error occurs
- */
- public FileReservedCheckOutException(String _source, RCML rcml)
- throws Exception {
- this.source = _source;
-
- try {
- CheckOutEntry coe = rcml.getLatestCheckOutEntry();
-
- this.checkOutUsername = coe.getIdentity();
- this.checkOutDate = new Date(coe.getTime());
- } catch (Exception e) {
- throw new Exception("Unable to create FileReservedCheckOutException object!");
- }
- }
-
- /**
- * Get the date of the checkout.
- * @return the date of the checkout
- */
- public Date getCheckOutDate() {
- return new Date(this.checkOutDate.getTime());
- }
-
- /**
- * Get the source of the checkout.
- * @return the source of the checkout
- */
- public String getSource() {
- return this.source;
- }
-
- /**
- * Get the user name who did this checkout.
- * @return the user name of this checkout
- */
- public String getCheckOutUsername() {
- return this.checkOutUsername;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/rc/RCEnvironment.java b/trunk/src/java/org/apache/lenya/cms/rc/RCEnvironment.java
deleted file mode 100644
index 52c2915..0000000
--- a/trunk/src/java/org/apache/lenya/cms/rc/RCEnvironment.java
+++ /dev/null
@@ -1,145 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.rc;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configurable;
-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.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.xml.sax.SAXException;
-
-/**
- * Helper class that holds the revision controller configuration
- */
-public class RCEnvironment extends AbstractLogEnabled implements Configurable {
-
- /**
- * <code>CONFIGURATION_FILE</code> The configuration file
- */
- public static final String CONFIGURATION_FILE = "lenya" + File.separator + "config" +
- File.separator + "rc" + File.separator + "revision-controller.xconf";
- /**
- * <code>RCML_DIRECTORY</code> The RCML directory
- */
- public static final String RCML_DIRECTORY = "rcml-directory";
- /**
- * <code>BACKUP_DIRECTORY</code> The backup directory
- */
- public static final String BACKUP_DIRECTORY = "backup-directory";
- private String rcmlDirectory;
- private String backupDirectory;
-
- private static Map instances = new HashMap();
-
- /**
- * Returns the singleton RC environment for this context path.
- * @param contextPath The context path (the Lenya webapp directory).
- * @param logger The logger.
- * @return An RC environment.
- */
- public static RCEnvironment getInstance(String contextPath, Logger logger) {
- RCEnvironment instance = (RCEnvironment) instances.get(contextPath);
- if (instance == null) {
- instance = new RCEnvironment(contextPath, logger);
- instances.put(contextPath, instance);
- }
- return instance;
- }
-
- /**
- * Creates a new RCEnvironment object from the context path
- * @param contextPath The context path
- * @param logger The logger.
- */
- public RCEnvironment(String contextPath, Logger logger) {
- enableLogging(logger);
- getLogger().debug("context path:" + contextPath);
-
- String configurationFilePath = contextPath + "/" + CONFIGURATION_FILE;
- getLogger().debug("configuration file path:" + configurationFilePath);
-
- File configurationFile = new File(configurationFilePath);
-
- try {
- DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
- Configuration configuration = builder.buildFromFile(configurationFile);
- configure(configuration);
- } catch (final ConfigurationException e) {
- getLogger().error("Cannot load revision controller configuration! ", e);
- } catch (final SAXException e) {
- getLogger().error("Cannot load revision controller configuration! ", e);
- } catch (final IOException e) {
- getLogger().error("Cannot load revision controller configuration! ", e);
- }
- }
-
- /**
- @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
- throws ConfigurationException {
- // revision controller
- setRCMLDirectory(configuration.getChild("rcmlDirectory").getAttribute("href"));
- setBackupDirectory(configuration.getChild("backupDirectory").getAttribute("href"));
-
- getLogger().debug("CONFIGURATION:\nRCML Directory: href=" + getRCMLDirectory());
- getLogger().debug("CONFIGURATION:\nBackup Directory: href=" + getBackupDirectory());
- }
-
- /**
- * Get the RCML directory
- * @return The RCML directory
- */
- public String getRCMLDirectory() {
- return this.rcmlDirectory;
- }
-
- /**
- * Set the rcml directory
- * @param rcmlDir the path to the rcml directory
- */
- protected void setRCMLDirectory(String rcmlDir) {
- this.rcmlDirectory = rcmlDir;
- }
-
- /**
- * Get the backup directory
- * @return The backup directory
- */
- public String getBackupDirectory() {
- return this.backupDirectory;
- }
-
- /**
- * Set the backup directory
- * @param backupDir path to the backup directory
- */
- protected void setBackupDirectory(String backupDir) {
- this.backupDirectory = backupDir;
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/rc/RCML.java b/trunk/src/java/org/apache/lenya/cms/rc/RCML.java
deleted file mode 100644
index 2d9424d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/rc/RCML.java
+++ /dev/null
@@ -1,170 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.rc;
-
-import java.util.Vector;
-
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * An object of this class handles the revisions of a node. The node is passed as a parameter so an
- * RCML object can be shared between sessions for synchronization purposes.
- */
-public interface RCML {
-
- /**
- * <code>co</code> Checkout
- */
- short co = 0;
- /**
- * <code>ci</code> Checkin
- */
- short ci = 1;
-
- /**
- * Check the RCML in.
- * @param node The node.
- * @param backup If a backup shall be created.
- * @param newVersion If the revision number should be increased.
- * @throws RevisionControlException if an error occurs.
- */
- void checkIn(Node node, boolean backup, boolean newVersion) throws RevisionControlException;
-
- /**
- * Check the RCML out with restriction to the current session.
- * @param node The node.
- * @throws RevisionControlException if an error occurs.
- */
- void checkOut(Node node) throws RevisionControlException;
-
- /**
- * Check the RCML out.
- * @param node The node.
- * @param restrictedToSession If only the current session may check the node in, or all sessions
- * belonging to this user.
- * @throws RevisionControlException if an error occurs.
- */
- void checkOut(Node node, boolean restrictedToSession) throws RevisionControlException;
-
- /**
- * get the latest check out
- * @return CheckOutEntry The entry of the check out
- * @throws RevisionControlException if an error occurs
- */
- CheckOutEntry getLatestCheckOutEntry() throws RevisionControlException;
-
- /**
- * get the latest check in
- * @return CheckInEntry The entry of the check in
- * @throws RevisionControlException if an error occurs
- */
- CheckInEntry getLatestCheckInEntry() throws RevisionControlException;
-
- /**
- * get the latest entry (a check out or check in)
- * @return RCMLEntry The entry of the check out/in
- * @throws RevisionControlException if an error occurs
- */
- RCMLEntry getLatestEntry() throws RevisionControlException;
-
- /**
- * get all check in and check out
- * @return Vector of all check out and check in entries in this RCML-file
- * @throws RevisionControlException if an error occurs
- */
- Vector getEntries() throws RevisionControlException;
-
- /**
- * get all backup entries
- * @return Vector of all entries in this RCML-file with a backup
- * @throws Exception if an error occurs
- */
- Vector getBackupEntries() throws Exception;
-
- /**
- * Creates a backup.
- * @param time The time.
- * @throws RevisionControlException
- */
- void makeBackup(long time) throws RevisionControlException;
-
- /**
- * Restores a backup.
- * @param node The node to restore the backup to.
- * @param time The time.
- * @throws RevisionControlException
- */
- void restoreBackup(Node node, long time) throws RevisionControlException;
-
- /**
- * Prune the list of entries and delete the corresponding backups. Limit the number of entries
- * to the value maximalNumberOfEntries (2maxNumberOfRollbacks(configured)+1)
- * @throws Exception if an error occurs
- */
- void pruneEntries() throws Exception;
-
- /**
- * Check if the document is dirty
- * @return boolean dirty
- */
- boolean isDirty();
-
- /**
- * get the time's value of the backups
- * @return String[] the times
- * @throws Exception if an error occurs
- */
- String[] getBackupsTime() throws Exception;
-
- /**
- * delete the RCML file and the directory if this one is empty
- * @return boolean true, if the file was deleted
- */
- boolean delete();
-
- /**
- * Delete all revisions.
- * @throws RevisionControlException if an error occurs.
- */
- void deleteRevisions() throws RevisionControlException;
-
- /**
- * @param node The target node.
- * @param otherNode The source node.
- * @throws RevisionControlException if an error occurs.
- */
- void copyFrom(Node node, Node otherNode) throws RevisionControlException;
-
- /**
- * @return if the RCML is checked out.
- * @throws RevisionControlException if an error occurs.
- */
- boolean isCheckedOut() throws RevisionControlException;
-
- /**
- * @param session The session.
- * @return if the RCML is checked out by this session.
- * @throws RevisionControlException if an error occurs.
- */
- boolean isCheckedOutBySession(Session session) throws RevisionControlException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/rc/RCMLEntry.java b/trunk/src/java/org/apache/lenya/cms/rc/RCMLEntry.java
deleted file mode 100644
index 321874d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/rc/RCMLEntry.java
+++ /dev/null
@@ -1,86 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.rc;
-
-/**
- * A RCML entry
- */
-public class RCMLEntry {
-
- private String identity = null;
- private long time = 0;
- private short type = 0;
- private String sessionId;
-
- /**
- * Creates a new RCMLEntry object.
- * @param sessionId The session ID.
- * @param _identity The identity of the person for this RCML
- * @param _time The time of the checkin / checkout
- */
- public RCMLEntry(String sessionId, String _identity, long _time) {
- this.identity = _identity;
- this.time = _time;
- this.sessionId = sessionId;
- }
-
- /**
- * Get the identity of the creator (i.e. the user name)
- * FIXME: this should be changed to an o.a.l.ac.Identity object
- * @return the identity
- */
- public String getIdentity() {
- return this.identity;
- }
-
- /**
- * Get the creation time.
- * @return the time
- */
- public long getTime() {
- return this.time;
- }
-
- /**
- * Get the type (checkin or checkout).
- * @see org.apache.lenya.cms.rc.RCML.ci
- * @see org.apache.lenya.cms.rc.RCML.co
- * @return the type
- */
- public short getType() {
- return this.type;
- }
-
- /**
- * Set the type (checkin or checkout).
- * @see org.apache.lenya.cms.rc.RCML.ci
- * @see org.apache.lenya.cms.rc.RCML.co
- * @param s the type
- */
- protected void setType(short s) {
- this.type = s;
- }
-
- public String getSessionId() {
- return this.sessionId;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/rc/RevisionControlException.java b/trunk/src/java/org/apache/lenya/cms/rc/RevisionControlException.java
deleted file mode 100644
index 9abf361..0000000
--- a/trunk/src/java/org/apache/lenya/cms/rc/RevisionControlException.java
+++ /dev/null
@@ -1,65 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.rc;
-
-/**
- * A revision control exception.
- */
-public class RevisionControlException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Ctor.
- */
- public RevisionControlException() {
- super();
- }
-
- /**
- * Ctor.
- * @param message The message.
- */
- public RevisionControlException(String message) {
- super(message);
- }
-
- /**
- * Ctor.
- * @param cause The cause.
- */
- public RevisionControlException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Ctor.
- * @param message The message.
- * @param cause The cause.
- */
- public RevisionControlException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/ContentHolder.java b/trunk/src/java/org/apache/lenya/cms/repository/ContentHolder.java
deleted file mode 100644
index 48db35f..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/ContentHolder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.lenya.cms.repository;
-
-import java.io.InputStream;
-
-import org.apache.lenya.cms.metadata.MetaDataOwner;
-
-/**
- * Super interface for nodes and revisions.
- */
-public interface ContentHolder extends MetaDataOwner {
-
- /**
- * @return The last modification date. The date is measured in milliseconds
- * since the epoch (00:00:00 GMT, January 1, 1970), and is 0 if it's
- * unknown.
- * @throws RepositoryException if the node does not exist.
- */
- long getLastModified() throws RepositoryException;
-
- /**
- * @return The content length.
- * @throws RepositoryException if the node does not exist.
- */
- long getContentLength() throws RepositoryException;
-
- /**
- * Accessor for the source URI of this node
- * @return the source URI
- */
- String getSourceURI();
-
- /**
- * @return if the item exists.
- * @throws RepositoryException if an error occurs.
- */
- boolean exists() throws RepositoryException;
-
- /**
- * @return The input stream.
- * @throws RepositoryException if the node does not exist.
- */
- InputStream getInputStream() throws RepositoryException;
-
- /**
- * @return The MIME type.
- * @throws RepositoryException if the node does not exist.
- */
- String getMimeType() throws RepositoryException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/History.java b/trunk/src/java/org/apache/lenya/cms/repository/History.java
deleted file mode 100644
index 89d7765..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/History.java
+++ /dev/null
@@ -1,42 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-/**
- * The revision history of a node.
- */
-public interface History {
-
- /**
- * @return The available revision numbers in descending order (starting with the newest one).
- */
- int[] getRevisionNumbers();
-
- /**
- * @return The latest revision.
- */
- Revision getLatestRevision();
-
- /**
- * @param number A revision number.
- * @return A revision.
- * @throws RepositoryException if no revision with this number exists.
- */
- Revision getRevision(int number) throws RepositoryException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/Node.java b/trunk/src/java/org/apache/lenya/cms/repository/Node.java
deleted file mode 100644
index 4a3531f..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/Node.java
+++ /dev/null
@@ -1,183 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-import java.io.OutputStream;
-import java.util.Collection;
-
-/**
- * A repository node is used to persist a {@link Persistable}.
- *
- * @version $Id$
- */
-public interface Node extends RepositoryItem, ContentHolder {
-
- /**
- * @return The session this node belongs to.
- */
- Session getSession();
-
- /**
- * The protocol with which to find Lenya nodes
- */
- String LENYA_PROTOCOL = "lenya://";
-
- /**
- * The identifiable type.
- */
- String IDENTIFIABLE_TYPE = "node";
-
- /**
- * @return if the node exists.
- * @throws RepositoryException if an error occurs.
- */
- boolean exists() throws RepositoryException;
-
- /**
- * @return if the node is a collection.
- * @throws RepositoryException if an error occurs.
- */
- boolean isCollection() throws RepositoryException;
-
- /**
- * @return children
- * @throws RepositoryException if an error occurs.
- */
- public Collection getChildren() throws RepositoryException;
-
- /**
- * @return The output stream.
- * @throws RepositoryException if the node does not exist.
- */
- OutputStream getOutputStream() throws RepositoryException;
-
- /**
- * Locks the node.
- * @throws RepositoryException if an error occurs.
- */
- void lock() throws RepositoryException;
-
- /**
- * Unlocks the node.
- * @throws RepositoryException if an error occurs.
- */
- void unlock() throws RepositoryException;
-
- /**
- * Checks out the node with restriction to the current session..
- * @throws RepositoryException if an error occurs.
- */
- void checkout() throws RepositoryException;
-
- /**
- * Checks out the node with the possibility to allow other sessions to check it in.
- * This is a workaround for the current WYSIWYG editor infrastructure, which can't
- * use the same session for opening and saving a node.
- * @param restrictedToSession if the check-out is restricted to the current session.
- * @throws RepositoryException if an error occurs.
- */
- void checkout(boolean restrictedToSession) throws RepositoryException;
-
- /**
- * Checks in the node.
- * @throws RepositoryException if the node is not checked out or is checked
- * out by a different session.
- */
- void checkin() throws RepositoryException;
-
- /**
- * Checks in the node even if it is checked out by a different session.
- * @throws RepositoryException if the node is not checked out.
- */
- void forceCheckIn() throws RepositoryException;
-
- /**
- * Registers the node as dirty.
- * @throws RepositoryException if an error occurs.
- */
- void registerDirty() throws RepositoryException;
-
- /**
- * @return if the node is checked out.
- * @throws RepositoryException if an error occurs.
- */
- boolean isCheckedOut() throws RepositoryException;
-
- /**
- * @return The ID of the user who has checked out this node.
- * @throws RepositoryException if the node is not checked out.
- */
- String getCheckoutUserId() throws RepositoryException;
-
- /**
- * Checks if the node is checked out by a certain session. We pass the session
- * as a parameter to allow the check for nodes from the shared item store.
- * @param session The session.
- * @return if the node is checked out by a specific session.
- * @throws RepositoryException if an error occurs.
- */
- boolean isCheckedOutBySession(Session session) throws RepositoryException;
-
- /**
- * @param source The node to copy the revisions from.
- * @throws RepositoryException if an error occurs.
- */
- void copyRevisionsFrom(Node source) throws RepositoryException;
-
- /**
- * @param revisionNumber The revision number to roll back.
- * @throws RepositoryException if this revision doesn't exist.
- */
- void rollback(int revisionNumber) throws RepositoryException;
-
- /**
- * @return if the node is locked.
- * @throws RepositoryException if an error occurs.
- */
- boolean isLocked() throws RepositoryException;
-
- /**
- * Registers the node as removed.
- * @throws RepositoryException if an error occurs.
- */
- void registerRemoved() throws RepositoryException;
-
- /**
- * @return The revision history.
- */
- History getHistory();
-
- /**
- * Delete this node.
- * @throws RepositoryException if an error occurs.
- */
- void delete() throws RepositoryException;
-
- /**
- * @param persistable The object which is persisted using the node.
- * @throws RepositoryException if the node already has an item.
- */
- void setPersistable(Persistable persistable) throws RepositoryException;
-
- /**
- * @return The object which is persisted using this node or <code>null</code>
- * if no object is registered.
- */
- Persistable getPersistable();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/NodeFactory.java b/trunk/src/java/org/apache/lenya/cms/repository/NodeFactory.java
deleted file mode 100644
index b438d09..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/NodeFactory.java
+++ /dev/null
@@ -1,31 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-/**
- * Factory to produce repository nodes.
- * @version $Id:$
- */
-public interface NodeFactory extends RepositoryItemFactory {
-
- /**
- * The role of the service.
- */
- String ROLE = NodeFactory.class.getName();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/Persistable.java b/trunk/src/java/org/apache/lenya/cms/repository/Persistable.java
deleted file mode 100644
index 837b4ee..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/Persistable.java
+++ /dev/null
@@ -1,37 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-/**
- * An object which can be persisted to a node.
- */
-public interface Persistable {
-
- /**
- * Save the content of the persistable object to the node. This method is called by the node
- * before the session is committed.
- * @throws RepositoryException if the object couldn't be saved.
- */
- void save() throws RepositoryException;
-
- /**
- * @return if the persistable object has been modified, i.e. if it needs to be saved.
- */
- boolean isModified();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryException.java b/trunk/src/java/org/apache/lenya/cms/repository/RepositoryException.java
deleted file mode 100644
index 104ba59..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryException.java
+++ /dev/null
@@ -1,60 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-import org.apache.lenya.transaction.TransactionException;
-
-/**
- * Repository exception.
- * @version $Id:$
- */
-public class RepositoryException extends TransactionException {
-
- /**
- * Ctor.
- */
- public RepositoryException() {
- super();
- }
-
- /**
- * Ctor.
- * @param arg0
- * @param arg1
- */
- public RepositoryException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- /**
- * Ctor.
- * @param arg0
- */
- public RepositoryException(String arg0) {
- super(arg0);
- }
-
- /**
- * Ctor.
- * @param arg0
- */
- public RepositoryException(Throwable arg0) {
- super(arg0);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItem.java b/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItem.java
deleted file mode 100644
index 3ebb5ef..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItem.java
+++ /dev/null
@@ -1,30 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-/**
- * Marker interface for repository items.
- */
-public interface RepositoryItem {
-
- /**
- * @return The session this item belongs to.
- */
- Session getSession();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItemFactory.java b/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItemFactory.java
deleted file mode 100644
index 6099d6f..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItemFactory.java
+++ /dev/null
@@ -1,38 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-/**
- * Interface for repository item factories.
- */
-public interface RepositoryItemFactory {
-
- /**
- * @return The item type.
- */
- String getItemType();
-
- /**
- * @param session The current session.
- * @param key The key.
- * @return A repository item.
- * @throws RepositoryException if an error occurs.
- */
- RepositoryItem buildItem(Session session, String key) throws RepositoryException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItemFactoryWrapper.java b/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItemFactoryWrapper.java
deleted file mode 100644
index 0c35c2d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItemFactoryWrapper.java
+++ /dev/null
@@ -1,49 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-import org.apache.lenya.transaction.IdentifiableFactory;
-import org.apache.lenya.transaction.IdentityMap;
-
-/**
- * Wraps a repository item factory to resemble an identifiable factory.
- */
-public class RepositoryItemFactoryWrapper implements IdentifiableFactory {
-
- private RepositoryItemFactory delegate;
- private Session session;
-
- /**
- * Ctor.
- * @param delegate The factory to wrap.
- * @param session The session.
- */
- public RepositoryItemFactoryWrapper(RepositoryItemFactory delegate, Session session) {
- this.delegate = delegate;
- this.session = session;
- }
-
- public Object build(IdentityMap map, String key) throws Exception {
- return delegate.buildItem(this.session, key);
- }
-
- public String getType() {
- return this.delegate.getItemType();
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryManager.java b/trunk/src/java/org/apache/lenya/cms/repository/RepositoryManager.java
deleted file mode 100644
index f946307..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryManager.java
+++ /dev/null
@@ -1,41 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-import org.apache.lenya.ac.Identity;
-
-/**
- * Repository manager.
- * @version $Id:$
- */
-public interface RepositoryManager {
-
- /**
- * The role of the service.
- */
- String ROLE = RepositoryManager.class.getName();
-
- /**
- * @param identity The identity the session belongs to.
- * @param modifiable Determines if the repository items in this session should be modifiable.
- * @return A session.
- * @throws RepositoryException if an error occurs.
- */
- Session createSession(Identity identity, boolean modifiable) throws RepositoryException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java b/trunk/src/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java
deleted file mode 100644
index 978248d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java
+++ /dev/null
@@ -1,46 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.lenya.ac.Identity;
-
-/**
- * Repository manager implementation.
- * @version $Id:$
- */
-public class RepositoryManagerImpl extends AbstractLogEnabled implements RepositoryManager,
- Serviceable {
-
- protected ServiceManager manager;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
- public Session createSession(Identity identity, boolean modifiable) throws RepositoryException {
- return new SessionImpl(identity, modifiable, this.manager, getLogger());
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryUtil.java b/trunk/src/java/org/apache/lenya/cms/repository/RepositoryUtil.java
deleted file mode 100644
index 3cbd014..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/RepositoryUtil.java
+++ /dev/null
@@ -1,97 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.ac.Identity;
-
-/**
- * Repository utility class.
- */
-public class RepositoryUtil {
-
- /**
- * Returns the session attached to the request or creates a session.
- * @param manager The service manager.
- * @param request The request.
- * @return A session.
- * @throws RepositoryException if an error occurs.
- */
- public static Session getSession(ServiceManager manager, Request request)
- throws RepositoryException {
- Session session = (Session) request.getAttribute(Session.class.getName());
- if (session == null) {
- Identity identity = getIdentity(request);
- // attach a read-only repository session to the HTTP request
- session = createSession(manager, identity, false);
- request.setAttribute(Session.class.getName(), session);
- } else if (session.getIdentity() == null) {
- Identity identity = getIdentity(request);
- if (identity != null) {
- session.setIdentity(identity);
- }
- }
- return session;
- }
-
- protected static Identity getIdentity(Request request) {
- org.apache.cocoon.environment.Session cocoonSession = request.getSession();
- Identity identity = (Identity) cocoonSession.getAttribute(Identity.class.getName());
- return identity;
- }
-
- /**
- * Creates a session.
- * @param manager The service manager.
- * @param identity The identity.
- * @param modifiable Determines if the repository items in this session should be modifiable.
- * @return a session.
- * @throws RepositoryException if an error occurs.
- */
- public static Session createSession(ServiceManager manager, Identity identity, boolean modifiable)
- throws RepositoryException {
- RepositoryManager repoMgr = null;
- Session session;
- try {
- repoMgr = (RepositoryManager) manager.lookup(RepositoryManager.ROLE);
- session = repoMgr.createSession(identity, modifiable);
- } catch (Exception e) {
- throw new RepositoryException(e);
- } finally {
- manager.release(repoMgr);
- }
- return session;
- }
-
- /**
- * Removes the repository session from the servlet session.
- * @param manager The service manager.
- * @param request The current request.
- */
- public static void removeSession(ServiceManager manager, Request request) {
- request.removeAttribute(Session.class.getName());
- /*
- org.apache.cocoon.environment.Session session = request.getSession(false);
- if (session != null) {
- session.removeAttribute(Session.class.getName());
- }
- */
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/Revision.java b/trunk/src/java/org/apache/lenya/cms/repository/Revision.java
deleted file mode 100644
index 1805bab..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/Revision.java
+++ /dev/null
@@ -1,40 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-/**
- * A revision.
- */
-public interface Revision extends ContentHolder {
-
- /**
- * @return The revision number.
- */
- int getNumber();
-
- /**
- * @return The time when this revision was created.
- */
- long getTime();
-
- /**
- * @return The ID of the user who created this revision.
- */
- String getUserId();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/Session.java b/trunk/src/java/org/apache/lenya/cms/repository/Session.java
deleted file mode 100644
index 9780f48..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/Session.java
+++ /dev/null
@@ -1,91 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.cms.observation.RepositoryEvent;
-import org.apache.lenya.cms.observation.RepositoryListener;
-import org.apache.lenya.transaction.ConcurrentModificationException;
-import org.apache.lenya.transaction.UnitOfWork;
-
-/**
- * Repository session.
- */
-public interface Session extends UnitOfWork {
-
- /**
- * @return the identity this session belongs to.
- */
- Identity getIdentity();
-
- /**
- * Commits the transaction.
- * @throws RepositoryException if an error occurs.
- * @throws ConcurrentModificationException if a transactionable has been
- * modified by another session.
- */
- void commit() throws RepositoryException, ConcurrentModificationException;
-
- /**
- * Rolls the transaction back.
- * @throws RepositoryException if an error occurs.
- */
- void rollback() throws RepositoryException;
-
- /**
- * @param factory The factory.
- * @param key The key.
- * @return The item for the specific key.
- * @throws RepositoryException if an error occurs.
- */
- RepositoryItem getRepositoryItem(RepositoryItemFactory factory, String key)
- throws RepositoryException;
-
- /**
- * @param listener The listener to add.
- * @throws RepositoryException if the listener is already registered.
- */
- void addListener(RepositoryListener listener) throws RepositoryException;
-
- /**
- * Checks if a listener is registered.
- * @param listener The listener.
- * @return A boolean value.
- */
- boolean isListenerRegistered(RepositoryListener listener);
-
- /**
- * @param event The event to add to the queue.
- */
- void enqueueEvent(RepositoryEvent event);
-
- /**
- * @param identity The identity.
- */
- void setIdentity(Identity identity);
-
- /**
- * @return if the repository items in this session can be modified.
- */
- boolean isModifiable();
-
- /**
- * @return The ID of this session.
- */
- String getId();
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java b/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
deleted file mode 100644
index 3d0dec3..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
+++ /dev/null
@@ -1,290 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.cms.observation.ObservationRegistry;
-import org.apache.lenya.cms.observation.RepositoryEvent;
-import org.apache.lenya.cms.observation.RepositoryListener;
-import org.apache.lenya.transaction.ConcurrentModificationException;
-import org.apache.lenya.transaction.IdentityMap;
-import org.apache.lenya.transaction.IdentityMapImpl;
-import org.apache.lenya.transaction.Lock;
-import org.apache.lenya.transaction.Lockable;
-import org.apache.lenya.transaction.TransactionException;
-import org.apache.lenya.transaction.TransactionLock;
-import org.apache.lenya.transaction.Transactionable;
-import org.apache.lenya.transaction.UnitOfWork;
-import org.apache.lenya.transaction.UnitOfWorkImpl;
-import org.apache.lenya.util.Assert;
-
-/**
- * Repository session.
- */
-public class SessionImpl extends AbstractLogEnabled implements Session {
-
- protected static final String UNMODIFIABLE_SESSION_ID = "unmodifiable";
- private ServiceManager manager;
- private Identity identity;
-
- /**
- * Ctor.
- * @param identity The identity.
- * @param modifiable Determines if the repository items in this session can be modified.
- * @param manager The service manager.
- * @param logger The logger.
- */
- public SessionImpl(Identity identity, boolean modifiable, ServiceManager manager, Logger logger) {
-
- ContainerUtil.enableLogging(this, logger);
-
- Assert.notNull("service manager", manager);
- this.manager = manager;
-
- this.identityMap = new IdentityMapImpl(logger);
- this.identity = identity;
- this.id = modifiable ? createUuid() : UNMODIFIABLE_SESSION_ID;
-
- ObservationRegistry registry = null;
- try {
- registry = (ObservationRegistry) this.manager.lookup(ObservationRegistry.ROLE);
- addListener(registry);
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (registry != null) {
- this.manager.release(registry);
- }
- }
-
- if (modifiable) {
- this.unitOfWork = new UnitOfWorkImpl(this.identityMap, this.identity, getLogger());
- }
- }
-
- protected String createUuid() {
- String id;
- UUIDGenerator generator = null;
- try {
-
- generator = (UUIDGenerator) this.manager.lookup(UUIDGenerator.ROLE);
- id = generator.nextUUID();
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (generator == null) {
- this.manager.release(generator);
- }
- }
- return id;
- }
-
- public Identity getIdentity() {
- return this.identity;
- }
-
- private UnitOfWork unitOfWork;
- private SharedItemStore sharedItemStore;
-
- /**
- * @return The unit of work.
- */
- protected UnitOfWork getUnitOfWork() {
- if (this.unitOfWork == null) {
- throw new RuntimeException("This session [" + getId() + "] is not modifiable!");
- }
- return this.unitOfWork;
- }
-
- private boolean committing = false;
-
- /**
- * Commits the transaction.
- * @throws RepositoryException if an error occurs.
- * @throws ConcurrentModificationException if a transactionable has been modified by another
- * session.
- */
- public synchronized void commit() throws RepositoryException, ConcurrentModificationException {
-
- savePersistables();
-
- this.committing = true;
-
- try {
- synchronized (TransactionLock.LOCK) {
-
- getUnitOfWork().commit();
- getSharedItemStore().clear();
- }
- } catch (ConcurrentModificationException e) {
- throw e;
- } catch (TransactionException e) {
- throw new RepositoryException(e);
- }
-
- for (Iterator i = this.events.iterator(); i.hasNext();) {
- RepositoryEvent event = (RepositoryEvent) i.next();
- for (Iterator l = this.listeners.iterator(); l.hasNext();) {
- RepositoryListener listener = (RepositoryListener) l.next();
- listener.eventFired(event);
- }
- }
- this.events.clear();
- this.committing = false;
- }
-
- /**
- * Save all persistable objects to their nodes.
- * @throws RepositoryException if an error occurs.
- */
- protected void savePersistables() throws RepositoryException {
- Object[] objects = getIdentityMap().getObjects();
- for (int i = 0; i < objects.length; i++) {
- if (objects[i] instanceof Node) {
- Node node = (Node) objects[i];
- Persistable persistable = node.getPersistable();
- if (persistable != null && persistable.isModified()) {
- persistable.save();
- }
- }
- }
- }
-
- /**
- * Rolls the transaction back.
- * @throws RepositoryException if an error occurs.
- */
- public void rollback() throws RepositoryException {
- try {
- synchronized (TransactionLock.LOCK) {
- getUnitOfWork().rollback();
- }
- } catch (TransactionException e) {
- throw new RepositoryException(e);
- }
- this.events.clear();
- }
-
- protected SharedItemStore getSharedItemStore() {
- if (this.sharedItemStore == null) {
- try {
- this.sharedItemStore = (SharedItemStore) this.manager.lookup(SharedItemStore.ROLE);
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- }
- }
- return this.sharedItemStore;
- }
-
- /**
- * @see org.apache.lenya.cms.repository.Session#getRepositoryItem(org.apache.lenya.cms.repository.RepositoryItemFactory,
- * java.lang.String)
- */
- public RepositoryItem getRepositoryItem(RepositoryItemFactory factory, String key)
- throws RepositoryException {
- RepositoryItemFactoryWrapper wrapper = new RepositoryItemFactoryWrapper(factory, this);
- return (RepositoryItem) getIdentityMap().get(wrapper, key);
- }
-
- public void registerNew(Transactionable object) throws TransactionException {
- getUnitOfWork().registerNew(object);
- }
-
- public void registerDirty(Transactionable object) throws TransactionException {
- getUnitOfWork().registerDirty(object);
- }
-
- public void registerRemoved(Transactionable object) throws TransactionException {
- getUnitOfWork().registerRemoved(object);
- }
-
- /**
- * @param identity The identity.
- */
- public void setIdentity(Identity identity) {
- this.identity = identity;
- }
-
- public boolean isDirty(Transactionable transactionable) {
- return getUnitOfWork().isDirty(transactionable);
- }
-
- public Lock createLock(Lockable lockable, int version) throws TransactionException {
- return getUnitOfWork().createLock(lockable, version);
- }
-
- public void removeLock(Lockable lockable) throws TransactionException {
- getUnitOfWork().removeLock(lockable);
- }
-
- private Set listeners = new HashSet();
-
- public void addListener(RepositoryListener listener) throws RepositoryException {
- if (this.listeners.contains(listener)) {
- throw new RepositoryException("The listener [" + listener
- + "] is already registered for node [" + this + "]!");
- }
- this.listeners.add(listener);
- }
-
- public boolean isListenerRegistered(RepositoryListener listener) {
- return this.listeners.contains(listener);
- }
-
- private List events = new ArrayList();
- private IdentityMap identityMap;
-
- public synchronized void enqueueEvent(RepositoryEvent event) {
- if (!isModifiable()) {
- throw new RuntimeException("Can't enqueue event in unmodifiable session!");
- }
- if (committing) {
- throw new RuntimeException(
- "No events can be queued while the session is being committed. Event: ["
- + event.getDescriptor() + "]");
- }
- Assert.isTrue("event belongs to session", event.getSession() == this);
- this.events.add(event);
- }
-
- protected IdentityMap getIdentityMap() {
- return this.identityMap;
- }
-
- public boolean isModifiable() {
- return this.unitOfWork != null;
- }
-
- private String id;
-
- public String getId() {
- return this.id;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/SharedItemStore.java b/trunk/src/java/org/apache/lenya/cms/repository/SharedItemStore.java
deleted file mode 100644
index e84e9ee..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/SharedItemStore.java
+++ /dev/null
@@ -1,35 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-/**
- * Store for read-only items which are shared by all sessions for performance reasons.
- */
-public interface SharedItemStore extends Session {
-
- /**
- * The service role.
- */
- String ROLE = SharedItemStore.class.getName();
-
- /**
- * Clears the store when a session has been committed.
- */
- void clear();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/repository/UUIDGenerator.java b/trunk/src/java/org/apache/lenya/cms/repository/UUIDGenerator.java
deleted file mode 100644
index d5dc976..0000000
--- a/trunk/src/java/org/apache/lenya/cms/repository/UUIDGenerator.java
+++ /dev/null
@@ -1,35 +0,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.
- *
- */
-package org.apache.lenya.cms.repository;
-
-/**
- * UUID generator.
- */
-public interface UUIDGenerator {
-
- /**
- * The service role.
- */
- String ROLE = UUIDGenerator.class.getName();
-
- /**
- * @return A new UUID.
- */
- public String nextUUID();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/site/AbstractLink.java b/trunk/src/java/org/apache/lenya/cms/site/AbstractLink.java
deleted file mode 100644
index 9b09306..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/AbstractLink.java
+++ /dev/null
@@ -1,129 +0,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.
- *
- */
-
-/* @version $Id$ */
-
-package org.apache.lenya.cms.site;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * The AbstractLink class encapsulates a string label and a associated language.
- */
-public abstract class AbstractLink implements Link {
- private String label = null;
- private String language = null;
-
- /**
- * Creates a new AbstractLink object.
- * @param factory The document factory.
- * @param node The site node.
- * @param _label the actual label
- * @param _language the language
- */
- public AbstractLink(DocumentFactory factory, SiteNode node, String _label, String _language) {
- this.label = _label;
- this.language = _language;
- this.factory = factory;
- this.node = node;
- }
-
- /**
- * Get the actual label of the AbstractLink object
- *
- * @return the actual label as a String
- */
- public String getLabel() {
- return this.label;
- }
-
- /**
- * Get the language of this AbstractLink object
- *
- * @return the language
- */
-
- public String getLanguage() {
- return this.language;
- }
-
- /**
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return getLabel() + " " + getLanguage();
- }
-
- /**
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- boolean equals = false;
-
- if (getClass().isInstance(obj)) {
- AbstractLink otherLabel = (AbstractLink) obj;
- equals = getLabel().equals(otherLabel.getLabel())
- && getLanguage().equals(otherLabel.getLanguage());
- }
-
- return equals;
- }
-
- /**
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getLabel().hashCode() + getLanguage().hashCode();
- }
-
- private SiteNode node;
- private DocumentFactory factory;
-
- public Document getDocument() {
- SiteNode node = getNode();
- String uuid = node.getUuid();
- if (uuid == null) {
- throw new UnsupportedOperationException("The node [" + node + "] has no UUID.");
- }
- Publication pub = node.getStructure().getPublication();
- String area = node.getStructure().getArea();
- try {
- return this.factory.get(pub, area, uuid, getLanguage());
- } catch (DocumentBuildException e) {
- throw new RuntimeException(e);
- }
- }
-
- public SiteNode getNode() {
- return this.node;
- }
-
- public void setLabel(String label) {
- this.label = label;
- save();
- }
-
- protected void save() {}
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/site/AbstractSiteManager.java b/trunk/src/java/org/apache/lenya/cms/site/AbstractSiteManager.java
deleted file mode 100644
index 98af2f8..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/AbstractSiteManager.java
+++ /dev/null
@@ -1,194 +0,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.
- *
- */
-
-package org.apache.lenya.cms.site;
-
-import java.util.Arrays;
-import java.util.Comparator;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.lenya.cms.publication.DocumentFactory;
-
-/**
- * Abstract base class for site managers.
- *
- * @version $Id$
- */
-public abstract class AbstractSiteManager extends AbstractLogEnabled implements SiteManager, Serviceable {
-
- protected ServiceManager manager;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
- /**
- * Ctor.
- * @param manager The service manager.
- */
- public AbstractSiteManager() {
- }
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#sortAscending(org.apache.lenya.cms.publication.util.DocumentSet)
- */
- public SiteNode[] sortAscending(SiteNode[] nodes) throws SiteException {
- if (nodes.length > 0) {
-
- DocumentFactory map = nodes[0].getStructure().getPublication().getFactory();
- if (!check(map, new NodeSet(this.manager, nodes))) {
- throw new SiteException("The dependence relation is not a strict partial order!");
- }
-
- SiteNode[] sortedNodes = (SiteNode[]) Arrays.asList(nodes).toArray(new SiteNode[nodes.length]);
- Arrays.sort(sortedNodes, new NodeComparator(map));
- return sortedNodes;
- }
- else {
- return nodes;
- }
- }
-
- /**
- * Checks if the dependence relation is a strict partial order.
- *
- * @param map The identity map to operate on.
- * @param set The document set to check.
- * @return A boolean value.
- * @throws SiteException when something went wrong.
- */
- protected boolean check(DocumentFactory map, NodeSet set) throws SiteException {
- boolean isStrictPartialOrder = isIrreflexive(map, set) && isAntisymmetric(map, set)
- && isTransitive(map, set);
- return isStrictPartialOrder;
- }
-
- /**
- * Checks if the dependence relation is antisymmetric.
- *
- * @param map The identity map to operate on.
- * @param set The document set to check.
- * @return A boolean value.
- * @throws SiteException when something went wrong.
- */
- protected boolean isAntisymmetric(DocumentFactory map, NodeSet set) throws SiteException {
- SiteNode[] resources = set.getNodes();
- boolean isAntisymmetric = true;
- for (int i = 0; i < resources.length; i++) {
- for (int j = i + 1; j < resources.length; j++) {
- if (requires(map, resources[i], resources[j])
- && requires(map, resources[j], resources[i])
- && !(resources[i] == resources[j])) {
- isAntisymmetric = false;
- }
- }
- }
- return isAntisymmetric;
- }
-
- /**
- * Checks if the dependence relation is transitive.
- *
- * @param map The identity map to operate on.
- * @param set The document set to check.
- * @return A boolean value.
- * @throws SiteException when something went wrong.
- */
- protected boolean isTransitive(DocumentFactory map, NodeSet set) throws SiteException {
- SiteNode[] resources = set.getNodes();
- boolean isTransitive = true;
- for (int i = 0; i < resources.length; i++) {
- for (int j = i + 1; j < resources.length; j++) {
- for (int k = j + 1; k < resources.length; k++) {
- if (requires(map, resources[i], resources[j])
- && requires(map, resources[j], resources[k])
- && !requires(map, resources[i], resources[k])) {
- isTransitive = false;
- }
- }
- }
- }
- return isTransitive;
- }
-
- /**
- * Checks if the dependence relation is irreflexive.
- *
- * @param map The identity map to operate on.
- * @param set The document set.
- * @return A boolean value
- * @throws SiteException
- */
- protected boolean isIrreflexive(DocumentFactory map, NodeSet set) throws SiteException {
- SiteNode[] resources = set.getNodes();
- boolean isIrreflexive = true;
- for (int i = 0; i < resources.length; i++) {
- if (requires(map, resources[i], resources[i])) {
- isIrreflexive = false;
- }
- }
- return isIrreflexive;
- }
-
- /**
- * Compares nodes according to the dependence relation.
- */
- public class NodeComparator implements Comparator {
-
- /**
- * Ctor.
- *
- * @param map The identity map to operate on.
- */
- public NodeComparator(DocumentFactory map) {
- this.map = map;
- }
-
- private DocumentFactory map;
-
- /**
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object arg0, Object arg1) {
- int result = 0;
- if (arg0 instanceof SiteNode && arg1 instanceof SiteNode) {
- SiteNode doc1 = (SiteNode) arg0;
- SiteNode doc2 = (SiteNode) arg1;
-
- try {
- if (AbstractSiteManager.this.requires(map, doc1, doc2)) {
- result = 1;
- }
- if (AbstractSiteManager.this.requires(map, doc2, doc1)) {
- result = -1;
- }
- } catch (SiteException e) {
- throw new RuntimeException(e);
- }
- }
- return result;
- }
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/site/AbstractSiteNode.java b/trunk/src/java/org/apache/lenya/cms/site/AbstractSiteNode.java
deleted file mode 100644
index a437281..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/AbstractSiteNode.java
+++ /dev/null
@@ -1,107 +0,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.
- *
- */
-package org.apache.lenya.cms.site;
-
-import java.util.Arrays;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.util.Assert;
-
-/**
- * Abstract site node implementation.
- */
-public abstract class AbstractSiteNode extends AbstractLogEnabled implements SiteNode {
-
- private String path;
- private SiteStructure structure;
- private String uuid;
-
- protected AbstractSiteNode(Publication publication, SiteStructure structure, String path,
- String uuid, Logger logger) {
-
- ContainerUtil.enableLogging(this, logger);
-
- Assert.notNull("structure", structure);
- this.structure = structure;
-
- Assert.notNull("path", path);
- Assert.isTrue("path starts with /", path.startsWith("/"));
- this.path = path;
-
- Assert.notNull("uuid", uuid);
- this.uuid = uuid;
- }
-
- public String getPath() {
- return path;
- }
-
- public SiteStructure getStructure() {
- return this.structure;
- }
-
- public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof SiteNode)) {
- return false;
- }
- String thisKey = getKey(getStructure().getPublication(),
- getStructure().getArea(),
- getPath());
- SiteNode node = (SiteNode) obj;
- String nodeKey = getKey(node.getStructure().getPublication(),
- node.getStructure().getArea(),
- node.getPath());
- return thisKey.equals(nodeKey);
- }
-
- public int hashCode() {
- return getKey(getStructure().getPublication(), getStructure().getArea(), getPath()).hashCode();
- }
-
- protected static String getKey(Publication pub, String area, String docId) {
- return pub.getId() + ":" + area + ":" + docId;
- }
-
- public SiteNode getParent() throws SiteException {
- String id = getPath().substring(1);
- String[] steps = id.split("/");
- if (steps.length == 1) {
- throw new SiteException("The node [" + getPath() + "] is a top-level node.");
- } else {
- int lastIndex = id.lastIndexOf("/");
- String parentId = id.substring(0, lastIndex);
- return getStructure().getNode("/" + parentId);
- }
- }
-
- public boolean isTopLevel() {
- return getPath().lastIndexOf("/") == 0;
- }
-
- public String getUuid() {
- return this.uuid;
- }
-
- public boolean hasLink(String language) {
- return Arrays.asList(getLanguages()).contains(language);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/site/Link.java b/trunk/src/java/org/apache/lenya/cms/site/Link.java
deleted file mode 100644
index d7e3f14..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/Link.java
+++ /dev/null
@@ -1,58 +0,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.
- *
- */
-package org.apache.lenya.cms.site;
-
-import org.apache.lenya.cms.publication.Document;
-
-/**
- * A link in the site structure references a document.
- * A site node contains a link for each translation.
- */
-public interface Link {
-
- /**
- * @return The language of this link.
- */
- String getLanguage();
-
- /**
- * @return The document this link points to.
- */
- Document getDocument();
-
- /**
- * @return The node this link belongs to.
- */
- SiteNode getNode();
-
- /**
- * @return The label of this link.
- */
- String getLabel();
-
- /**
- * @param label The new label.
- */
- void setLabel(String label);
-
- /**
- * Removes the link.
- */
- void delete();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/site/NodeIterator.java b/trunk/src/java/org/apache/lenya/cms/site/NodeIterator.java
deleted file mode 100644
index 29c05e8..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/NodeIterator.java
+++ /dev/null
@@ -1,65 +0,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.
- *
- */
-package org.apache.lenya.cms.site;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.lenya.util.Assert;
-
-/**
- * Node iterator.
- */
-public class NodeIterator {
-
- private Iterator delegate;
-
- /**
- * @param collection The collection to iterate over.
- */
- public NodeIterator(Collection collection) {
- Assert.notNull("collection", collection);
- this.delegate = collection.iterator();
- }
-
- /**
- * @param nodes The nodes to iterate over.
- */
- public NodeIterator(SiteNode[] nodes) {
- Assert.notNull("nodes", nodes);
- this.delegate = Arrays.asList(nodes).iterator();
- }
-
- /**
- * @return A site node.
- * @see Iterator#next()
- */
- public SiteNode next() {
- return (SiteNode) this.delegate.next();
- }
-
- /**
- * @return A boolean value.
- * @see Iterator#hasNext()
- */
- public boolean hasNext() {
- return this.delegate.hasNext();
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/site/NodeSet.java b/trunk/src/java/org/apache/lenya/cms/site/NodeSet.java
deleted file mode 100644
index 44d11c3..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/NodeSet.java
+++ /dev/null
@@ -1,213 +0,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.
- *
- */
-package org.apache.lenya.cms.site;
-
-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 org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.util.DocumentSet;
-
-/**
- * A set containing nodes.
- */
-public class NodeSet {
-
- private ServiceManager manager;
-
- /**
- * Ctor.
- * @param manager The service manager.
- */
- public NodeSet(ServiceManager manager) {
- this.manager = manager;
- }
-
- /**
- * Ctor.
- * @param manager The service manager.
- * @param _nodes The initial nodes.
- */
- public NodeSet(ServiceManager manager, SiteNode[] _nodes) {
- this(manager);
- for (int i = 0; i < _nodes.length; i++) {
- add(_nodes[i]);
- }
- }
-
- /**
- * Ctor.
- * @param documents The corresponding documents to derive nodes from.
- */
- public NodeSet(DocumentSet documents) {
- Document[] docs = documents.getDocuments();
- for (int i = 0; i < docs.length; i++) {
- SiteNode node;
- try {
- node = docs[i].getLink().getNode();
- } catch (DocumentException e) {
- throw new RuntimeException(e);
- }
- if (!contains(node)) {
- add(node);
- }
- }
- }
-
- /**
- * @param node A node.
- * @return If the node is contained.
- */
- public boolean contains(SiteNode node) {
- return getSet().contains(node);
- }
-
- private Set nodes = new HashSet();
-
- /**
- * Returns the list object that stores the documents.
- * @return A list.
- */
- protected Set getSet() {
- return this.nodes;
- }
-
- /**
- * Returns the documents contained in this set.
- *
- * @return An array of documents.
- */
- public SiteNode[] getNodes() {
- return (SiteNode[]) this.nodes.toArray(new SiteNode[this.nodes.size()]);
- }
-
- /**
- * Adds a node to this set.
- * @param node The node to add.
- */
- public void add(SiteNode node) {
- assert node != null;
- assert !this.nodes.contains(node);
- this.nodes.add(node);
- }
-
- /**
- * Checks if this set is empty.
- * @return A boolean value.
- */
- public boolean isEmpty() {
- return getSet().isEmpty();
- }
-
- /**
- * Removes a node.
- * @param resource The node.
- */
- public void remove(SiteNode resource) {
- assert resource != null;
- assert getSet().contains(resource);
- getSet().remove(resource);
- }
-
- /**
- * Removes all nodes.
- */
- public void clear() {
- getSet().clear();
- }
-
- /**
- * @return An iterator iterating in ascending order.
- */
- public NodeIterator ascending() {
- SiteNode[] nodes = getNodesAscending();
- return new NodeIterator(nodes);
- }
-
- /**
- * @return An iterator iterating in descending order.
- */
- public NodeIterator descending() {
- SiteNode[] nodes = getNodesAscending();
- List list = Arrays.asList(nodes);
- Collections.reverse(list);
- return new NodeIterator(list);
- }
-
- protected SiteNode[] getNodesAscending() {
- if (isEmpty()) {
- return new SiteNode[0];
- }
-
- SiteNode[] nodes;
- ServiceSelector selector = null;
- SiteManager siteManager = null;
- try {
- selector = (ServiceSelector) manager.lookup(SiteManager.ROLE + "Selector");
- siteManager = (SiteManager) selector.select(getNodes()[0].getStructure()
- .getPublication()
- .getSiteManagerHint());
- nodes = siteManager.sortAscending(getNodes());
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- manager.release(selector);
- }
- }
- return nodes;
- }
-
- /**
- * @return All documents referenced by this node set.
- */
- public Document[] getDocuments() {
- List documents = new ArrayList();
- for (NodeIterator i = ascending(); i.hasNext(); ) {
- SiteNode node = i.next();
- String[] langs = node.getLanguages();
- for (int l = 0; l < langs.length; l++) {
- try {
- documents.add(node.getLink(langs[l]).getDocument());
- } catch (SiteException e) {
- throw new RuntimeException(e);
- }
- }
- }
- return (Document[]) documents.toArray(new Document[documents.size()]);
- }
-
- /**
- * Adds all nodes from a node set to this.
- * @param set The set.
- */
- public void addAll(NodeSet set) {
- this.nodes.addAll(set.getSet());
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/site/SiteException.java b/trunk/src/java/org/apache/lenya/cms/site/SiteException.java
deleted file mode 100644
index a0acfc3..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/SiteException.java
+++ /dev/null
@@ -1,66 +0,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.
- */
-
-package org.apache.lenya.cms.site;
-
-import org.apache.lenya.cms.publication.PublicationException;
-
-/**
- * Site structure management exception.
- *
- * @version $Id$
- */
-public class SiteException extends PublicationException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Ctor.
- */
- public SiteException() {
- super();
- }
-
- /**
- * Ctor.
- * @param message The message.
- */
- public SiteException(String message) {
- super(message);
- }
-
- /**
- * Ctor.
- * @param cause The cause.
- */
- public SiteException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Ctor.
- * @param message The message.
- * @param cause The cause.
- */
- public SiteException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/site/SiteManager.java b/trunk/src/java/org/apache/lenya/cms/site/SiteManager.java
deleted file mode 100644
index 51b1613..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/SiteManager.java
+++ /dev/null
@@ -1,188 +0,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.
- *
- */
-
-package org.apache.lenya.cms.site;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * <p>
- * A site structure management component.
- * </p>
- *
- * <p>
- * A site manager has a dependence relation, which is always applied to documents of a single
- * language. This means a document may not require a document of another language. Dependence on a
- * set of resources must be a strict partial order <strong>< </strong>:
- * </p>
- * <ul>
- * <li><em>irreflexive:</em> d <strong>< </strong>d does not hold for any resource d</li>
- * <li><em>antisymmetric:</em> d <strong>< </strong>e and e <strong>< </strong>d implies
- * d=e</li>
- * <li><em>transitive:</em> d <strong>< </strong>e and e <strong>< </strong>f implies d
- * <strong>< </strong>f</li>
- * </ul>
- *
- * @version $Id$
- */
-public interface SiteManager {
-
- /**
- * The Avalon role.
- */
- String ROLE = SiteManager.class.getName();
-
- /**
- * Checks if a resource requires another one.
- * @param map The identity map to operate on.
- * @param dependingResource The depending resource.
- * @param requiredResource The required resource.
- * @return A boolean value.
- * @throws SiteException if an error occurs.
- */
- boolean requires(DocumentFactory map, SiteNode dependingResource, SiteNode requiredResource)
- throws SiteException;
-
- /**
- * Returns the resources which are required by a certain resource.
- *
- * @param map The identity map to operate on.
- * @param locator The depending locator.
- * @return An array of resources.
- * @throws SiteException if an error occurs.
- */
- DocumentLocator[] getRequiredResources(DocumentFactory map, DocumentLocator locator) throws SiteException;
-
- /**
- * Returns the resources which require a certain resource.
- *
- * @param map The identity map to operate on.
- * @param resource The required resource.
- * @return An array of resources.
- * @throws SiteException if an error occurs.
- */
- SiteNode[] getRequiringResources(DocumentFactory map, SiteNode resource) throws SiteException;
-
- /**
- * Adds a document to the site structure.
- * @param path The path.
- * @param document The document to add.
- * @throws SiteException if the document is already contained.
- */
- void add(String path, Document document) throws SiteException;
-
- /**
- * Sets a document to the site structure.
- * @param path The path.
- * @param document The document to add.
- * @throws SiteException if the document is already contained or if the path doesn't exist.
- */
- void set(String path, Document document) throws SiteException;
-
- /**
- * Checks if the site structure contains a certain resource in a certain area.
- *
- * @param resource The resource.
- * @return A boolean value.
- * @throws SiteException if an error occurs.
- */
- boolean contains(Document resource) throws SiteException;
-
- /**
- * Checks if the site structure contains any language version of a certain resource in a certain
- * area.
- *
- * @param resource The resource.
- * @return A boolean value.
- * @throws SiteException if an error occurs.
- */
- boolean containsInAnyLanguage(Document resource) throws SiteException;
-
- /**
- * Copies a document in the site structure.
- *
- * @param sourceDocument The source document.
- * @param destinationDocument The destination document.
- * @throws SiteException when something went wrong.
- */
- void copy(Document sourceDocument, Document destinationDocument) throws SiteException;
-
- /**
- * Sets the visibility of a node in the navigation. It is meant to hide specific nodes within
- * the "public" navigation whereas the node is visible within the info/site area.
- *
- * @param document The document.
- * @param visibleInNav The visibility.
- * @throws SiteException if an error occurs.
- */
- void setVisibleInNav(Document document, boolean visibleInNav) throws SiteException;
-
- /**
- * Returns the visibility of a node in the navigation.
- *
- * @param document The document.
- * @return A boolean value.
- * @throws SiteException if an error occurs.
- */
- boolean isVisibleInNav(Document document) throws SiteException;
-
- /**
- * Returns all documents in a certain area.
- *
- * @param identityMap The identityMap to use.
- * @param publication The publication.
- * @param area The area.
- * @return An array of documents.
- * @throws SiteException if an error occurs.
- */
- Document[] getDocuments(DocumentFactory identityMap, Publication publication, String area)
- throws SiteException;
-
- /**
- * Sorts a set of nodes using the "requires" relation.
- *
- * @param nodes The set.
- * @return A sorted array of nodes.
- * @throws SiteException if an error occurs.
- */
- SiteNode[] sortAscending(SiteNode[] nodes) throws SiteException;
-
- /**
- * @param map The identity map.
- * @param publication The publication.
- * @param area The area.
- * @return The object that holds the site structure information.
- * @throws SiteException if an error occurs.
- */
- SiteStructure getSiteStructure(DocumentFactory map, Publication publication, String area)
- throws SiteException;
-
- /**
- * Checks if the document does already exist. If it does, returns a non-existing document with a
- * similar document ID. If it does not, the original document is returned.
- * @param factory The document factory.
- * @param locator The locator.
- * @return A locator.
- * @throws SiteException if the new document could not be built.
- */
- DocumentLocator getAvailableLocator(DocumentFactory factory, DocumentLocator locator) throws SiteException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/site/SiteNode.java b/trunk/src/java/org/apache/lenya/cms/site/SiteNode.java
deleted file mode 100644
index af9936c..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/SiteNode.java
+++ /dev/null
@@ -1,111 +0,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.
- *
- */
-package org.apache.lenya.cms.site;
-
-/**
- * A node in the site structure.
- */
-public interface SiteNode {
-
- /**
- * @return The site structure this node belongs to.
- */
- SiteStructure getStructure();
-
- /**
- * @return The path.
- */
- String getPath();
-
- /**
- * @return The parent node.
- * @throws SiteException If the node has no parent.
- */
- SiteNode getParent() throws SiteException;
-
- /**
- * @return If this is a top level node. Top level nodes have no parents.
- */
- boolean isTopLevel();
-
- /**
- * @return The languages of this node.
- */
- String[] getLanguages();
-
- /**
- * @param language The language.
- * @return The link for the language.
- * @throws SiteException if no link is contained for the language.
- */
- Link getLink(String language) throws SiteException;
-
- /**
- * @return The UUID of this node.
- */
- String getUuid();
-
- /**
- * Checks if a link for a certain language is contained.
- * @param language The language.
- * @return A boolean value.
- */
- boolean hasLink(String language);
-
- /**
- * @return The name, i.e. the last path element.
- */
- String getName();
-
- /**
- * @return if the node is visible in the navigation.
- */
- boolean isVisible();
-
- /**
- * Sets the node visibility in the navigation.
- * @param visibleInNav if the node should be visible.
- */
- void setVisible(boolean visibleInNav);
-
- /**
- * Deletes this node.
- */
- void delete();
-
- /**
- * @return The children of this node.
- */
- SiteNode[] getChildren();
-
- /**
- * @return if the node has an external link.
- */
- boolean hasLink();
-
- /**
- * @return The external link.
- */
- String getHref();
-
- /**
- * @return The suffix.
- */
- String getSuffix();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/site/SiteStructure.java b/trunk/src/java/org/apache/lenya/cms/site/SiteStructure.java
deleted file mode 100644
index 0ad1702..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/SiteStructure.java
+++ /dev/null
@@ -1,131 +0,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.
- *
- */
-package org.apache.lenya.cms.site;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.RepositoryItem;
-
-/**
- * Object to hold a site structure information.
- *
- * @version $Id$
- */
-public interface SiteStructure extends RepositoryItem {
-
- /**
- * @return The repository node the site structure is stored in.
- */
- Node getRepositoryNode();
-
- /**
- * @return The publication.
- */
- Publication getPublication();
-
- /**
- * @return The area.
- */
- String getArea();
-
- /**
- * @return All nodes in this structure.
- */
- SiteNode[] getNodes();
-
- /**
- * @param path The path.
- * @return A site node.
- * @throws SiteException if no node is contained for the path.
- */
- SiteNode getNode(String path) throws SiteException;
-
- /**
- * Checks if a node is contained for a certain path.
- * @param path The path.
- * @return A boolean value.
- */
- boolean contains(String path);
-
- /**
- * Checks if a link is contained for a certain path and language.
- * @param path The path.
- * @param language The language.
- * @return A boolean value.
- */
- boolean contains(String path, String language);
-
- /**
- * Checks if the structure contains a link with a certain UUID and language.
- * @param uuid The UUID.
- * @param language The language.
- * @return A boolean value.
- */
- boolean containsByUuid(String uuid, String language);
-
- /**
- * Checks if the structure contains any language version of a document.
- * @param uuid The uuid.
- * @return A boolean value.
- */
- boolean containsInAnyLanguage(String uuid);
-
- /**
- * Returns a node for a certain UUID.
- * @param uuid The UUID.
- * @param language The language.
- * @return a link.
- * @throws SiteException if no node is contained for the UUID.
- */
- Link getByUuid(String uuid, String language) throws SiteException;
-
- /**
- * Adds a link to a document.
- * @param path The path.
- * @param doc The document.
- * @return A link.
- * @throws SiteException if the document is already contained or the node
- * for this path already contains a link for this language.
- */
- Link add(String path, Document doc) throws SiteException;
-
- /**
- * Adds a site node.
- * @param path The path.
- * @return A site node.
- * @throws SiteException if the path is already contained.
- */
- SiteNode add(String path) throws SiteException;
-
- /**
- * Adds a site node before a specific other node.
- * @param path The path.
- * @param followingSiblingPath The path of the node which will be the
- * following sibling of the node to insert.
- * @return A site node.
- * @throws SiteException if the path is already contained.
- */
- SiteNode add(String path, String followingSiblingPath) throws SiteException;
-
- /**
- * @return The top level nodes.
- */
- SiteNode[] getTopLevelNodes();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java b/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java
deleted file mode 100644
index fa9eda0..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java
+++ /dev/null
@@ -1,110 +0,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.
- *
- */
-package org.apache.lenya.cms.site;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * Utility to handle site structures.
- *
- * @version $Id$
- */
-public class SiteUtil {
-
- private SiteUtil() {
- }
-
- /**
- * Returns a sub-site starting with a certain node, which includes the node
- * itself and all nodes which require this node, in preorder.
- *
- * @param manager The service manager.
- * @param node The top-level document.
- * @return A document set.
- * @throws SiteException if an error occurs.
- */
- public static NodeSet getSubSite(ServiceManager manager, SiteNode node) throws SiteException {
- ServiceSelector selector = null;
- SiteManager siteManager = null;
- SiteNode[] subsite;
- try {
- selector = (ServiceSelector) manager.lookup(SiteManager.ROLE + "Selector");
- siteManager = (SiteManager) selector.select(node.getStructure().getPublication()
- .getSiteManagerHint());
-
- DocumentFactory map = node.getStructure().getPublication().getFactory();
- Set nodes = new HashSet();
- nodes.add(node);
-
- SiteNode[] requiringNodes = siteManager.getRequiringResources(map, node);
- for (int i = 0; i < requiringNodes.length; i++) {
- nodes.add(requiringNodes[i]);
- }
-
- subsite = (SiteNode[]) nodes.toArray(new SiteNode[nodes.size()]);
- } catch (Exception e) {
- throw new SiteException(e);
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- manager.release(selector);
- }
- }
- return new NodeSet(manager, subsite);
- }
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#getAvailableLocator(DocumentFactory,
- * DocumentLocator)
- * @param manager The service manager.
- * @param factory The factory.
- * @param locator The locator.
- * @return A document.
- * @throws SiteException if an error occurs.
- */
- public static DocumentLocator getAvailableLocator(ServiceManager manager,
- DocumentFactory factory, DocumentLocator locator) throws SiteException {
- ServiceSelector selector = null;
- SiteManager siteManager = null;
- try {
- selector = (ServiceSelector) manager.lookup(SiteManager.ROLE + "Selector");
- Publication pub = factory.getPublication(locator.getPublicationId());
- siteManager = (SiteManager) selector.select(pub.getSiteManagerHint());
- return siteManager.getAvailableLocator(factory, locator);
- } catch (Exception e) {
- throw new SiteException(e);
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- manager.release(selector);
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/cms/site/topicmap/TopicMapSiteManager.java b/trunk/src/java/org/apache/lenya/cms/site/topicmap/TopicMapSiteManager.java
deleted file mode 100644
index b2ed8da..0000000
--- a/trunk/src/java/org/apache/lenya/cms/site/topicmap/TopicMapSiteManager.java
+++ /dev/null
@@ -1,144 +0,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.
- *
- */
-package org.apache.lenya.cms.site.topicmap;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.site.AbstractSiteManager;
-import org.apache.lenya.cms.site.SiteNode;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteStructure;
-
-/**
- * Site manager to support topic maps.
- */
-public class TopicMapSiteManager extends AbstractSiteManager {
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#requires(org.apache.lenya.cms.publication.DocumentFactory,
- * org.apache.lenya.cms.site.SiteNode, org.apache.lenya.cms.site.SiteNode)
- */
- public boolean requires(DocumentFactory map, SiteNode dependingResource,
- SiteNode requiredResource) throws SiteException {
- // TODO Auto-generated method stub
- return false;
- }
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#getRequiringResources(org.apache.lenya.cms.publication.DocumentFactory,
- * org.apache.lenya.cms.site.SiteNode)
- */
- public SiteNode[] getRequiringResources(DocumentFactory map, SiteNode resource)
- throws SiteException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#add(org.apache.lenya.cms.publication.Document)
- */
- public void add(String path, Document document) throws SiteException {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#contains(org.apache.lenya.cms.publication.Document)
- */
- public boolean contains(Document resource) throws SiteException {
- // TODO Auto-generated method stub
- return false;
- }
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#containsInAnyLanguage(org.apache.lenya.cms.publication.Document)
- */
- public boolean containsInAnyLanguage(Document resource) throws SiteException {
- // TODO Auto-generated method stub
- return false;
- }
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#copy(org.apache.lenya.cms.publication.Document,
- * org.apache.lenya.cms.publication.Document)
- */
- public void copy(Document sourceDocument, Document destinationDocument) throws SiteException {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#setVisibleInNav(org.apache.lenya.cms.publication.Document,
- * boolean)
- */
- public void setVisibleInNav(Document document, boolean visibleInNav) throws SiteException {
- }
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#getDocuments(org.apache.lenya.cms.publication.DocumentFactory,
- * org.apache.lenya.cms.publication.Publication, java.lang.String)
- */
- public Document[] getDocuments(DocumentFactory map, Publication publication, String area)
- throws SiteException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#getSiteStructure(org.apache.lenya.cms.publication.DocumentFactory,
- * org.apache.lenya.cms.publication.Publication, java.lang.String)
- */
- public SiteStructure getSiteStructure(DocumentFactory map, Publication publiation, String area)
- throws SiteException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * @see org.apache.lenya.cms.site.SiteManager#getAvailableDocument(org.apache.lenya.cms.publication.Document)
- */
- public DocumentLocator getAvailableLocator(DocumentFactory factory, DocumentLocator document)
- throws SiteException {
- return document;
- }
-
- public boolean isVisibleInNav(Document document) throws SiteException {
- return true;
- }
-
- public void set(String path, Document document) throws SiteException {
- // TODO Auto-generated method stub
- }
-
- public DocumentLocator[] getRequiredResources(DocumentFactory map, DocumentLocator locator)
- throws SiteException {
- return new DocumentLocator[0];
- }
-
- public void move(SiteNode source, String destinationPath) throws SiteException {
- throw new SiteException("This operation is not supported by [" + getClass().getName()
- + "]!");
- }
-
- public void setLabel(Document document, String label) throws SiteException {
- // TODO Auto-generated method stub
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java b/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
deleted file mode 100644
index 20cf68d..0000000
--- a/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
+++ /dev/null
@@ -1,289 +0,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.
- *
- */
-package org.apache.lenya.cms.workflow;
-
-import java.text.ParsePosition;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.observation.RepositoryEvent;
-import org.apache.lenya.cms.observation.RepositoryEventFactory;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.ResourceType;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.workflow.Version;
-import org.apache.lenya.workflow.Workflow;
-import org.apache.lenya.workflow.Workflowable;
-
-/**
- * Workflowable around a CMS document.
- *
- * @version $Id: DocumentWorkflowable.java 416648 2006-06-23 09:15:28Z andreas $
- */
-class DocumentWorkflowable extends AbstractLogEnabled implements Workflowable {
-
- /**
- * Ctor.
- * @param manager The service manager.
- * @param session The repository session.
- * @param document The document.
- * @param logger The logger.
- */
- public DocumentWorkflowable(ServiceManager manager, Session session, Document document,
- Logger logger) {
- this.document = document;
- this.session = session;
- this.manager = manager;
- ContainerUtil.enableLogging(this, logger);
- }
-
- private Session session;
-
- private ServiceManager manager;
-
- /**
- * @return The service manager.
- */
- public ServiceManager getServiceManager() {
- return this.manager;
- }
-
- /**
- * @return The repository session.
- */
- public Session getSession() {
- return session;
- }
-
- private Document document;
-
- protected Document getDocument() {
- return this.document;
- }
-
- /**
- * @return The name of the workflow schema.
- */
- protected String getWorkflowSchema() {
- String workflowName = null;
- try {
- ResourceType doctype = document.getResourceType();
- if (doctype != null) {
- workflowName = document.getPublication().getWorkflowSchema(doctype);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return workflowName;
- }
-
- private Version[] versions = null;
-
- private long lastModified = 0;
-
- protected static final String METADATA_NAMESPACE = "http://apache.org/lenya/metadata/workflow/1.0";
- protected static final String METADATA_VERSION = "workflowVersion";
-
- /**
- * @see org.apache.lenya.workflow.Workflowable#getVersions()
- */
- public Version[] getVersions() {
- try {
- MetaData meta = this.document.getMetaData(METADATA_NAMESPACE);
- if (this.versions == null || meta.getLastModified() > this.lastModified) {
- String[] versionStrings = meta.getValues(METADATA_VERSION);
- this.versions = new Version[versionStrings.length];
-
- SortedMap number2version = new TreeMap();
-
- for (int i = 0; i < versionStrings.length; i++) {
- String string = versionStrings[i];
- int spaceIndex = string.indexOf(" ");
- String numberString = string.substring(0, spaceIndex);
- int number = Integer.parseInt(numberString);
- String versionString = string.substring(spaceIndex + 1);
- Version version = decodeVersion(versionString);
- number2version.put(new Integer(number), version);
- }
-
- int number = 0;
- for (Iterator i = number2version.keySet().iterator(); i.hasNext(); ) {
- Version version = (Version) number2version.get(i.next());
- this.versions[number] = version;
- number++;
- }
-
- this.lastModified = meta.getLastModified();
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return this.versions;
- }
-
- /**
- * @see org.apache.lenya.workflow.Workflowable#getLatestVersion()
- */
- public Version getLatestVersion() {
- Version version = null;
- Version[] versions = getVersions();
- if (versions.length > 0) {
- version = versions[versions.length - 1];
- }
- return version;
- }
-
- /**
- * @see org.apache.lenya.workflow.Workflowable#newVersion(org.apache.lenya.workflow.Workflow,
- * org.apache.lenya.workflow.Version)
- */
- public void newVersion(Workflow workflow, Version version) {
- Version[] newVersions = new Version[getVersions().length + 1];
- for (int i = 0; i < getVersions().length; i++) {
- newVersions[i] = getVersions()[i];
- }
-
- int number = newVersions.length - 1;
- newVersions[number] = version;
-
- String string = number + " " + encodeVersion(workflow, version);
- addToMetaData(string);
-
- WorkflowEventDescriptor descriptor = new WorkflowEventDescriptor(version);
- RepositoryEvent event = RepositoryEventFactory.createEvent(
- this.manager, getDocument(), getLogger(), descriptor);
- getDocument().getRepositoryNode().getSession().enqueueEvent(event);
- }
-
- protected void addToMetaData(String versionString) {
- try {
- String[] areas = getDocument().getPublication().getAreaNames();
- for (int i = 0; i < areas.length; i++) {
- if (getDocument().existsAreaVersion(areas[i])) {
- Document doc = getDocument().getAreaVersion(areas[i]);
- MetaData meta = doc.getMetaData(METADATA_NAMESPACE);
- meta.addValue(METADATA_VERSION, versionString);
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- protected String encodeVersion(Workflow workflow, Version version) {
-
- StringBuffer stringBuf = new StringBuffer("event:").append(version.getEvent());
- stringBuf.append(" state:").append(version.getState());
-
- Identity identity = getSession().getIdentity();
- User user = identity.getUser();
- if (user != null) {
- stringBuf.append(" user:").append(identity.getUser().getId());
- }
- stringBuf.append(" machine:").append(identity.getMachine().getIp());
-
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
- stringBuf.append(" date:").append(format.format(new Date()));
-
- String names[] = workflow.getVariableNames();
- for (int i = 0; i < names.length; i++) {
- String value = Boolean.toString(version.getValue(names[i]));
- stringBuf.append(" var:").append(names[i]);
- stringBuf.append("=").append(value);
- }
- return stringBuf.toString();
- }
-
- protected Version decodeVersion(String string) {
-
- String event = null;
- String state = null;
- String user = null;
- String machine = null;
- Date date = null;
- Map variables = new HashMap();
-
- String[] parts = string.split(" ");
- for (int i = 0; i < parts.length; i++) {
- String[] steps = parts[i].split(":", 2);
- if (steps[0].equals("event")) {
- event = steps[1];
- } else if (steps[0].equals("state")) {
- state = steps[1];
- } else if (steps[0].equals("user")) {
- user = steps[1];
- } else if (steps[0].equals("date")) {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss", Locale.US);
- date = sdf.parse(steps[1], new ParsePosition(0));
- } else if (steps[0].equals("machine")) {
- machine = steps[1];
- } else if (steps[0].equals("var")) {
- String[] nameValue = steps[1].split("=");
- variables.put(nameValue[0], nameValue[1]);
- }
- }
-
- Version version = new LenyaVersion(event, state);
- for (Iterator i = variables.keySet().iterator(); i.hasNext();) {
- String name = (String) i.next();
- String value = (String) variables.get(name);
- version.setUserId(user);
- version.setDate(date);
- version.setIPAddress(machine);
- version.setValue(name, Boolean.valueOf(value).booleanValue());
- }
- return version;
- }
-
- /**
- * @see org.apache.lenya.workflow.Workflowable#getWorkflowSchemaURI()
- */
- public String getWorkflowSchemaURI() {
- String uri = null;
- String schema = getWorkflowSchema();
- if (schema != null) {
-
- if (schema.indexOf("://") != -1) {
- return schema;
- } else {
- uri = this.document.getPublication().getSourceURI() + "/config/workflow/" + schema;
- uri = uri.substring("lenya://".length());
- uri = "context://" + uri;
- }
- }
- return uri;
- }
-
- public String toString() {
- return this.document.toString();
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/workflow/LenyaVersion.java b/trunk/src/java/org/apache/lenya/cms/workflow/LenyaVersion.java
deleted file mode 100644
index b59b9bb..0000000
--- a/trunk/src/java/org/apache/lenya/cms/workflow/LenyaVersion.java
+++ /dev/null
@@ -1,131 +0,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.
- *
- */
-
-/* $Id: VersionImpl.java 372568 2006-01-26 16:51:38Z andreas $ */
-
-package org.apache.lenya.cms.workflow;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.lenya.workflow.Version;
-
-/**
- * A version of the workflow history.
- */
-public class LenyaVersion implements Version {
-
- private Date date;
- private String event;
- private String ipAddress;
- private String state;
- private String userId;
- private Map variableValues = new HashMap();
-
- /**
- * @see org.apache.lenya.workflow.Version#getEvent()
- */
- public String getEvent() {
- return this.event;
- }
-
- /**
- * @see org.apache.lenya.workflow.Version#getState()
- */
- public String getState() {
- return this.state;
- }
-
- /**
- * Returns the date.
- * @return A string.
- */
- public Date getDate() {
- return (Date)this.date.clone();
- }
-
- /**
- * Sets the date.
- * @param _date A date.
- */
- public void setDate(Date _date) {
- this.date = (Date)_date.clone();
- }
-
- /**
- * Returns the user ID.
- * @return A string.
- */
- public String getUserId() {
- return this.userId;
- }
-
- /**
- * Sets the user ID.
- * @param _userId A user ID.
- */
- public void setUserId(String _userId) {
- this.userId = _userId;
- }
-
- /**
- * Returns the ip address.
- * @return A string.
- */
- public String getIPAddress() {
- return this.ipAddress;
- }
-
- /**
- * Sets the ip address.
- * @param _ipaddress A ip address.
- */
- public void setIPAddress(String _ipaddress){
- this.ipAddress = _ipaddress;
- }
-
- /**
- * Ctor.
- * @param _event The event that caused the version change.
- * @param _state The destination state.
- */
- public LenyaVersion(String _event, String _state) {
- this.event = _event;
- this.state = _state;
- }
-
- /**
- * @see org.apache.lenya.workflow.Version#getValue(java.lang.String)
- */
- public boolean getValue(String variableName) {
- Boolean value = (Boolean) this.variableValues.get(variableName);
- if (value == null) {
- throw new RuntimeException("No value set for variable [" + variableName + "]");
- }
- return value.booleanValue();
- }
-
- /**
- * @see org.apache.lenya.workflow.Version#setValue(java.lang.String, boolean)
- */
- public void setValue(String variableName, boolean value) {
- this.variableValues.put(variableName, Boolean.valueOf(value));
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/workflow/RoleCondition.java b/trunk/src/java/org/apache/lenya/cms/workflow/RoleCondition.java
deleted file mode 100644
index 1218bb6..0000000
--- a/trunk/src/java/org/apache/lenya/cms/workflow/RoleCondition.java
+++ /dev/null
@@ -1,140 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.workflow;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.AccessControllerResolver;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.RoleManager;
-import org.apache.lenya.workflow.Condition;
-import org.apache.lenya.workflow.Workflow;
-import org.apache.lenya.workflow.WorkflowException;
-import org.apache.lenya.workflow.Workflowable;
-
-/**
- * Role condition
- */
-public class RoleCondition implements Condition {
-
- private Set roleIds = new HashSet();
-
- protected static final String SEPARATOR = ",";
-
- /**
- * @see org.apache.lenya.workflow.Condition#setExpression(java.lang.String)
- */
- public void setExpression(String expression) throws WorkflowException {
- this.expression = expression;
-
- String[] roles = expression.split(SEPARATOR);
- for (int i = 0; i < roles.length; i++) {
- this.roleIds.add(roles[i].trim());
- }
- }
-
- /**
- * Returns if the condition is complied in a certain situation. The
- * condition is complied when the current user has the role that is required
- * by the RoleCondition.
- *
- * @see org.apache.lenya.workflow.impl.AbstractCondition#isComplied(Workflow,
- * Workflowable)
- */
- public boolean isComplied(Workflow workflow, Workflowable instance) {
-
- DocumentWorkflowable workflowable = (DocumentWorkflowable) instance;
- ServiceManager manager = workflowable.getServiceManager();
- String url = workflowable.getDocument().getCanonicalWebappURL();
-
- ServiceSelector selector = null;
- AccessControllerResolver acResolver = null;
- AccessController accessController = null;
- try {
-
- selector = (ServiceSelector) manager.lookup(AccessControllerResolver.ROLE + "Selector");
- acResolver = (AccessControllerResolver) selector
- .select(AccessControllerResolver.DEFAULT_RESOLVER);
- accessController = acResolver.resolveAccessController(url);
-
- PolicyManager policyManager = accessController.getPolicyManager();
- Identity identity = workflowable.getSession().getIdentity();
- AccreditableManager accreditableMgr = accessController
- .getAccreditableManager();
- Policy policy = policyManager.getPolicy(accreditableMgr, url);
- RoleManager roleManager = accreditableMgr.getRoleManager();
-
- boolean complied = false;
-
- for (Iterator i = this.roleIds.iterator(); i.hasNext(); ) {
- String roleId = (String) i.next();
- Role role = roleManager.getRole(roleId);
- if (policy.check(identity, role) == Policy.RESULT_GRANTED) {
- complied = true;
- }
- }
-
- return complied;
-
- } catch (final Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (selector != null) {
- if (acResolver != null) {
- if (accessController != null) {
- acResolver.release(accessController);
- }
- selector.release(acResolver);
- }
- manager.release(selector);
- }
- }
-
- }
-
- private String expression;
-
- /**
- * Returns the expression of this condition.
- *
- * @return A string.
- */
- public String getExpression() {
- return this.expression;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return getExpression();
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowEventDescriptor.java b/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowEventDescriptor.java
deleted file mode 100644
index 0b2e7b9..0000000
--- a/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowEventDescriptor.java
+++ /dev/null
@@ -1,45 +0,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.
- *
- */
-package org.apache.lenya.cms.workflow;
-
-import org.apache.lenya.util.Assert;
-import org.apache.lenya.workflow.Version;
-
-/**
- * Descriptor for workflow events.
- */
-public class WorkflowEventDescriptor {
-
- private Version version;
-
- /**
- * @param version The version.
- */
- public WorkflowEventDescriptor(Version version) {
- Assert.notNull("version", version);
- this.version = version;
- }
-
- /**
- * @return The version.
- */
- public Version getVersion() {
- return this.version;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowUtil.java b/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowUtil.java
deleted file mode 100644
index 4b71f1f..0000000
--- a/trunk/src/java/org/apache/lenya/cms/workflow/WorkflowUtil.java
+++ /dev/null
@@ -1,263 +0,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.
- *
- */
-package org.apache.lenya.cms.workflow;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.util.DocumentSet;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.workflow.Workflow;
-import org.apache.lenya.workflow.WorkflowException;
-import org.apache.lenya.workflow.WorkflowManager;
-import org.apache.lenya.workflow.Workflowable;
-
-/**
- * Utility class for workflow tasks.
- *
- * @version $Id:$
- */
-public class WorkflowUtil {
-
- /**
- * Invokes a workflow event on a document. This is the same as
- * <code>invoke(Document, String, true)</code>.
- * @param manager The service manager.
- * @param session The repository session.
- * @param logger The logger.
- * @param document The document.
- * @param event The name of the event.
- * @throws WorkflowException if the event could not be invoked in the current situation.
- */
- public static void invoke(ServiceManager manager, Session session, Logger logger,
- Document document, String event) throws WorkflowException {
- WorkflowManager wfManager = null;
- try {
- wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
- Workflowable workflowable = getWorkflowable(manager, session, logger, document);
- wfManager.invoke(workflowable, event);
- } catch (ServiceException e) {
- throw new WorkflowException(e);
- } finally {
- if (wfManager != null) {
- manager.release(wfManager);
- }
- }
-
- }
-
- /**
- * Invokes a workflow event on a document.
- * @param manager The service manager.
- * @param session The repository session.
- * @param logger The logger.
- * @param document The document.
- * @param event The name of the event.
- * @param force If this is set to <code>true</code>, the execution is forced, which means an
- * exception is thrown if the workflowable in the set does not support the event. If
- * set to <code>false</code>, non-supporting documents are ignored.
- * @throws WorkflowException if the event could not be invoked in the current situation.
- */
- public static void invoke(ServiceManager manager, Session session, Logger logger,
- Document document, String event, boolean force) throws WorkflowException {
- WorkflowManager wfManager = null;
- try {
- wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
- Workflowable workflowable = getWorkflowable(manager, session, logger, document);
- wfManager.invoke(workflowable, event, force);
- } catch (ServiceException e) {
- throw new WorkflowException(e);
- } finally {
- if (wfManager != null) {
- manager.release(wfManager);
- }
- }
-
- }
-
- /**
- * Invokes a workflow event on a document set.
- * @param manager The service manager.
- * @param session The repository session.
- * @param logger The logger.
- * @param documentSet The document.
- * @param event The event.
- * @param force If this is set to <code>true</code>, the execution is forced, which means an
- * exception is thrown if a document in the set does not support the event. If set to
- * <code>false</code>, non-supporting documents are ignored.
- * @throws WorkflowException if <code>force</code> is set to <code>true</code> and a
- * document does not support the workflow event.
- */
- public static void invoke(ServiceManager manager, Session session, Logger logger,
- DocumentSet documentSet, String event, boolean force) throws WorkflowException {
- WorkflowManager wfManager = null;
- try {
- wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
-
- Document[] documents = documentSet.getDocuments();
- for (int i = 0; i < documents.length; i++) {
- Workflowable workflowable = new DocumentWorkflowable(manager,
- session,
- documents[i],
- logger);
- wfManager.invoke(workflowable, event, force);
- }
-
- } catch (ServiceException e) {
- throw new WorkflowException(e);
- } finally {
- if (wfManager != null) {
- manager.release(wfManager);
- }
- }
-
- }
-
- /**
- * Checks if an event can be invoked on a document.
- * @param manager The service manager.
- * @param session The repository session.
- * @param logger The logger.
- * @param document The document.
- * @param event The event.
- * @return A boolean value.
- * @throws WorkflowException
- */
- public static boolean canInvoke(ServiceManager manager, Session session, Logger logger,
- Document document, String event) throws WorkflowException {
- WorkflowManager wfManager = null;
- try {
- wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
- Workflowable workflowable = new DocumentWorkflowable(manager, session, document, logger);
- return wfManager.canInvoke(workflowable, event);
- } catch (ServiceException e) {
- throw new WorkflowException(e);
- } finally {
- if (wfManager != null) {
- manager.release(wfManager);
- }
- }
-
- }
-
- /**
- * Checks if an event can be invoked on all documents in a set.
- * @param manager The service manager.
- * @param session The repository session.
- * @param logger The logger.
- * @param documents The documents.
- * @param event The event.
- * @return if an error occurs.
- * @throws WorkflowException
- */
- public static boolean canInvoke(ServiceManager manager, Session session, Logger logger,
- DocumentSet documents, String event) throws WorkflowException {
- WorkflowManager wfManager = null;
- try {
- wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
-
- boolean canInvoke = true;
- Document[] documentArray = documents.getDocuments();
- for (int i = 0; i < documentArray.length; i++) {
- Workflowable workflowable = new DocumentWorkflowable(manager,
- session,
- documentArray[i],
- logger);
- canInvoke = canInvoke && wfManager.canInvoke(workflowable, event);
- }
- return canInvoke;
-
- } catch (ServiceException e) {
- throw new WorkflowException(e);
- } finally {
- if (wfManager != null) {
- manager.release(wfManager);
- }
- }
- }
-
- /**
- * Returns if a document has a workflow.
- * @param manager The service manager.
- * @param session The repository session.
- * @param logger The logger.
- * @param document The document.
- * @return A boolean value.
- * @throws WorkflowException if an error occurs.
- */
- public static boolean hasWorkflow(ServiceManager manager, Session session, Logger logger,
- Document document) throws WorkflowException {
- WorkflowManager wfManager = null;
- try {
- wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
- Workflowable workflowable = new DocumentWorkflowable(manager, session, document, logger);
- return wfManager.hasWorkflow(workflowable);
- } catch (ServiceException e) {
- throw new WorkflowException(e);
- } finally {
- if (wfManager != null) {
- manager.release(wfManager);
- }
- }
- }
-
- /**
- * Returns the workflow schema of a document.
- * @param manager The service manager.
- * @param session The repository session.
- * @param logger The logger.
- * @param document The document.
- * @return A workflow schema.
- * @throws WorkflowException if an error occurs.
- */
- public static Workflow getWorkflowSchema(ServiceManager manager, Session session,
- Logger logger, Document document) throws WorkflowException {
- WorkflowManager wfManager = null;
- try {
- wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
- Workflowable workflowable = getWorkflowable(manager, session, logger, document);
- if (wfManager.hasWorkflow(workflowable)) {
- return wfManager.getWorkflowSchema(workflowable);
- } else {
- throw new WorkflowException("The document [" + document + "] has no workflow!");
- }
- } catch (ServiceException e) {
- throw new WorkflowException(e);
- } finally {
- if (wfManager != null) {
- manager.release(wfManager);
- }
- }
- }
-
- /**
- * Returns a workflowable for a document.
- * @param manager The service manager.
- * @param session The session.
- * @param logger The logger.
- * @param document The document.
- * @return A workflowable.
- */
- public static Workflowable getWorkflowable(ServiceManager manager, Session session,
- Logger logger, Document document) {
- Workflowable workflowable = new DocumentWorkflowable(manager, session, document, logger);
- return workflowable;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/net/InetAddressUtil.java b/trunk/src/java/org/apache/lenya/net/InetAddressUtil.java
deleted file mode 100644
index 84d5226..0000000
--- a/trunk/src/java/org/apache/lenya/net/InetAddressUtil.java
+++ /dev/null
@@ -1,195 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.net;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-
-/**
- * A utility class for InetAddress. Also see http://jodies.de/ipcalc
- */
-public class InetAddressUtil extends AbstractLogEnabled {
-
- /**
- * Ctor.
- * @param logger The logger.
- */
- public InetAddressUtil(Logger logger) {
- enableLogging(logger);
- }
-
- /**
- * Checks if a subnet contains a specific IP address.
- * @param network The network address.
- * @param netmask The subnet mask.
- * @param ip The IP address to check.
- * @return A boolean value.
- */
- public boolean contains(InetAddress network, InetAddress netmask, InetAddress ip) {
- if(getLogger().isDebugEnabled()) {
- getLogger().debug("=======================================");
- getLogger().debug("Checking IP address: " + ip + " in " + network + " / " + netmask);
- }
-
- byte[] networkBytes = network.getAddress();
- byte[] netmaskBytes = netmask.getAddress();
- byte[] ipBytes = ip.getAddress();
-
- /* check IPv4/v6-compatibility or parameters: */
- if(networkBytes.length != netmaskBytes.length
- || netmaskBytes.length != ipBytes.length)
- {
- /*
- * FIXME: If network and netmask have the same size
- * should already be checked whenever
- * org.apache.lenya.ac.(impl.Abstract)IPRange
- * is set. In that case the user should be notified
- * of this configuration-error instead of silently
- * accepting the buggy IPRange as one not matching
- * any host!
- * (Note that changes to the public API of IPRange
- * and other classes would be necessary to fix this
- * problem. This method and therefore this whole
- * class would probably be obsolete in that case.)
- */
- if(getLogger().isDebugEnabled()) {
- getLogger().debug
- ("Network address " + network + ", subnet mask "
- + netmask + " and/or host address " + ip
- + " have different sizes! (return false ...)");
- getLogger().debug("=======================================");
- }
- return false;
- }
-
- /* Check if the masked network and ip addresses match: */
- for(int i=0; i<netmaskBytes.length; i++) {
- int mask = netmaskBytes[i] & 0xff;
- if((networkBytes[i] & mask) != (ipBytes[i] & mask)) {
- if(getLogger().isDebugEnabled()) {
- getLogger().debug
- (ip + " is not in " + network + " / " + netmask);
- getLogger().debug("=======================================");
- }
- return false;
- }
- }
- if(getLogger().isDebugEnabled()) {
- getLogger().debug
- (ip + " is in " + network + " / " + netmask);
- getLogger().debug("=======================================");
- }
- return true;
- }
-
- /**
- * Returns the n-th part of an InetAddress.
- * @param ip The address.
- * @param partNumber The number of the part.
- * @return An integer value.
- * @deprecated This was an internal implementation detail of the
- * method {@link #contains} and should never have been
- * made public. (And it's inefficient and unnecessary
- * too, as well as broken for IPv6. ;-)
- * Use <code>ip.getAddress()[partNumber]</code>
- * instead.
- */
- public static int getClassPart(InetAddress ip, int partNumber) {
- String[] parts = ip.getHostAddress().split("\\.");
- String part = parts[partNumber];
- return new Integer(part).intValue();
- }
-
- /**
- * Check netmask, e.g. 255.255.255.240 is fine, 255.255.240.16 is illegal (needs to be 255.255.240.0)
- * @param netmask The netmask address.
- * @return An integer value. -1 if illegal netmask, otherwise 0, 1, 2, 3
- * @deprecated This was an internal implementation detail of the
- * method {@link #contains} and should never have been
- * made public. Furthermore it's broken for IPv6.
- * (However, there is no real replacement. If you
- * need this functionality, you should rewrite it
- * yourself.)
- */
- public int checkNetmask(InetAddress netmask) {
- String[] parts = netmask.getHostAddress().split("\\.");
- Integer[] numbers = new Integer[4];
- for (int i = 0; i < 4; i++) {
- numbers[i] = new Integer(parts[i]);
- }
-
- for (int i = 0; i < 4; i++) {
- getLogger().debug(".checkNetmask(): Check part: " + numbers[i]);
- if (0 <= numbers[i].intValue() && numbers[i].intValue() <= 255) {
- if (numbers[i].intValue() != 255) {
- for (int k = i + 1; k < 4; k++) {
- if (numbers[k].intValue() != 0) {
- getLogger().error(".checkNetmask(): Illegal Netmask: " + netmask);
- return -1;
- }
- }
- return i;
- }
- continue;
- }
- // FIXME: This check not really be necessary because java.net.UnknownHostException should be thrown long time before
- getLogger().error(".checkNetmask(): Illegal Netmask: " + netmask);
- return -1;
- }
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("All parts equal 255: " + netmask);
- }
- return 3;
- }
-
- /**
- * Converts a string to an IP addres.
- * @param string The IP address, represented by a string.
- * @return An InetAddress object.
- * @throws UnknownHostException
- * @deprecated This was an internal implementation detail of the
- * method {@link #contains} and should never have been
- * made public. (And it's unnecessary
- * too, as well as broken for IPv6. ;-)
- * Use <code>InetAddress.getByName(string)</code>
- * instead.
- */
- public static InetAddress getAddress(String string) throws UnknownHostException {
- String[] strings = string.split("\\.");
-
- InetAddress address;
- byte[] numbers = new byte[strings.length];
- for (int i = 0; i < strings.length; i++) {
- int number = Integer.parseInt(strings[i]);
- if (number > 127) {
- number = number - 256;
- }
- numbers[i] = (byte) number;
- }
-
- address = InetAddress.getByAddress(numbers);
- return address;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/search/Grep.java b/trunk/src/java/org/apache/lenya/search/Grep.java
deleted file mode 100644
index 4510e01..0000000
--- a/trunk/src/java/org/apache/lenya/search/Grep.java
+++ /dev/null
@@ -1,187 +0,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.
- *
- */
-
-/* $Id: Grep.java 152682 2005-02-08 18:13:39Z gregor $ */
-
-package org.apache.lenya.search;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.nio.CharBuffer;
-import java.nio.MappedByteBuffer;
-import java.nio.channels.FileChannel;
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.avalon.framework.logger.ConsoleLogger;
-import org.apache.avalon.framework.logger.Logger;
-
-/**
- * Utility class to provide a subset of the grep functionality.
- */
-public class Grep {
-
- private static Charset charset = Charset.forName("UTF-8");
- private static CharsetDecoder decoder = charset.newDecoder();
-
- /**
- * Check if the given file contains the pattern
- * @param file the file which is to be searched for the pattern
- * @param pattern the pattern that is being searched.
- * @return true if the file contains the string, false otherwise.
- * @throws IOException
- */
- public static boolean containsPattern(File file, Pattern pattern) throws IOException {
-
- Logger log = new ConsoleLogger();
-
- FileChannel fc = null;
- // Open the file and then get a channel from the stream
- FileInputStream fis = null;
- boolean result = false;
-
- try {
- fis = new FileInputStream(file);
- fc = fis.getChannel();
-
- // Get the file's size and then map it into memory
- int sz = (int)fc.size();
- MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
-
- // Decode the file into a char buffer
- CharBuffer cb = decoder.decode(bb);
-
- // Perform the search
- Matcher pm = pattern.matcher(cb); // Pattern matcher
-
- result = pm.find();
- } catch (FileNotFoundException e) {
- log.error("File not found: " +e.toString());
- } catch (CharacterCodingException e) {
- log.error("Problem with encoding: " +e.toString());
- } catch (IOException e) {
- log.error("IO Exception: " +e.toString());
- } finally {
- // Close the channel and the stream
- if (fc != null)
- fc.close();
- if (fis != null)
- fis.close();
- }
- return result;
- }
-
- /**
- * Find all occurences of pattern in a file.
- * @param file the file to search for occurences of pattern
- * @param pattern the pattern to search for
- * @param group which group in the pattern to return
- * @return an <code>array</code> of occurences of pattern
- * (i.e. the groupth group of the match)
- * @throws IOException if the file could not be read.
- */
- public static String[] findPattern(File file, Pattern pattern, int group) throws IOException {
-
- Logger log = new ConsoleLogger();
-
- ArrayList occurences = new ArrayList();
- FileInputStream fis = null;
- FileChannel fc = null;
-
- try {
- // Open the file and then get a channel from the stream
- fis = new FileInputStream(file);
- fc = fis.getChannel();
-
- // Get the file's size and then map it into memory
- int sz = (int)fc.size();
- MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
-
- // Decode the file into a char buffer
- CharBuffer cb = decoder.decode(bb);
-
- // Perform the search
- Matcher pm = pattern.matcher(cb); // Pattern matcher
-
- while (pm.find()) {
- occurences.add(pm.group(group));
- }
- } catch (FileNotFoundException e) {
- log.error("file not found " +e.toString());
- } catch (CharacterCodingException e) {
- log.error("encoding problem " +e.toString());
- } catch (IOException e) {
- log.error("IO exception" +e.toString());
- } finally {
- // Close the channel and the stream
- if (fc != null)
- fc.close();
- if (fis != null)
- fis.close();
- }
- return (String[])occurences.toArray(new String[occurences.size()]);
-
- }
-
- /**
- * Find all files below the given file which contain the given pattern.
- * @param file the file where to start the search for the pattern.
- * @param pattern the pattern to search for.
- * @return an array of files which contain the pattern
- * @throws IOException if any of the files could not be opened.
- */
- private static List find_internal(File file, Pattern pattern) throws IOException {
- ArrayList fileList = new ArrayList();
-
- if (file.isDirectory()) {
- String[] children = file.list();
- for (int i = 0; i < children.length; i++) {
- fileList.addAll(
- find_internal(
- new File(file.getAbsolutePath(), children[i]),
- pattern));
- }
- } else if (file.isFile() && containsPattern(file, pattern)) {
- fileList.add(file);
- }
- return fileList;
- }
-
- /**
- * Find all files below the given file which contain the given search string.
- *
- * @param file the where to start the search
- * @param searchString the string to search for.
- *
- * @return an array of files which contain the search string.
- *
- * @throws IOException if any of the files could not be opened.
- */
- public static File[] find(File file, String searchString) throws IOException {
- Pattern pattern = Pattern.compile(searchString);
- List fileList = find_internal(file, pattern);
- return (File[])fileList.toArray(new File[fileList.size()]);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/ConcurrentModificationException.java b/trunk/src/java/org/apache/lenya/transaction/ConcurrentModificationException.java
deleted file mode 100644
index feb82a7..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/ConcurrentModificationException.java
+++ /dev/null
@@ -1,47 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-import org.apache.lenya.util.Assert;
-
-/**
- * Exception which is thrown when a different identity changed a transactionable
- * object in an optimistic offline lock scenario.
- */
-public class ConcurrentModificationException extends TransactionException {
-
- private Transactionable transactionable;
-
- public ConcurrentModificationException(Transactionable t) {
- super();
- Assert.notNull("transactionable", t);
- this.transactionable = t;
- }
-
- public String getMessage() {
- return "The object [" + this.transactionable + "] was modified after it has been locked.";
- }
-
- /**
- * @return The transactionable that was modified by a different identity.
- */
- public Transactionable getTransactionable() {
- return this.transactionable;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/IdentifiableFactory.java b/trunk/src/java/org/apache/lenya/transaction/IdentifiableFactory.java
deleted file mode 100644
index 2a4b6b8..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/IdentifiableFactory.java
+++ /dev/null
@@ -1,41 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-/**
- * Factory for identifiables.
- *
- * @version $Id$
- */
-public interface IdentifiableFactory {
-
- /**
- * Builds an identifiable.
- * @param map The identity map.
- * @param key The key.
- * @return An identifiable object.
- * @throws Exception if an error occurs.
- */
- Object build(IdentityMap map, String key) throws Exception;
-
- /**
- * @return The type of the identifables to produce.
- */
- String getType();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/IdentityMap.java b/trunk/src/java/org/apache/lenya/transaction/IdentityMap.java
deleted file mode 100644
index 4e354d3..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/IdentityMap.java
+++ /dev/null
@@ -1,53 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-/**
- * Identity map.
- *
- * @version $Id$
- */
-public interface IdentityMap {
-
- /**
- * Retrieve an instance from the map. If no instance exists
- * for the given key, the factory is used to build one.
- * @param factory The factory that produces the identifable.
- * @param key The key for the identifiable.
- * @return An identifiable.
- */
- Object get(IdentifiableFactory factory, String key);
-
- /**
- * Returns the unit of work. This maybe <code>null</code> if the identity map is not involved
- * in a transaction.
- * @return The unit of work.
- */
- UnitOfWork getUnitOfWork();
-
- /**
- * @param unit The unit of work to use.
- */
- void setUnitOfWork(UnitOfWork unit);
-
- /**
- * @return All objects in this map.
- */
- Object[] getObjects();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/IdentityMapImpl.java b/trunk/src/java/org/apache/lenya/transaction/IdentityMapImpl.java
deleted file mode 100644
index 5f0549f..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/IdentityMapImpl.java
+++ /dev/null
@@ -1,101 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-
-/**
- * Identity map implementation.
- *
- * @version $Id$
- */
-public final class IdentityMapImpl extends AbstractLogEnabled implements IdentityMap {
-
- private Map maps = new HashMap();
-
- /**
- * Ctor.
- * @param logger The logger.
- */
- public IdentityMapImpl(Logger logger) {
- ContainerUtil.enableLogging(this, logger);
- }
-
- public Object get(IdentifiableFactory factory, String key) {
- String type = factory.getType();
- Map map = (Map) this.maps.get(type);
- if (map == null) {
- map = new HashMap();
- this.maps.put(type, map);
- }
- Object object = map.get(key);
-
- if (getLogger().isDebugEnabled())
- getLogger().debug("IdentityMapImpl::get() looked up type [" + type + "], key [" + key
- + "] in map, is it there ? " + (object != null));
-
- if (object == null) {
- try {
- object = factory.build(this, key);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- map.put(key, object);
- }
- return object;
- }
-
- private UnitOfWork unitOfWork;
-
- /**
- * @see org.apache.lenya.transaction.IdentityMap#getUnitOfWork()
- */
- public UnitOfWork getUnitOfWork() {
- return this.unitOfWork;
- }
-
- /**
- * @see org.apache.lenya.transaction.IdentityMap#setUnitOfWork(org.apache.lenya.transaction.UnitOfWork)
- */
- public void setUnitOfWork(UnitOfWork unit) {
- this.unitOfWork = unit;
- }
-
- /**
- * @see org.apache.lenya.transaction.IdentityMap#getObjects()
- */
- public Object[] getObjects() {
- Set objects = new HashSet();
- for (Iterator i = this.maps.values().iterator(); i.hasNext();) {
- Map map = (Map) i.next();
- for (Iterator j = map.values().iterator(); j.hasNext();) {
- objects.add(j.next());
- }
- }
- return (Object[]) objects.toArray(new Object[objects.size()]);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/Lock.java b/trunk/src/java/org/apache/lenya/transaction/Lock.java
deleted file mode 100644
index 1be4397..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/Lock.java
+++ /dev/null
@@ -1,44 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-/**
- * A lock on a transactionable.
- *
- * @version $Id$
- */
-public class Lock {
-
- /**
- * Ctor.
- * @param version The version of the transactionable when it was locked.
- */
- protected Lock(int version) {
- this.version = version;
- }
-
- private int version;
-
- /**
- * @return The version number.
- */
- public int getVersion() {
- return this.version;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/LockException.java b/trunk/src/java/org/apache/lenya/transaction/LockException.java
deleted file mode 100644
index 2a46cad..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/LockException.java
+++ /dev/null
@@ -1,59 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-/**
- * Lock exception.
- *
- * @version $Id$
- */
-public class LockException extends TransactionException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- /**
- * Ctor.
- */
- public LockException() {
- super();
- }
- /**
- * Ctor.
- * @param message The message.
- */
- public LockException(String message) {
- super(message);
- }
- /**
- * Ctor.
- * @param message The message.
- * @param cause The cause.
- */
- public LockException(String message, Throwable cause) {
- super(message, cause);
- }
- /**
- * Ctor.
- * @param cause The cause.
- */
- public LockException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/Lockable.java b/trunk/src/java/org/apache/lenya/transaction/Lockable.java
deleted file mode 100644
index 130885c..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/Lockable.java
+++ /dev/null
@@ -1,50 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-/**
- * Object that can be locked.
- *
- * @version $Id$
- */
-public interface Lockable {
-
- /**
- * Locks this object.
- * @throws TransactionException if an error occurs.
- */
- void lock() throws TransactionException;
-
- /**
- * Unlocks this object.
- * @throws TransactionException if an error occurs.
- */
- void unlock() throws TransactionException;
-
- /**
- * @return if this object is locked.
- * @throws TransactionException if an error occurs.
- */
- boolean isLocked() throws TransactionException;
-
- /**
- * @return The lock which is held by this object.
- */
- Lock getLock();
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/transaction/TransactionException.java b/trunk/src/java/org/apache/lenya/transaction/TransactionException.java
deleted file mode 100644
index 238f846..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/TransactionException.java
+++ /dev/null
@@ -1,59 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-/**
- * Transaction exception.
- *
- * @version $Id$
- */
-public class TransactionException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- /**
- * Ctor.
- */
- public TransactionException() {
- super();
- }
- /**
- * Ctor.
- * @param message The message.
- */
- public TransactionException(String message) {
- super(message);
- }
- /**
- * Ctor.
- * @param message The message.
- * @param cause The cause.
- */
- public TransactionException(String message, Throwable cause) {
- super(message, cause);
- }
- /**
- * Ctor.
- * @param cause The cause.
- */
- public TransactionException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/TransactionLock.java b/trunk/src/java/org/apache/lenya/transaction/TransactionLock.java
deleted file mode 100644
index 14c273b..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/TransactionLock.java
+++ /dev/null
@@ -1,30 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-/**
- * Global transaction lock.
- */
-public class TransactionLock {
-
- /**
- * The global transaction lock.
- */
- public static final Object LOCK = TransactionLock.class;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/Transactionable.java b/trunk/src/java/org/apache/lenya/transaction/Transactionable.java
deleted file mode 100644
index 4cbecb2..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/Transactionable.java
+++ /dev/null
@@ -1,45 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-/**
- * Object to take part in a transaction.
- *
- * @version $Id$
- */
-public interface Transactionable extends Versionable {
-
- /**
- * Saves the object.
- * @throws TransactionException if an error occurs.
- */
- void saveTransactionable() throws TransactionException;
-
- /**
- * Deletes the object.
- * @throws TransactionException if an error occurs.
- */
- void deleteTransactionable() throws TransactionException;
-
- /**
- * Creates the object.
- * @throws TransactionException if an error occurs.
- */
- void createTransactionable() throws TransactionException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/UnitOfWork.java b/trunk/src/java/org/apache/lenya/transaction/UnitOfWork.java
deleted file mode 100644
index 2f5d13c..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/UnitOfWork.java
+++ /dev/null
@@ -1,89 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-/**
- * This is a "Unit of Work" object (see "Unit of Work" pattern by Martin Fowler,
- * <a href="http://www.martinfowler.com/eaaCatalog/unitOfWork.html">
- * http://www.martinfowler.com/eaaCatalog/unitOfWork.html
- * </a>: the unit of work "maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems".
- *
- * <p>In the current design, this interface allows a use case to generate documents, while ensuring that only one instance of a document is created. This access is provided by the DocumentIdentityMap's DocumentFactory.</p>
- *
- * <p>This interface may be extended in the future to allow for access to further types of business objects.</p>
- *
- * @version $Id$
- */
-public interface UnitOfWork {
-
- /**
- * Registers an object as new.
- * @param object The object.
- * @throws TransactionException if an error occurs.
- */
- void registerNew(Transactionable object) throws TransactionException;
-
- /**
- * Registers an object as modified.
- * @param object The object.
- * @throws TransactionException if an error occurs.
- */
- void registerDirty(Transactionable object) throws TransactionException;
-
- /**
- * Registers an object as removed.
- * @param object The object.
- * @throws TransactionException if an error occurs.
- */
- void registerRemoved(Transactionable object) throws TransactionException;
-
- /**
- * Commits the transaction.
- * @throws TransactionException if an error occurs.
- */
- void commit() throws TransactionException;
-
- /**
- * Rolls the transaction back.
- * @throws TransactionException if an error occurs.
- */
- void rollback() throws TransactionException;
-
- /**
- * @param transactionable A transactionable.
- * @return If the transactionable is registered as dirty.
- */
- boolean isDirty(Transactionable transactionable);
-
- /**
- * Creates a lock.
- * @param lockable The lockable.
- * @param version The version.
- * @return A lock.
- * @throws TransactionException if a lock is already placed on this transactionable.
- */
- Lock createLock(Lockable lockable, int version) throws TransactionException;
-
- /**
- * Removes a lock.
- * @param lockable The lockable.
- * @throws TransactionException if no lock is placed on this transactionable.
- */
- void removeLock(Lockable lockable) throws TransactionException;
-
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java b/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java
deleted file mode 100644
index cecef7c..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java
+++ /dev/null
@@ -1,225 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.util.Assert;
-
-/**
- * Default implementation of a unit of work.
- *
- * @version $Id$
- */
-public class UnitOfWorkImpl extends AbstractLogEnabled implements UnitOfWork {
-
- /**
- * Ctor.
- * @param map The identity map to use.
- * @param identity The identity.
- * @param logger The logger.
- */
- public UnitOfWorkImpl(IdentityMap map, Identity identity, Logger logger) {
- ContainerUtil.enableLogging(this, logger);
-
- Assert.notNull(map);
- this.identityMap = map;
- this.identityMap.setUnitOfWork(this);
-
- this.identity = identity;
- }
-
- private IdentityMap identityMap;
-
- /**
- * @return The identity map.
- */
- public IdentityMap getIdentityMap() {
- return this.identityMap;
- }
-
- private Set newObjects = new HashSet();
- private Set modifiedObjects = new HashSet();
- private Set removedObjects = new HashSet();
-
- /**
- * @see org.apache.lenya.transaction.UnitOfWork#registerNew(org.apache.lenya.transaction.Transactionable)
- */
- public void registerNew(Transactionable object) throws TransactionException {
- this.newObjects.add(object);
- }
-
- /**
- * @throws TransactionException
- * @throws LockException
- * @see org.apache.lenya.transaction.UnitOfWork#registerDirty(org.apache.lenya.transaction.Transactionable)
- */
- public void registerDirty(Transactionable object) throws TransactionException {
- this.modifiedObjects.add(object);
- }
-
- /**
- * @see org.apache.lenya.transaction.UnitOfWork#registerRemoved(org.apache.lenya.transaction.Transactionable)
- */
- public void registerRemoved(Transactionable object) throws TransactionException {
- this.removedObjects.add(object);
- }
-
- /**
- * Commit the transaction. We lock this method for the whole class to avoid synchronization
- * problems.
- * @see org.apache.lenya.transaction.UnitOfWork#commit()
- */
- public void commit() throws TransactionException {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("UnitOfWorkImpl::commit() called");
- }
-
- Set lockedObjects = this.locks.keySet();
-
- for (Iterator i = lockedObjects.iterator(); i.hasNext();) {
- Transactionable t = (Transactionable) i.next();
- if (t.hasChanged()) {
- throw new ConcurrentModificationException(t);
- }
- }
-
- Set involvedObjects = new HashSet();
- involvedObjects.addAll(this.newObjects);
- involvedObjects.addAll(this.modifiedObjects);
- involvedObjects.addAll(this.removedObjects);
-
- try {
- for (Iterator i = involvedObjects.iterator(); i.hasNext();) {
- Transactionable t = (Transactionable) i.next();
- t.checkout();
- }
-
- for (Iterator i = this.newObjects.iterator(); i.hasNext();) {
- Transactionable t = (Transactionable) i.next();
- t.createTransactionable();
- t.saveTransactionable();
- }
- for (Iterator i = this.modifiedObjects.iterator(); i.hasNext();) {
- Transactionable t = (Transactionable) i.next();
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("UnitOfWorkImpl::commit() calling save on [" + t + "]");
- }
- t.saveTransactionable();
- }
- for (Iterator i = this.removedObjects.iterator(); i.hasNext();) {
- Transactionable t = (Transactionable) i.next();
- t.deleteTransactionable();
- }
-
- } finally {
- if (getIdentityMap() != null) {
- Object[] objects = getIdentityMap().getObjects();
- for (int i = 0; i < objects.length; i++) {
- if (objects[i] instanceof Transactionable) {
- Transactionable t = (Transactionable) objects[i];
- if (t.isCheckedOutBySession() && !this.removedObjects.contains(t)) {
- t.checkin();
- }
- if (t.isLocked()) {
- t.unlock();
- }
- }
- }
- }
- }
-
- resetTransaction();
-
- }
-
- protected void resetTransaction() {
- this.modifiedObjects.clear();
- this.newObjects.clear();
- this.removedObjects.clear();
- }
-
- private Identity identity;
-
- protected Identity getIdentity() {
- return this.identity;
- }
-
- /**
- * @see org.apache.lenya.transaction.UnitOfWork#isDirty(org.apache.lenya.transaction.Transactionable)
- */
- public boolean isDirty(Transactionable transactionable) {
- return this.modifiedObjects.contains(transactionable)
- || this.newObjects.contains(transactionable)
- || this.removedObjects.contains(transactionable);
- }
-
- /**
- * Rollback the transaction. We lock this method for the whole class to avoid synchronization
- * problems.
- * @see org.apache.lenya.transaction.UnitOfWork#rollback()
- */
- public synchronized void rollback() throws TransactionException {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("UnitOfWorkImpl::rollback() called");
- }
- if (getIdentityMap() != null) {
- Object[] objects = getIdentityMap().getObjects();
- for (int i = 0; i < objects.length; i++) {
- if (objects[i] instanceof Transactionable) {
- Transactionable t = (Transactionable) objects[i];
- if (t.isCheckedOutBySession()) {
- t.checkin();
- }
- if (t.isLocked()) {
- t.unlock();
- }
- }
- }
- resetTransaction();
- }
- }
-
- private Map locks = new HashMap();
-
- public Lock createLock(Lockable lockable, int version) throws TransactionException {
- if (this.locks.containsKey(lockable)) {
- throw new LockException("A lock is already placed on [" + lockable
- + "]. A new lock could lead to inconsistent data.");
- }
- Lock lock = new Lock(version);
- this.locks.put(lockable, lock);
- return lock;
- }
-
- public void removeLock(Lockable lockable) throws TransactionException {
- if (!this.locks.containsKey(lockable)) {
- throw new LockException("No lock is already placed on [" + lockable + "]!");
- }
- this.locks.remove(lockable);
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/transaction/Versionable.java b/trunk/src/java/org/apache/lenya/transaction/Versionable.java
deleted file mode 100644
index e8990b4..0000000
--- a/trunk/src/java/org/apache/lenya/transaction/Versionable.java
+++ /dev/null
@@ -1,58 +0,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.
- *
- */
-package org.apache.lenya.transaction;
-
-/**
- * A versionable object.
- *
- * @version $Id$
- */
-public interface Versionable extends Lockable {
-
- /**
- * Checks the object in.
- * @throws TransactionException if an error occurs.
- */
- void checkin() throws TransactionException;
-
- /**
- * Checks the object out.
- * @throws TransactionException if an error occurs.
- */
- void checkout() throws TransactionException;
-
- /**
- * @return if the object is checked out.
- * @throws TransactionException if an error occurs.
- */
- boolean isCheckedOut() throws TransactionException;
-
- /**
- * @return if the object is checked out by its session.
- * @throws TransactionException if an error occurs.
- */
- boolean isCheckedOutBySession() throws TransactionException;
-
- /**
- * Checks if the object has been changed since it has been locked.
- * @return A boolean value.
- * @throws TransactionException if an error occurs.
- */
- boolean hasChanged() throws TransactionException;
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/util/Assert.java b/trunk/src/java/org/apache/lenya/util/Assert.java
deleted file mode 100644
index b007d9a..0000000
--- a/trunk/src/java/org/apache/lenya/util/Assert.java
+++ /dev/null
@@ -1,55 +0,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.
- *
- */
-package org.apache.lenya.util;
-
-/**
- * Assertion utility.
- */
-public final class Assert {
-
- /**
- * @param parameterName The parameter name to use in the exception.
- * @param object The object.
- * @throws RuntimeException if the object is null.
- */
- public static final void notNull(String parameterName, Object object) {
- if (object == null) {
- throw new RuntimeException("The parameter [" + parameterName + "] must not be null!");
- }
- }
-
- /**
- * @param parameterName The parameter name to use in the exception.
- * @param object The object.
- * @throws RuntimeException if the object is null.
- */
- public static final void notNull(Object object) {
- notNull("undefined", object);
- }
-
- /**
- * @param expression The expression to check.
- * @param value The value.
- * @throws RuntimeException if the value is not true.
- */
- public static final void isTrue(String expression, boolean value) {
- if (!value) {
- throw new RuntimeException("The expression [" + expression + "] is not true!");
- }
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/util/CacheMap.java b/trunk/src/java/org/apache/lenya/util/CacheMap.java
deleted file mode 100644
index ef58063..0000000
--- a/trunk/src/java/org/apache/lenya/util/CacheMap.java
+++ /dev/null
@@ -1,96 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.util;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.apache.avalon.framework.logger.LogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-
-/**
- * A map with a maximum capacity. When the map is full, the oldest entry is removed.
- */
-public class CacheMap extends HashMap implements LogEnabled {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Ctor.
- * @param _capacity The maximum number of entries.
- * @param logger The logger.
- */
- public CacheMap(int _capacity, Logger logger) {
- enableLogging(logger);
- assert _capacity > -1;
- this.capacity = _capacity;
- }
-
- private int capacity;
- private SortedMap timeToKey = new TreeMap();
- private Logger logger;
-
- /**
- * @see java.util.Map#put(Object, Object)
- */
- public Object put(Object key, Object value) {
-
- if (size() == this.capacity) {
- Object oldestKey = this.timeToKey.get(this.timeToKey.firstKey());
- remove(oldestKey);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Clearing cache");
- }
- }
- this.timeToKey.put(new Date(), key);
- return super.put(key, value);
- }
-
- /**
- * @see java.util.Map#get(java.lang.Object)
- */
- public Object get(Object key) {
- Object result = super.get(key);
- if (getLogger().isDebugEnabled()) {
- if (result != null) {
- getLogger().debug("Using cached object for key [" + key + "]");
- }
- else {
- getLogger().debug("No cached object for key [" + key + "]");
- }
- }
- return result;
- }
-
- protected Logger getLogger() {
- return this.logger;
- }
-
- public void enableLogging(Logger logger) {
- this.logger = logger;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/util/HTML.java b/trunk/src/java/org/apache/lenya/util/HTML.java
deleted file mode 100644
index 8d93376..0000000
--- a/trunk/src/java/org/apache/lenya/util/HTML.java
+++ /dev/null
@@ -1,143 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.util;
-
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.swing.text.html.parser.ParserDelegator;
-
-
-/**
- * http://developer.java.sun/developer/TechTips/1999/tt0923.html
- */
-public class HTML {
- HTMLHandler htmlHandler;
-
- /**
- * Creates a new HTML object from a URI
- * @param uri The URI
- * @throws IOException if a IO error occurs
- */
- public HTML(String uri) throws IOException {
- ParserDelegator pd = new ParserDelegator();
- this.htmlHandler = new HTMLHandler();
- pd.parse(getReader(uri), this.htmlHandler, true);
- }
-
- /**
- * Command line interface
- * @param args Command line args
- */
- public static void main(String[] args) {
- if (args.length != 1) {
- System.err.println("Usage: HTML uri (file or url)");
-
- return;
- }
-
- try {
- HTML html = new HTML(args[0]);
-
- List img_src_list = html.getImageSrcs(false);
- System.out.println("<im src");
-
- Iterator img_src_iterator = img_src_list.iterator();
-
- while (img_src_iterator.hasNext()) {
- System.out.println((String) img_src_iterator.next());
- }
-
- List a_href_list = html.getAnchorHRefs(false);
- System.out.println("<a href");
-
- Iterator a_href_iterator = a_href_list.iterator();
-
- while (a_href_iterator.hasNext()) {
- System.out.println((String) a_href_iterator.next());
- }
-
- List link_href_list = html.getLinkHRefs(false);
- System.out.println("<link href");
-
- Iterator link_href_iterator = link_href_list.iterator();
-
- while (link_href_iterator.hasNext()) {
- System.out.println((String) link_href_iterator.next());
- }
- } catch (final IOException e) {
- System.err.println("IO error : " + e);
- }
- }
-
- /**
- * Get Anchor Hrefs
- * @param duplicate Whether you want duplicate HREFS
- * @return A list of Hrefs
- */
- public List getAnchorHRefs(boolean duplicate) {
- if (duplicate) {
- return this.htmlHandler.getAllAHRefs();
- }
- return this.htmlHandler.getAHRefs();
- }
-
- /**
- * Get Link hrefs
- * @param duplicate Whether you want duplicate Hrefs
- * @return A list of Hrefs
- */
- public List getLinkHRefs(boolean duplicate) {
- if (duplicate) {
- return this.htmlHandler.getAllLinkHRefs();
- }
- return this.htmlHandler.getLinkHRefs();
- }
-
- /**
- * Get Image src attributes
- * @param duplicate Whether you want duplicates
- * @return A list of src Attributes
- */
- public List getImageSrcs(boolean duplicate) {
- if (duplicate) {
- return this.htmlHandler.getAllImageSrcs();
- }
- return this.htmlHandler.getImageSrcs();
- }
-
- private Reader getReader(String uri) throws IOException {
- if (uri.startsWith("http:")) {
- // uri is url
- URLConnection connection = new URL(uri).openConnection();
-
- return new InputStreamReader(connection.getInputStream());
- }
- // uri is file
- return new FileReader(uri);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/util/HTMLHandler.java b/trunk/src/java/org/apache/lenya/util/HTMLHandler.java
deleted file mode 100644
index 4ae4ff4..0000000
--- a/trunk/src/java/org/apache/lenya/util/HTMLHandler.java
+++ /dev/null
@@ -1,153 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.util;
-
-import java.util.ArrayList;
-
-import javax.swing.text.MutableAttributeSet;
-import javax.swing.text.html.HTML;
-import javax.swing.text.html.HTML.Tag;
-import javax.swing.text.html.HTMLEditorKit.ParserCallback;
-
-
-/**
- * HTML handler class
- */
-public class HTMLHandler extends ParserCallback {
- private ArrayList img_src;
- private ArrayList img_src_all;
- private ArrayList a_href;
- private ArrayList a_href_all;
- private ArrayList link_href;
- private ArrayList link_href_all;
-
- /**
- * Creates a new HTMLHandler object.
- */
- public HTMLHandler() {
- this.img_src_all = new ArrayList();
- this.img_src = new ArrayList();
- this.a_href_all = new ArrayList();
- this.a_href = new ArrayList();
- this.link_href_all = new ArrayList();
- this.link_href = new ArrayList();
- }
-
- /**
- * Handle the start tag
- * @param tag The tag
- * @param attributes The set of attributes
- * @param pos The position
- */
- public void handleStartTag(Tag tag, MutableAttributeSet attributes, int pos) {
- if (tag.equals(HTML.Tag.A)) {
- String href = (String) attributes.getAttribute(HTML.Attribute.HREF);
-
- if (href != null) {
- this.a_href_all.add(href);
-
- if (!this.a_href.contains(href)) {
- this.a_href.add(href);
- }
- }
- }
- }
-
- /**
- * Handle a simple tag
- * @param tag The tag
- * @param attributes The set of attributes
- * @param pos The position
- */
- public void handleSimpleTag(Tag tag, MutableAttributeSet attributes, int pos) {
- if (tag.equals(HTML.Tag.IMG)) {
- String src = (String) attributes.getAttribute(HTML.Attribute.SRC);
-
- if (src != null) {
- this.img_src_all.add(src);
-
- if (!this.img_src.contains(src)) {
- this.img_src.add(src);
- }
- }
- }
-
- if (tag.equals(HTML.Tag.LINK)) {
- String href = (String) attributes.getAttribute(HTML.Attribute.HREF);
-
- if (href != null) {
- this.link_href_all.add(href);
-
- if (!this.link_href.contains(href)) {
- this.link_href.add(href);
- }
- }
- }
- }
-
- /**
- * Get the list of src attributes for images
- * @return The list of src attributes
- */
- public ArrayList getImageSrcs() {
- return this.img_src;
- }
-
- /**
- * Get the list of src attributes for all images
- * @return The list of src attributes
- */
- public ArrayList getAllImageSrcs() {
- return this.img_src_all;
- }
-
- /**
- * Get a list of links
- * @return The list of links
- */
- public ArrayList getLinkHRefs() {
- return this.link_href;
- }
-
- /**
- * Get a list of all links
- * @return The list of links
- */
- public ArrayList getAllLinkHRefs() {
- return this.link_href_all;
- }
-
- /**
- * Get a list of a href=
- * @return The list of a href
- */
- public ArrayList getAHRefs() {
- return this.a_href;
- }
-
- /**
- * Get a list of all a href=
- * @return The list of a href
- */
- public ArrayList getAllAHRefs() {
- return this.a_href_all;
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/util/NamespaceMap.java b/trunk/src/java/org/apache/lenya/util/NamespaceMap.java
deleted file mode 100644
index c50eb08..0000000
--- a/trunk/src/java/org/apache/lenya/util/NamespaceMap.java
+++ /dev/null
@@ -1,159 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.util;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * An object of this class provides an easy way to access
- * Strings in a Map that are prefixed like "prefix.foo".
- * The actual map wrapped by this object can contain more
- * key-value-pairs, but you can access only the prefixed keys
- * through the mapper.
- */
-public class NamespaceMap {
- /**
- * <code>SEPARATOR</code> The seperator character
- */
- public static final String SEPARATOR = ".";
- private Map map;
- private String prefix;
-
- /**
- * Creates a new NamespaceMap object.
- * @param _prefix The prefix.
- */
- public NamespaceMap(String _prefix) {
- this(new HashMap(), _prefix);
- }
-
- /**
- * Creates a new NamespaceMap.
- * @param _map A map containing the prefixed key-value-pairs.
- * @param _prefix The prefix.
- */
- public NamespaceMap(Map _map, String _prefix) {
- this.map = _map;
- this.prefix = _prefix;
- }
-
- /**
- * Returns the prefix.
- * @return A string.
- */
- public String getPrefix() {
- return this.prefix;
- }
-
- /**
- * Returns the namespace prefix.
- * @return The namespace prefix.
- */
- protected Map getMapObject() {
- return this.map;
- }
-
- /**
- * Returns a map that contains only the un-prefixed key-value-pairs.
- * @return The map.
- */
- public Map getMap() {
- Map resultMap = new HashMap();
-
- Set keys = getMapObject().keySet();
-
- for (Iterator i = keys.iterator(); i.hasNext();) {
- Object key = i.next();
-
- if (key instanceof String) {
- String keyString = (String) key;
-
- if (keyString.startsWith(getPrefix() + SEPARATOR)) {
- resultMap.put(getShortName(getPrefix(), keyString), getMapObject().get(key));
- }
- }
- }
-
- return resultMap;
- }
-
- /**
- * Puts a value for prefixed key into the map.
- * @param key The key without prefix.
- * @param value The value.
- */
- public void put(String key, Object value) {
- getMapObject().put(getFullName(getPrefix(), key), value);
- }
-
- /**
- * Returns the value for a prefixed key.
- * @param key The key without prefix.
- * @return The value.
- */
- public Object get(String key) {
- return getMap().get(key);
- }
-
- /**
- * Returns the full (prefixed) key for a short (un-prefixed) key.
- * @param prefix The prefix.
- * @param key The un-prefixed key.
- * @return A string (prefix + {@link #SEPARATOR} + key).
- */
- public static String getFullName(String prefix, String key) {
- return prefix + SEPARATOR + key;
- }
-
- /**
- * Returns the short (un-prefixed) key for a full (prefixed) key.
- * @param prefix The prefix.
- * @param key The full (prefixed) key.
- * @return A string.
- */
- public static String getShortName(String prefix, String key) {
- return key.substring(prefix.length() + SEPARATOR.length());
- }
-
- /**
- * Puts all prefixed key-value-pairs of map into this map.
- * @param _map A map.
- */
- public void putAll(Map _map) {
- for (Iterator i = _map.keySet().iterator(); i.hasNext(); ) {
- String key = (String) i.next();
- put(key, _map.get(key));
- }
- }
-
- /**
- * Returns a map with prefixed keys.
- * @return A map.
- */
- public Map getPrefixedMap() {
- return new HashMap(getMapObject());
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/util/Query.java b/trunk/src/java/org/apache/lenya/util/Query.java
deleted file mode 100644
index 590283d..0000000
--- a/trunk/src/java/org/apache/lenya/util/Query.java
+++ /dev/null
@@ -1,116 +0,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.
- *
- */
-package org.apache.lenya.util;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-/**
- * <p>
- * Utility class to analyze a query string of the form
- * <code>key1=value1&key2=value2&...</code>.
- * Access is not thread-safe.
- * </p>
- * <p>
- * Invalid parts (not a valid key-value-pair) are omitted.
- * </p>
- */
-public class Query {
-
- protected static final String PAIR_DELIMITER = "&";
- protected static final String KEY_VALUE_DELIMITER = "=";
- private String pairDelimiter;
- private String keyValueDelimiter;
-
- /**
- * Creates a query object with default values for the pair and key-value
- * delimiters.
- *
- * @param string The query string.
- */
- public Query(String string) {
- this(string, PAIR_DELIMITER, KEY_VALUE_DELIMITER);
- }
-
- /**
- * Creates a query object.
- * @param string The string.
- * @param pairDelimiter The delimiter between key-value pairs.
- * @param keyValueDelimiter The delimiter between key and value.
- */
- public Query(String string, String pairDelimiter, String keyValueDelimiter) {
- this.key2value = new HashMap();
- this.pairDelimiter = pairDelimiter;
- this.keyValueDelimiter = keyValueDelimiter;
- StringTokenizer tokenizer = new StringTokenizer(string, pairDelimiter);
- while (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken();
- StringTokenizer keyValueTokenizer = new StringTokenizer(token, keyValueDelimiter);
- if (keyValueTokenizer.countTokens() == 2) {
- final String key = keyValueTokenizer.nextToken();
- final String value = keyValueTokenizer.nextToken();
- this.key2value.put(key, value);
- }
- }
- }
-
- private Map key2value;
-
- public String getValue(String key) {
- return (String) this.key2value.get(key);
- }
-
- public String getValue(String key, String defaultValue) {
- String value = getValue(key);
- if (value == null) {
- return defaultValue;
- } else {
- return value;
- }
- }
-
- public String getKeyValueDelimiter() {
- return keyValueDelimiter;
- }
-
- public String getPairDelimiter() {
- return pairDelimiter;
- }
-
- public void removeValue(String key) {
- this.key2value.remove(key);
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer();
- for (Iterator i = this.key2value.keySet().iterator(); i.hasNext(); ) {
- String key = (String) i.next();
- String value = (String) this.key2value.get(key);
- buf.append(key);
- buf.append(this.keyValueDelimiter);
- buf.append(value);
- if (i.hasNext()) {
- buf.append(this.pairDelimiter);
- }
- }
- return buf.toString();
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/util/ServletHelper.java b/trunk/src/java/org/apache/lenya/util/ServletHelper.java
deleted file mode 100644
index 9f654ef..0000000
--- a/trunk/src/java/org/apache/lenya/util/ServletHelper.java
+++ /dev/null
@@ -1,134 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.util;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.environment.Request;
-import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.lenya.cms.cocoon.source.SourceUtil;
-import org.apache.xpath.XPathAPI;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
-/**
- * Servlet utility class.
- */
-public final class ServletHelper {
-
- /**
- * Ctor.
- */
- private ServletHelper() {
- // do nothing
- }
-
- /**
- * Returns the URL inside the web application (without the context prefix).
- * @param request The request.
- * @return A string.
- */
- public static String getWebappURI(Request request) {
- String context = request.getContextPath();
- String requestUri = request.getRequestURI();
- return getWebappURI(context, requestUri);
- }
-
- /**
- * Returns the URL inside the web application (without the context prefix).
- * @param context The context prefix.
- * @param requestUri The complete request URI.
- * @return A string.
- */
- public static String getWebappURI(String context, String requestUri) {
- if (context == null) {
- context = "";
- }
- String url = requestUri.substring(context.length());
- if (url.length() > 0 && !url.startsWith("/")) {
- url = "/" + url;
- }
-
- return url;
- }
-
- /**
- * Converts the request parameters to a map. If a key is mapped to multiple parameters, a string
- * array is used as the value.
- * @param request The request.
- * @return A map.
- */
- public static Map getParameterMap(Request request) {
- Map requestParameters = new HashMap();
- for (Enumeration e = request.getParameterNames(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
- String[] values = request.getParameterValues(key);
- Object value;
- if (values.length == 1) {
- value = values[0];
- } else {
- value = values;
- }
- requestParameters.put(key, value);
- }
- return requestParameters;
- }
-
- private static Boolean uploadEnabled = null;
-
- /**
- * Returns the value of enable-uploads in web.xml
- * @param manager The Service Manager.
- * @return true if enable upload is true or not set in web.xml, else false
- */
- public static synchronized boolean isUploadEnabled(ServiceManager manager)
- throws SourceNotFoundException, ServiceException, ParserConfigurationException,
- SAXException, IOException, TransformerException {
-
- if (ServletHelper.uploadEnabled == null) {
-
- Node node;
- String webappUrl = "context://WEB-INF/web.xml";
- Document document = SourceUtil.readDOM(webappUrl, manager);
- Element root = document.getDocumentElement();
- node = XPathAPI.selectSingleNode(root,
- "/web-app/servlet/init-param[param-name='enable-uploads']/param-value/text()");
-
- if (node == null) {
- ServletHelper.uploadEnabled = Boolean.FALSE;
- } else {
- boolean enabled = node.getNodeValue().equals("true");
- ServletHelper.uploadEnabled = Boolean.valueOf(enabled);
- }
- }
- return ServletHelper.uploadEnabled.booleanValue();
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/util/SessionListener.java b/trunk/src/java/org/apache/lenya/util/SessionListener.java
deleted file mode 100644
index adce8c1..0000000
--- a/trunk/src/java/org/apache/lenya/util/SessionListener.java
+++ /dev/null
@@ -1,53 +0,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.
- *
- */
-
-package org.apache.lenya.util;
-
-/**
- * A Listener which store the session object in a HashMap on creation and
- * remove it if the session is destroyed.
- *
- * @version $Id$
- */
-
-import javax.servlet.http.*;
-import java.util.WeakHashMap;
-
-public class SessionListener implements HttpSessionListener {
-
- private static WeakHashMap allSessions = new WeakHashMap();
-
- public void sessionCreated(HttpSessionEvent se) {
-
- HttpSession session = se.getSession();
- String sessionID = session.getId();
- allSessions.put(sessionID,session);
- }
-
- public void sessionDestroyed(HttpSessionEvent se) {
- HttpSession session = se.getSession();
- String sessionID = session.getId();
- if (allSessions.containsKey(sessionID)) {
- allSessions.remove(sessionID);
- }
- }
-
- public WeakHashMap getAllSessions() {
- return allSessions;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/util/Stack.java b/trunk/src/java/org/apache/lenya/util/Stack.java
deleted file mode 100644
index 8b8f886..0000000
--- a/trunk/src/java/org/apache/lenya/util/Stack.java
+++ /dev/null
@@ -1,57 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.util;
-
-import java.util.Vector;
-
-
-/**
- * A helper class to implement a stack. Unlike java.util.Stack, this stack
- * discards old elements once maxsize is reached.
- * @see java.util.Stack
- */
-public class Stack extends Vector {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- int maxsize = 0;
-
- /**
- * Creates a new Stack object.
- * @param _maxsize The maximum size of the stack
- */
- public Stack(int _maxsize) {
- this.maxsize = _maxsize;
- }
-
- /**
- * Push an object on the stack
- * @param object The object
- */
- public void push(Object object) {
- insertElementAt(object, 0);
-
- if (size() == (this.maxsize + 1)) {
- removeElementAt(this.maxsize);
- }
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/util/StringUtil.java b/trunk/src/java/org/apache/lenya/util/StringUtil.java
deleted file mode 100644
index a16c28a..0000000
--- a/trunk/src/java/org/apache/lenya/util/StringUtil.java
+++ /dev/null
@@ -1,42 +0,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.
- *
- */
-package org.apache.lenya.util;
-
-/**
- * String utility.
- */
-public final class StringUtil {
-
- /**
- * Joins an array of objects into a string.
- * @param objects The objects.
- * @param delimiter The delimiter to use.
- * @return A string.
- */
- public static final String join(Object[] objects, String delimiter) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < objects.length; i++) {
- if (i > 0) {
- buffer.append(delimiter);
- }
- buffer.append(objects[i].toString());
- }
- return buffer.toString();
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/workflow/Action.java b/trunk/src/java/org/apache/lenya/workflow/Action.java
deleted file mode 100644
index febbacb..0000000
--- a/trunk/src/java/org/apache/lenya/workflow/Action.java
+++ /dev/null
@@ -1,35 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.workflow;
-
-
-/**
- * Workflow action.
- */
-public interface Action {
-
- /**
- * Executes this action for a given workflow instance.
- * @param resultingVersion The resulting version.
- * @throws WorkflowException if the execution failed
- */
- void execute(Version resultingVersion) throws WorkflowException;
-}
diff --git a/trunk/src/java/org/apache/lenya/workflow/BooleanVariable.java b/trunk/src/java/org/apache/lenya/workflow/BooleanVariable.java
deleted file mode 100644
index d1d4651..0000000
--- a/trunk/src/java/org/apache/lenya/workflow/BooleanVariable.java
+++ /dev/null
@@ -1,47 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.workflow;
-
-
-/**
- * <p>Boolean state variable.</p>
- * <p>
- * A workflow schema can contain a set of state variables.
- * For each instance, the state variables hold certain values.
- * Values can be assigned during transitions, so a variable can
- * change its value when a transition fires. Currently,
- * the workflow supports only boolean state variables.
- * </p>
- */
-public interface BooleanVariable {
-
- /**
- * Returns the name of this variable.
- * @return the name
- */
- String getName();
-
- /**
- * Returns the initial value of this variable.
- * @return A boolean value.
- */
- boolean getInitialValue();
-}
diff --git a/trunk/src/java/org/apache/lenya/workflow/BooleanVariableAssignment.java b/trunk/src/java/org/apache/lenya/workflow/BooleanVariableAssignment.java
deleted file mode 100644
index 8b2021f..0000000
--- a/trunk/src/java/org/apache/lenya/workflow/BooleanVariableAssignment.java
+++ /dev/null
@@ -1,29 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.workflow;
-
-
-/**
- * Boolean variable assignment.
- */
-public interface BooleanVariableAssignment extends Action {
- // do nothing
-}
diff --git a/trunk/src/java/org/apache/lenya/workflow/Condition.java b/trunk/src/java/org/apache/lenya/workflow/Condition.java
deleted file mode 100644
index ee758a3..0000000
--- a/trunk/src/java/org/apache/lenya/workflow/Condition.java
+++ /dev/null
@@ -1,48 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.workflow;
-
-/**
- * <p>A condition can prevent a transition from firing,
- * based on the current situation. Examples:</p>
- * <ul>
- * <li>Does the current user have a certain role on the current URL?</li>
- * <li>Does a certain state variable have a certain value (e.g., is the document published)? (BooleanVariableCondition)<li>
- * <li>Is the sun shining? (e.g., if the weather report may only be published on sunny days)</li>
- * </ul>
- */
-public interface Condition {
-
- /**
- * Returns if the condition is complied in a certain situation.
- * @param workflow The workflow to use.
- * @param workflowable The workflowable to check the condition on.
- * @return if the condition is complied.
- * @throws WorkflowException when the expression could not be evaluated.
- */
- boolean isComplied(Workflow workflow, Workflowable workflowable) throws WorkflowException;
-
- /** Sets the expression for this condition.
- * @param expression The expression.
- * @throws WorkflowException when the expression is not valid.
- */
- void setExpression(String expression) throws WorkflowException;
-}
diff --git a/trunk/src/java/org/apache/lenya/workflow/Transition.java b/trunk/src/java/org/apache/lenya/workflow/Transition.java
deleted file mode 100644
index c026ee1..0000000
--- a/trunk/src/java/org/apache/lenya/workflow/Transition.java
+++ /dev/null
@@ -1,76 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.workflow;
-
-
-/**
- * <p>
- * A transition describes the switching of a workflow instance
- * from one state to another. A transition has
- * </p>
- *
- * <ul>
- * <li>a source state,</li>
- * <li>a destination state,</li>
- * <li>an event,</li>
- * <li>a set of conditions,</li>
- * <li>a set of assignments.</li>
- * </ul>
- *
- * <p>
- * Additionally, a transition can be marked as synchronized.
- * </p>
- */
-public interface Transition {
-
- /**
- * Returns the event of this transition.
- * @return the event
- */
- String getEvent();
-
- /**
- * @return The source state.
- */
- String getSource();
-
- /**
- * @return The destination state.
- */
- String getDestination();
-
- /**
- * Returns the actions of this transition.
- * @return the actions
- */
- Action[] getActions();
-
- /**
- * @return The conditions.
- */
- Condition[] getConditions();
-
- /**
- * Returns if this transition is synchronized.
- * @return A boolean value.
- */
- boolean isSynchronized();
-}
diff --git a/trunk/src/java/org/apache/lenya/workflow/Version.java b/trunk/src/java/org/apache/lenya/workflow/Version.java
deleted file mode 100644
index 86bfcf8..0000000
--- a/trunk/src/java/org/apache/lenya/workflow/Version.java
+++ /dev/null
@@ -1,92 +0,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.
- *
- */
-package org.apache.lenya.workflow;
-
-import java.util.Date;
-
-/**
- * A version of the workflow history.
- *
- * @version $Id$
- */
-public interface Version {
-
- /**
- * Returns the event.
- * @return An event.
- */
- String getEvent();
-
- /**
- * Returns the state.
- * @return A state.
- */
- String getState();
-
-
- /**
- * Returns the date.
- * @return A string.
- */
- Date getDate();
-
- /**
- * Sets the date.
- * @param _date A date.
- */
- void setDate(Date _date);
-
- /**
- * Returns the user ID.
- * @return A string.
- */
- public String getUserId();
-
- /**
- * Sets the user ID.
- * @param _userId A user ID.
- */
- public void setUserId(String _userId);
-
- /**
- * Returns the ip address.
- * @return A string.
- */
- public String getIPAddress();
-
- /**
- * Sets the ip address.
- * @param _ipaddress A ip address.
- */
- public void setIPAddress(String _ipaddress);
-
- /**
- * Returns the value of a variable.
- * @param variableName The variable name.
- * @return A boolean value.
- */
- boolean getValue(String variableName);
-
- /**
- * Sets a variable value.
- * @param variableName The variable name.
- * @param value The value.
- */
- void setValue(String variableName, boolean value);
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/workflow/Workflow.java b/trunk/src/java/org/apache/lenya/workflow/Workflow.java
deleted file mode 100644
index 2ea9c01..0000000
--- a/trunk/src/java/org/apache/lenya/workflow/Workflow.java
+++ /dev/null
@@ -1,86 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.workflow;
-
-/**
- * <p>A workflow schema.</p>
- * <p>
- * A workflow schema defines a state machine (deterministic finite
- * automaton - DFA), consisting of
- * </p>
- * <ul>
- * <li>states, including a marked initial state,</li>
- * <li>transitions, and</li>
- * <li>state variables.</li>
- */
-public interface Workflow {
- /**
- * <code>NAMESPACE</code> Workflow namespace URI
- */
- String NAMESPACE = "http://apache.org/cocoon/lenya/workflow/1.0";
- /**
- * <code>DEFAULT_PREFIX</code> Default workflow namespace prefix
- */
- String DEFAULT_PREFIX = "wf";
-
- /**
- * Returns the initial state of this workflow.
- * @return The initial state
- */
- String getInitialState();
-
- /**
- * Returns the transitions that leave a state.
- * This method is used, e.g., to disable menu items.
- * @param state A state.
- * @return The transitions that leave the state.
- * @throws WorkflowException if the state is not contained.
- */
- Transition[] getLeavingTransitions(String state) throws WorkflowException;
-
- /**
- * Returns the variable names.
- * @return A string array.
- */
- String[] getVariableNames();
-
- /**
- * @return The name of this workflow.
- */
- String getName();
-
- /**
- * @param variableName The variable name.
- * @return The initial value of the variable.
- * @throws WorkflowException if the variable does not exist.
- */
- boolean getInitialValue(String variableName) throws WorkflowException;
-
- /**
- * @return The events.
- */
- String[] getEvents();
-
- /**
- * @return The states.
- */
- String[] getStates();
-}
diff --git a/trunk/src/java/org/apache/lenya/workflow/WorkflowEngine.java b/trunk/src/java/org/apache/lenya/workflow/WorkflowEngine.java
deleted file mode 100644
index 7d14807..0000000
--- a/trunk/src/java/org/apache/lenya/workflow/WorkflowEngine.java
+++ /dev/null
@@ -1,48 +0,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.
- *
- */
-package org.apache.lenya.workflow;
-
-/**
- * Workflow engine.
- *
- * @version $Id$
- */
-public interface WorkflowEngine {
-
- /**
- * Checks if an event can be invoked.
- * @param workflowable The workflowable.
- * @param workflow The workflow schema.
- * @param event The event.
- * @return A boolean value.
- * @throws WorkflowException if an error occurs.
- */
- boolean canInvoke(Workflowable workflowable, Workflow workflow, String event)
- throws WorkflowException;
-
- /**
- * Invokes an event.
- * @param workflowable The workflowable.
- * @param workflow The workflow.
- * @param event The event.
- * @throws WorkflowException if an error occurs.
- */
- void invoke(Workflowable workflowable, Workflow workflow, String event)
- throws WorkflowException;
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/workflow/WorkflowException.java b/trunk/src/java/org/apache/lenya/workflow/WorkflowException.java
deleted file mode 100644
index a3c8aea..0000000
--- a/trunk/src/java/org/apache/lenya/workflow/WorkflowException.java
+++ /dev/null
@@ -1,64 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.workflow;
-
-
-/**
- * Workflow exception.
- */
-public class WorkflowException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor
- */
- public WorkflowException() {
- super();
- }
-
- /**
- * Create a WorkflowException.
- * @param message The message.
- */
- public WorkflowException(String message) {
- super(message);
- }
-
- /**
- * Create a WorkflowException.
- * @param message The message.
- * @param cause The cause.
- */
- public WorkflowException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Create a WorkflowException.
- * @param cause The cause.
- */
- public WorkflowException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/workflow/WorkflowManager.java b/trunk/src/java/org/apache/lenya/workflow/WorkflowManager.java
deleted file mode 100644
index 13c32b6..0000000
--- a/trunk/src/java/org/apache/lenya/workflow/WorkflowManager.java
+++ /dev/null
@@ -1,80 +0,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.
- *
- */
-package org.apache.lenya.workflow;
-
-/**
- * Manager for workflow issues. This is the main entry point for
- * workflow-related tasks. You can safely invoke all methods for non-workflow
- * documents.
- *
- * @version $Id: WorkflowManager.java 179751 2005-06-03 09:13:35Z andreas $
- */
-public interface WorkflowManager {
-
- /**
- * The Avalon role.
- */
- String ROLE = WorkflowManager.class.getName();
-
- /**
- * Invokes a workflow event on a document. This is the same as
- * <code>invoke(Document, String, true)</code>.
- * @param workflowable The workflowable.
- * @param event The name of the event.
- * @throws WorkflowException if the event could not be invoked in the
- * current situation.
- */
- void invoke(Workflowable workflowable, String event) throws WorkflowException;
-
- /**
- * Invokes a workflow event on a document.
- * @param workflowable The document.
- * @param event The name of the event.
- * @param force If this is set to <code>true</code>, the execution is
- * forced, which means an exception is thrown if the workflowable in
- * the set does not support the event. If set to
- * <code>false</code>, non-supporting documents are ignored.
- * @throws WorkflowException if the event could not be invoked in the
- * current situation.
- */
- void invoke(Workflowable workflowable, String event, boolean force) throws WorkflowException;
-
- /**
- * Checks if an event can be invoked on a document.
- * @param workflowable The workflowable.
- * @param event The event.
- * @return A boolean value.
- */
- boolean canInvoke(Workflowable workflowable, String event);
-
- /**
- * Checks if a workflowable has a workflow.
- * @param workflowable The workflowable.
- * @return A boolean value.
- */
- boolean hasWorkflow(Workflowable workflowable);
-
- /**
- * Resolves the workflow schema of a workflowable.
- * @param workflowable The workflowable.
- * @return A workflow schema.
- * @throws WorkflowException if the document has no workflow.
- */
- Workflow getWorkflowSchema(Workflowable workflowable) throws WorkflowException;
-
-}
\ No newline at end of file
diff --git a/trunk/src/java/org/apache/lenya/workflow/Workflowable.java b/trunk/src/java/org/apache/lenya/workflow/Workflowable.java
deleted file mode 100644
index f735fad..0000000
--- a/trunk/src/java/org/apache/lenya/workflow/Workflowable.java
+++ /dev/null
@@ -1,49 +0,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.
- *
- */
-package org.apache.lenya.workflow;
-
-/**
- * Interface for objects which can be workflowed.
- *
- * @version $Id$
- */
-public interface Workflowable {
-
- /**
- * @return The versions in chronological order.
- */
- Version[] getVersions();
-
- /**
- * @return The latest version.
- */
- Version getLatestVersion();
-
- /**
- * Adds a new version.
- * @param workflow The workflow.
- * @param version The version.
- */
- void newVersion(Workflow workflow, Version version);
-
- /**
- * @return The URI to resolve the schema configuration from.
- */
- String getWorkflowSchemaURI();
-
-}
diff --git a/trunk/src/java/org/apache/lenya/xml/DocumentHelper.java b/trunk/src/java/org/apache/lenya/xml/DocumentHelper.java
deleted file mode 100644
index 9727d58..0000000
--- a/trunk/src/java/org/apache/lenya/xml/DocumentHelper.java
+++ /dev/null
@@ -1,483 +0,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.
- *
- */
-
-package org.apache.lenya.xml;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.xml.resolver.tools.CatalogResolver;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.xml.sax.SAXException;
-
-/**
- * Various utility methods to work with JAXP.
- * @version $Id$
- */
-public class DocumentHelper {
- /**
- * Creates a non-validating and namespace-aware DocumentBuilder.
- * @return A new DocumentBuilder object.
- * @throws ParserConfigurationException if an error occurs
- */
- public static DocumentBuilder createBuilder() throws ParserConfigurationException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- DocumentBuilder builder = factory.newDocumentBuilder();
-
- CatalogResolver cr = new CatalogResolver();
- builder.setEntityResolver(cr);
- return builder;
- }
-
- /**
- * Creates a document. A xmlns:prefix="namespaceUri" attribute is added to
- * the document element.
- * @param namespaceUri The namespace URL of the root element.
- * @param qualifiedName The qualified name of the root element.
- * @param documentType The type of document to be created or null. When
- * doctype is not null, its Node.ownerDocument attribute is set
- * to the document being created.
- * @return A new Document object.
- * @throws DOMException if an error occurs
- * @throws ParserConfigurationException if an error occurs
- * @see org.w3c.dom.DOMImplementation#createDocument(String, String,
- * DocumentType)
- */
- public static Document createDocument(String namespaceUri, String qualifiedName,
- DocumentType documentType) throws DOMException, ParserConfigurationException {
- DocumentBuilder builder = createBuilder();
- Document document = builder.getDOMImplementation().createDocument(namespaceUri,
- qualifiedName,
- documentType);
-
- // add xmlns:prefix attribute
- String name = "xmlns";
- int index = qualifiedName.indexOf(":");
-
- if (index > -1) {
- name += (":" + qualifiedName.substring(0, index));
- }
-
- document.getDocumentElement().setAttributeNS("http://www.w3.org/2000/xmlns/",
- name,
- namespaceUri);
-
- return document;
- }
-
- /**
- * Reads a document from a file.
- * @return A document.
- * @param file The file to load the document from.
- * @throws ParserConfigurationException if an error occurs
- * @throws SAXException if an error occurs
- * @throws IOException if an error occurs
- */
- public static Document readDocument(File file) throws ParserConfigurationException,
- SAXException, IOException {
- DocumentBuilder builder = createBuilder();
- return builder.parse(file);
- }
-
- /**
- * Reads a document from a URL.
- * @return A document.
- * @param url The URL to load the document from.
- * @throws ParserConfigurationException if an error occurs
- * @throws SAXException if an error occurs
- * @throws IOException if an error occurs
- */
- public static Document readDocument(URL url) throws ParserConfigurationException, SAXException,
- IOException {
- DocumentBuilder builder = createBuilder();
- return builder.parse(url.toString());
- }
-
- /**
- * Reads a document from a URI.
- * @return A document.
- * @param uri The URI to load the document from.
- * @throws ParserConfigurationException if an error occurs
- * @throws SAXException if an error occurs
- * @throws IOException if an error occurs
- */
- public static Document readDocument(URI uri) throws ParserConfigurationException, SAXException,
- IOException {
- DocumentBuilder builder = createBuilder();
- return builder.parse(uri.toString());
- }
-
- /**
- * Reads a document from a string.
- * @return A document.
- * @param string The string to load the document from.
- * @param encoding The encoding which is used by the string.
- * @throws ParserConfigurationException if an error occurs
- * @throws SAXException if an error occurs
- * @throws IOException if an error occurs
- */
- public static Document readDocument(String string, String encoding) throws ParserConfigurationException,
- SAXException, IOException {
- DocumentBuilder builder = createBuilder();
- byte bytes[] = string.getBytes(encoding);
- ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
- return builder.parse(stream);
- }
-
- /**
- * Reads a document from an input stream.
- * @return A document.
- * @param stream The input stream to load the document from.
- * @throws ParserConfigurationException if an error occurs
- * @throws SAXException if an error occurs
- * @throws IOException if an error occurs
- */
- public static Document readDocument(InputStream stream) throws ParserConfigurationException,
- SAXException, IOException {
- DocumentBuilder builder = createBuilder();
- return builder.parse(stream);
- }
-
- /**
- * Writes a document to a file. A new file is created if it does not exist.
- * @param document The document to save.
- * @param file The file to save the document to.
- * @throws IOException if an error occurs
- * @throws TransformerConfigurationException if an error occurs
- * @throws TransformerException if an error occurs
- */
- public static void writeDocument(Document document, File file)
- throws TransformerConfigurationException, TransformerException, IOException {
- // sanity checks
- if (document == null)
- throw new IllegalArgumentException("illegal usage, parameter document may not be null");
- if (file == null)
- throw new IllegalArgumentException("illegal usage, parameter file may not be null");
-
- file.getParentFile().mkdirs();
- file.createNewFile();
-
- DOMSource source = new DOMSource(document);
- StreamResult result = new StreamResult(file);
- getTransformer(document.getDoctype()).transform(source, result);
- }
-
- /**
- * Writes a document to a writer.
- * @param document The document to write.
- * @param writer The writer to write the document to.
- * @throws TransformerConfigurationException if an error occurs
- * @throws TransformerException if an error occurs
- */
- public static void writeDocument(Document document, Writer writer)
- throws TransformerConfigurationException, TransformerException {
-
- // sanity checks
- if (document == null)
- throw new IllegalArgumentException("illegal usage of DocumentHelper::writeDocument(), parameter document may not be null");
-
- DOMSource source = new DOMSource(document);
- StreamResult result = new StreamResult(writer);
- getTransformer(document.getDoctype()).transform(source, result);
- }
-
- /**
- * Writes a document to an output stream.
- * @param document The document to write.
- * @param outputStream The stream to write the document to.
- * @throws TransformerConfigurationException if an error occurs
- * @throws TransformerException if an error occurs
- */
- public static void writeDocument(Document document, OutputStream outputStream)
- throws TransformerConfigurationException, TransformerException {
-
- // sanity checks
- if (document == null)
- throw new IllegalArgumentException("illegal usage of DocumentHelper::writeDocument(), parameter document may not be null");
-
- DOMSource source = new DOMSource(document);
- StreamResult result = new StreamResult(outputStream);
- try {
- getTransformer(document.getDoctype()).transform(source, result);
- }
- finally {
- try {
- if (outputStream != null) {
- outputStream.close();
- }
- }
- catch (Exception ignore) {
-
- }
- }
- }
-
- /**
- * Get the transformer.
- * @param documentType the document type
- * @return a transformer
- * @throws TransformerConfigurationException if an error occurs
- */
- protected static Transformer getTransformer(DocumentType documentType)
- throws TransformerConfigurationException {
- TransformerFactory factory = TransformerFactory.newInstance();
- Transformer transformer = factory.newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
-
- if (documentType != null) {
- if (documentType.getPublicId() != null)
- transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, documentType.getPublicId());
- if (documentType.getSystemId() != null)
- transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, documentType.getSystemId());
- }
-
- return transformer;
- }
-
- /**
- * Creates a document type.
- * @param qualifiedName The qualified name of the document type.
- * @param publicId The public identifier.
- * @param systemId The system identifier.
- * @return the document type
- * @throws ParserConfigurationException if an error occurs
- * @see org.w3c.dom.DOMImplementation#createDocumentType(java.lang.String,
- * java.lang.String, java.lang.String)
- */
- public DocumentType createDocumentType(String qualifiedName, String publicId, String systemId)
- throws ParserConfigurationException {
- DocumentBuilder builder = createBuilder();
-
- return builder.getDOMImplementation().createDocumentType(qualifiedName, publicId, systemId);
- }
-
- /**
- * Returns the first child element of an element that belong to a certain
- * namespace or <code>null</code> if none exists.
- * @param element The parent element.
- * @param namespaceUri The namespace that the childen must belong to.
- * @return The first child element or <code>null</code> if none exists.
- */
- public static Element getFirstChild(Element element, String namespaceUri) {
- return getFirstChild(element, namespaceUri, "*");
- }
-
- /**
- * Returns the first child element of an element that belongs to a certain
- * namespace and has a certain local name or <code>null</code> if none
- * exists.
- * @param element The parent element.
- * @param namespaceUri The namespace that the childen must belong to.
- * @param localName The local name of the children.
- * @return The child element or <code>null</code> if none exists.
- */
- public static Element getFirstChild(Element element, String namespaceUri, String localName) {
- Element[] children = getChildren(element, namespaceUri, localName);
-
- if (children.length > 0) {
- return children[0];
- }
- return null;
- }
-
- /**
- * Returns all child elements of an element, regardless of the namespace.
- * @param element The parent element.
- * @return The child elements.
- */
- public static Element[] getChildren(Element element) {
- List childElements = new ArrayList();
- NodeList children = element.getElementsByTagName("*");
-
- for (int i = 0; i < children.getLength(); i++) {
- if (children.item(i).getParentNode() == element) {
- childElements.add(children.item(i));
- }
- }
-
- return (Element[]) childElements.toArray(new Element[childElements.size()]);
- }
-
- /**
- * Returns all child elements of an element that belong to a certain
- * namespace.
- * @param element The parent element.
- * @param namespaceUri The namespace that the childen must belong to.
- * @return The child elements.
- */
- public static Element[] getChildren(Element element, String namespaceUri) {
- return getChildren(element, namespaceUri, "*");
- }
-
- /**
- * Returns all child elements of an element that belong to a certain
- * namespace and have a certain local name.
- * @param element The parent element.
- * @param namespaceUri The namespace that the childen must belong to.
- * @param localName The local name of the children.
- * @return The child elements.
- */
- public static Element[] getChildren(Element element, String namespaceUri, String localName) {
- List childElements = new ArrayList();
- NodeList children = element.getElementsByTagNameNS(namespaceUri, localName);
-
- for (int i = 0; i < children.getLength(); i++) {
- if (children.item(i).getParentNode() == element) {
- childElements.add(children.item(i));
- }
- }
-
- return (Element[]) childElements.toArray(new Element[childElements.size()]);
- }
-
- /**
- * Returns the text inside an element. Only the child text nodes of this
- * element are collected.
- * @param element The element.
- * @return The text inside the element.
- */
- public static String getSimpleElementText(Element element) {
- StringBuffer buffer = new StringBuffer();
- NodeList children = element.getChildNodes();
-
- for (int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
-
- if (child instanceof Text) {
- buffer.append(child.getNodeValue());
- }
- }
-
- return buffer.toString();
- }
-
- /**
- * Replaces all child nodes of an element by a single text node.
- * @param element The element.
- * @param text The text to insert.
- */
- public static void setSimpleElementText(Element element, String text) {
- NodeList children = element.getChildNodes();
-
- for (int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
- element.removeChild(child);
- }
-
- Node textNode = element.getOwnerDocument().createTextNode(text);
- element.appendChild(textNode);
- }
-
- /**
- * Returns all following sibling elements of an element that belong to a
- * certain namespace.
- * @param element The parent element.
- * @param namespaceUri The namespace that the childen must belong to.
- * @return The following sibling elements.
- */
- public static Element[] getNextSiblings(Element element, String namespaceUri) {
- return getNextSiblings(element, namespaceUri, "*");
- }
-
- /**
- * Returns all following sibling elements of an element that belong to a
- * certain namespace. and have a certain local name.
- * @param element The parent element.
- * @param namespaceUri The namespace that the childen must belong to.
- * @param localName The local name of the children.
- * @return The following sibling elements.
- */
- public static Element[] getNextSiblings(Element element, String namespaceUri, String localName) {
- List childElements = new ArrayList();
- Element parent = (Element) element.getParentNode();
- Element[] children = getChildren(parent, namespaceUri, localName);
-
- int l = children.length;
- for (int i = 0; i < children.length; i++) {
- if (children[i] == element) {
- l = i;
- }
- if (i > l) {
- childElements.add(children[i]);
- }
- }
-
- return (Element[]) childElements.toArray(new Element[childElements.size()]);
- }
-
- /**
- * Returns all preceding sibling elements of an element that belong to a
- * certain namespace.
- * @param element The parent element.
- * @param namespaceUri The namespace that the childen must belong to.
- * @return The preceding sibling elements.
- */
- public static Element[] getPrecedingSiblings(Element element, String namespaceUri) {
- return getPrecedingSiblings(element, namespaceUri, "*");
- }
-
- /**
- * Returns all preceding sibling elements of an element that belong to a
- * certain namespace. and have a certain local name.
- * @param element The parent element.
- * @param namespaceUri The namespace that the childen must belong to.
- * @param localName The local name of the children.
- * @return The preceding sibling elements.
- */
- public static Element[] getPrecedingSiblings(Element element, String namespaceUri,
- String localName) {
- List childElements = new ArrayList();
- Element parent = (Element) element.getParentNode();
- Element[] children = getChildren(parent, namespaceUri, localName);
-
- int i = 0;
- while (children[i] != element && i < children.length) {
- childElements.add(children[i]);
- i++;
- }
-
- return (Element[]) childElements.toArray(new Element[childElements.size()]);
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/xml/NamespaceHelper.java b/trunk/src/java/org/apache/lenya/xml/NamespaceHelper.java
deleted file mode 100644
index 18ef05b..0000000
--- a/trunk/src/java/org/apache/lenya/xml/NamespaceHelper.java
+++ /dev/null
@@ -1,223 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.xml;
-
-import java.io.OutputStream;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.lenya.util.Assert;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Text;
-
-/**
- * A NamespaceHelper object simplifies the creation of elements in a certain
- * namespace. All elements are owned by a document that is passed to the
- * {@link #NamespaceHelper(String, String, Document)} constructor or created
- * using the {@link #NamespaceHelper(String, String, String)} constructor.
- */
-public class NamespaceHelper {
- private String namespaceUri;
- private String prefix;
- private Document document;
-
- /**
- * Creates a new instance of NamespaceHelper using an existing document. The
- * document is not affected. If the prefix is <code>null</code>, the default namespace
- * is used.
- * @param _document The document.
- * @param _namespaceUri The namespace URI.
- * @param _prefix The namespace prefix.
- */
- public NamespaceHelper(String _namespaceUri, String _prefix, Document _document) {
-
- Assert.notNull("namespace URI", _namespaceUri);
- Assert.notNull("DOM", _document);
-
- this.namespaceUri = _namespaceUri;
- this.prefix = _prefix;
- this.document = _document;
- }
-
- /**
- * <p>
- * Creates a new instance of NamespaceHelper. A new document is created
- * using a document element in the given namespace with the given prefix. If
- * the prefix is null, the default namespace is used.
- * </p>
- * <p>
- * NamespaceHelper("http://www.w3.org/2000/svg", "svg", "svg"):<br/>
- * <?xml version="1.0"><br/> <svg:svg
- * xmlns:svg="http://www.w3.org/2000/svg"><br/> </svg:svg>
- * </p>
- * @param localName The local name of the document element.
- * @param _namespaceUri The namespace URI.
- * @param _prefix The namespace prefix.
- * @throws ParserConfigurationException if an error occured
- */
- public NamespaceHelper(String _namespaceUri, String _prefix, String localName)
- throws ParserConfigurationException {
- this(_namespaceUri, _prefix, DocumentHelper.createDocument(_namespaceUri, getQualifiedName(
- _prefix, localName), null));
- }
-
- /**
- * Returns the document that is used to create elements.
- * @return A document object.
- */
- public Document getDocument() {
- return this.document;
- }
-
- /**
- * Returns the namespace URI of this NamespaceHelper.
- * @return The namespace URI.
- */
- public String getNamespaceURI() {
- return this.namespaceUri;
- }
-
- /**
- * Returns the namespace prefix that is used to create elements.
- * @return The namespace prefix.
- */
- public String getPrefix() {
- return this.prefix;
- }
-
- /**
- * Returns the qualified name for a local name using the prefix of this
- * NamespaceHelper.
- * @param prefix The namespace prefix.
- * @param localName The local name.
- * @return The qualified name, i.e. prefix:localName.
- */
- public static String getQualifiedName(String prefix, String localName) {
- if (prefix == null || prefix.equals("")) {
- return localName;
- }
- return prefix + ":" + localName;
- }
-
- /**
- * <p>
- * Creates an element within the namespace of this NamespaceHelper object
- * with a given local name containing a text node.<br/>
- * </p>
- * <p>
- * <code>createElement("text")</code>: <code><prefix:text/><code>.
- * </p>
- * @param localName The local name of the element.
- * @return A new element.
- */
- public Element createElement(String localName) {
- return getDocument().createElementNS(getNamespaceURI(),
- getQualifiedName(getPrefix(), localName));
- }
-
- /**
- * <p>
- * Creates an element within the namespace of this NamespaceHelper object
- * with a given local name containing a text node.
- * </p>
- * <p>
- * <code>createElement("text", "Hello World!")</code>:
- * <code><prefix:text>Hello World!</prefix:text></code>.
- * </p>
- * @param localName The local name of the element.
- * @param text The text for the text node inside the element.
- * @return A new element containing a text node.
- */
- public Element createElement(String localName, String text) {
- Element element = createElement(localName);
- Text textNode = getDocument().createTextNode(text);
- element.appendChild(textNode);
-
- return element;
- }
-
- /**
- * Returns all children of an element in the namespace of this
- * NamespaceHelper.
- * @param element The parent element.
- * @return the children.
- */
- public Element[] getChildren(Element element) {
- return DocumentHelper.getChildren(element, getNamespaceURI());
- }
-
- /**
- * Returns all children of an element with a local name in the namespace of
- * this NamespaceHelper.
- * @param element The parent element.
- * @param localName The local name of the children to return.
- * @return the children.
- */
- public Element[] getChildren(Element element, String localName) {
- return DocumentHelper.getChildren(element, getNamespaceURI(), localName);
- }
-
- /**
- * Returns the first childr of an element with a local name in the namespace
- * of this NamespaceHelper or <code>null</code> if none exists.
- * @param element The parent element.
- * @param localName The local name of the children to return.
- * @return the first child.
- */
- public Element getFirstChild(Element element, String localName) {
- return DocumentHelper.getFirstChild(element, getNamespaceURI(), localName);
- }
-
- /**
- * Returns the next siblings of an element with a local name in the
- * namespace of this NamespaceHelper or <code>null</code> if none exists.
- * @param element The parent element.
- * @param localName The local name of the children to return.
- * @return the next siblings.
- */
- public Element[] getNextSiblings(Element element, String localName) {
- return DocumentHelper.getNextSiblings(element, getNamespaceURI(), localName);
- }
-
- /**
- * Returns the preceding siblings of an element with a local name in the
- * namespace of this NamespaceHelper or <code>null</code> if none exists.
- * @param element The parent element.
- * @param localName The local name of the children to return.
- * @return the preceding siblings.
- */
- public Element[] getPrecedingSiblings(Element element, String localName) {
- return DocumentHelper.getPrecedingSiblings(element, getNamespaceURI(), localName);
- }
-
- /**
- * Saves the XML.
- * @param stream The stream to write to.
- */
- public void save(OutputStream stream) {
- try {
- DocumentHelper.writeDocument(getDocument(), stream);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/xml/Schema.java b/trunk/src/java/org/apache/lenya/xml/Schema.java
deleted file mode 100644
index 386ca01..0000000
--- a/trunk/src/java/org/apache/lenya/xml/Schema.java
+++ /dev/null
@@ -1,73 +0,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.
- *
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.lenya.xml;
-
-/**
- * Validation schema.
- */
-public class Schema {
-
- /**
- * Ctor.
- * @param language The language, as defined by
- * org.apache.cocoon.components.validation.Validator.
- * @param schemaUri The schema URI.
- * @see org.apache.cocoon.components.validation.Validator
- */
- public Schema(String language, String schemaUri) {
- this.language = language;
- this.uri = schemaUri;
- }
-
- private String language;
-
- private String uri;
-
- /**
- * @return The language.
- * @see org.apache.cocoon.components.validation.Validator
- */
- public String getLanguage() {
- return this.language;
- }
-
- /**
- * @return The URI to read the schema from.
- */
- public String getURI() {
- return this.uri;
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/xml/ValidationUtil.java b/trunk/src/java/org/apache/lenya/xml/ValidationUtil.java
deleted file mode 100644
index 0cea02e..0000000
--- a/trunk/src/java/org/apache/lenya/xml/ValidationUtil.java
+++ /dev/null
@@ -1,72 +0,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.
- *
- */
-package org.apache.lenya.xml;
-
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.components.validation.Validator;
-import org.apache.cocoon.xml.dom.DOMStreamer;
-import org.apache.lenya.cms.publication.Document;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.ErrorHandler;
-
-/**
- * Validation utility.
- */
-public class ValidationUtil {
-
- /**
- * @param manager The service manager.
- * @param document The document to validate.
- * @param handler The SAX error handler.
- * @throws Exception if an error occurs.
- */
- public static void validate(ServiceManager manager, Document document, ErrorHandler handler)
- throws Exception {
-
- org.w3c.dom.Document xmlDoc = DocumentHelper.readDocument(document.getInputStream());
- validate(manager, xmlDoc, document.getResourceType().getSchema(), handler);
-
- }
-
- /**
- * @param manager The service manager.
- * @param xmlDoc The XML document.
- * @param schema The schema to use.
- * @param handler The SAX error handler.
- * @throws Exception if an error occurs.
- */
- public static void validate(ServiceManager manager, org.w3c.dom.Document xmlDoc, Schema schema,
- ErrorHandler handler) throws Exception {
-
- Validator validator = null;
- try {
- validator = (Validator) manager.lookup(Validator.ROLE);
- ContentHandler validatorHandler = validator.getValidationHandler(schema.getURI(),
- handler);
-
- DOMStreamer streamer = new DOMStreamer(validatorHandler);
- streamer.stream(xmlDoc);
-
- } finally {
- if (validator != null) {
- manager.release(validator);
- }
- }
- }
-
-}
diff --git a/trunk/src/java/org/apache/lenya/xml/XLink.java b/trunk/src/java/org/apache/lenya/xml/XLink.java
deleted file mode 100644
index 7125703..0000000
--- a/trunk/src/java/org/apache/lenya/xml/XLink.java
+++ /dev/null
@@ -1,116 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.xml;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-
-/**
- * Helper class for XLinks
- */
-public class XLink {
-
- /**
- * <code>type</code> The Xlink type
- */
- public String type = null;
- /**
- * <code>href</code> The XLink href
- */
- public String href = null;
- /**
- * <code>show</code> The value of the show attribute
- */
- public String show = null;
- /**
- * <code>name</code> The Xlink name
- */
- public String name = null;
- /**
- * <code>element</code> The Xlink element
- */
- public Element element = null;
- /**
- * <code>XLINK_NAMESPACE</code> The XLink namespace
- */
- public static final String XLINK_NAMESPACE = "http://www.w3.org/1999/xlink";
- /**
- * <code>ATTRIBUTE_HREF</code> The href attribte
- */
- public static final String ATTRIBUTE_HREF = "href";
- /**
- * <code>ATTRIBUTE_SHOW</code> The show attribute
- */
- public static final String ATTRIBUTE_SHOW = "show";
- /**
- * <code>ATTRIBUTE_TYPE</code> The type attribute
- */
- public static final String ATTRIBUTE_TYPE = "type";
-
- /**
- * Constructor
- */
- public XLink() {
- this.type = "simple";
- this.show = "undefined";
- }
-
- /**
- * Constructor
- * @param _element The element
- */
- public XLink(Element _element) {
- this();
- this.element = _element;
-
- this.name = _element.getNodeName();
-
- Attr hrefAttribute = _element.getAttributeNodeNS(XLINK_NAMESPACE, ATTRIBUTE_HREF);
- if (hrefAttribute != null) {
- this.href = hrefAttribute.getNodeValue();
- }
- Attr typeAttribute = _element.getAttributeNodeNS(XLINK_NAMESPACE, ATTRIBUTE_TYPE);
- if (typeAttribute != null) {
- this.type = typeAttribute.getNodeValue();
- }
- Attr showAttribute = _element.getAttributeNodeNS(XLINK_NAMESPACE, ATTRIBUTE_SHOW);
- if (showAttribute != null) {
- this.show = showAttribute.getNodeValue();
- }
-
- }
-
- /**
- * Returns a printout of the XLink values
- * @return The printout
- */
- public String toString() {
- return "XLink: type=\""
- + this.type
- + "\", href=\""
- + this.href
- + "\", show=\""
- + this.show
- + "\", name=\""
- + this.name
- + "\"";
- }
-}
diff --git a/trunk/src/java/org/apache/lenya/xml/XPath.java b/trunk/src/java/org/apache/lenya/xml/XPath.java
deleted file mode 100644
index f8ab79e..0000000
--- a/trunk/src/java/org/apache/lenya/xml/XPath.java
+++ /dev/null
@@ -1,127 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.xml;
-
-import java.util.StringTokenizer;
-
-import org.w3c.dom.Node;
-
-/**
- * Helper class for XPath operations
- */
-public class XPath {
- String xpath = null;
- String[] parts = null;
-
- /**
- * Constructor
- * @param _xpath The Xpath
- */
- public XPath(String _xpath) {
- this.xpath = _xpath;
-
- StringTokenizer st = new StringTokenizer(_xpath, "/");
- int length = st.countTokens();
- this.parts = new String[length];
-
- for (int i = 0; i < length; i++) {
- this.parts[i] = st.nextToken();
- }
- }
-
- /**
- * Get the parent path
- * @return The parent path
- */
- public XPath getParent() {
- StringBuffer buf = new StringBuffer();
-
- for (int i = 0; i < (this.parts.length - 1); i++) {
- buf.append("/" + this.parts[i]);
- }
-
- return new XPath(buf.toString());
- }
-
- /**
- * Get the type of a node. Only supports attribute and element nodes
- * @return The node type
- */
- public short getType() {
- if (this.parts[this.parts.length - 1].indexOf("@") == 0) {
- return Node.ATTRIBUTE_NODE;
- }
- return Node.ELEMENT_NODE;
- }
-
- /**
- * Return a string representation of the XPath
- * @return The Xpath
- */
- public String toString() {
- return this.xpath;
- }
-
- /**
- * Get the name
- * @return The name
- */
- public String getName() {
- if (getType() == Node.ATTRIBUTE_NODE) {
- return this.parts[this.parts.length - 1].substring(1);
- }
- return this.parts[this.parts.length - 1];
- }
-
- /**
- * Return the name of the element
- * @return the name of the element
- */
- public String getElementName() {
- if (getType() == Node.ATTRIBUTE_NODE) {
- return this.parts[this.parts.length - 2];
- }
- return this.parts[this.parts.length - 1];
- }
-
- /**
- * Get the name without predicates
- * @return The name without predicates
- */
- public String getNameWithoutPredicates() {
- return removePredicates(getName());
- }
-
- /**
- * Remove predicates (square brackets), http://www.w3.org/TR/xpath
- * @param s The string to remove predicates from
- * @return The string without predicates
- */
- public String removePredicates(String s) {
- int index = s.indexOf("[");
-
- if (index >= 0) {
- return s.substring(0, index);
- }
-
- return s;
- }
-}
diff --git a/trunk/src/modules-core/ac/config/cocoon-xconf/access-control-input-module.xconf b/trunk/src/modules-core/ac/config/cocoon-xconf/access-control-input-module.xconf
deleted file mode 100644
index f0babce..0000000
--- a/trunk/src/modules-core/ac/config/cocoon-xconf/access-control-input-module.xconf
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/cocoon/input-modules" unless="/cocoon/input-modules/component-instance[@name = 'access-control']">
- <component-instance logger="core.modules.input.access-control" name="access-control"
- class="org.apache.lenya.cms.cocoon.components.modules.input.AccessControlModule"/>
-</xconf>
diff --git a/trunk/src/modules-core/ac/config/cocoon-xconf/access-controller-resolvers.xconf b/trunk/src/modules-core/ac/config/cocoon-xconf/access-controller-resolvers.xconf
deleted file mode 100644
index 02fe919..0000000
--- a/trunk/src/modules-core/ac/config/cocoon-xconf/access-controller-resolvers.xconf
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/cocoon" unless="/cocoon/access-controller-resolvers">
- <access-controller-resolvers>
- <component-instance name="publication"
- class="org.apache.lenya.cms.ac.PublicationAccessControllerResolver"
- logger="lenya.ac.accesscontrollerresolver.publication">
- </component-instance>
- <component-instance name="global"
- class="org.apache.lenya.ac.impl.ConfigurableAccessControllerResolver"
- logger="lenya.ac.accesscontrollerresolver.global">
- <access-controller type="global"/>
- </component-instance>
- <component-instance name="composable"
- class="org.apache.lenya.ac.impl.ComposableAccessControllerResolver"
- logger="lenya.ac.accesscontrollerresolver.composable">
- <resolver type="publication"/>
- <!-- <resolver type="global"/>-->
- </component-instance>
- </access-controller-resolvers>
-</xconf>
diff --git a/trunk/src/modules-core/ac/config/cocoon-xconf/accreditable-manager-factory.xconf b/trunk/src/modules-core/ac/config/cocoon-xconf/accreditable-manager-factory.xconf
deleted file mode 100644
index 42f4e12..0000000
--- a/trunk/src/modules-core/ac/config/cocoon-xconf/accreditable-manager-factory.xconf
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.ac.AccreditableManagerFactory']">
- <component logger="lenya.ac.accreditablemanager"
- role="org.apache.lenya.ac.AccreditableManagerFactory"
- class="org.apache.lenya.ac.file.FileAccreditableManagerFactory"/>
-</xconf>
diff --git a/trunk/src/modules-core/ac/config/cocoon-xconf/authenticator.xconf b/trunk/src/modules-core/ac/config/cocoon-xconf/authenticator.xconf
deleted file mode 100644
index a2bf4c2..0000000
--- a/trunk/src/modules-core/ac/config/cocoon-xconf/authenticator.xconf
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.ac.Authenticator']">
- <component logger="lenya.ac.authenticator"
- class="org.apache.lenya.ac.impl.UserAuthenticator"
- role="org.apache.lenya.ac.Authenticator"/>
-
- <!--
- Enable this authenticator and disable the UserAuthenticator for anonymous authentication (useful for client certs, for instance)
-
- <component logger="lenya.ac.authenticator"
- class="org.apache.lenya.ac.impl.AnonymousAuthenticator"
- role="org.apache.lenya.ac.Authenticator"/>
- -->
-
-</xconf>
diff --git a/trunk/src/modules-core/ac/config/cocoon-xconf/authorizers.xconf b/trunk/src/modules-core/ac/config/cocoon-xconf/authorizers.xconf
deleted file mode 100644
index dc43771..0000000
--- a/trunk/src/modules-core/ac/config/cocoon-xconf/authorizers.xconf
+++ /dev/null
@@ -1,21 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/cocoon" unless="/cocoon/authorizers">
- <authorizers/>
-</xconf>
diff --git a/trunk/src/modules-core/ac/config/cocoon-xconf/bypassable-access-controller.xconf b/trunk/src/modules-core/ac/config/cocoon-xconf/bypassable-access-controller.xconf
deleted file mode 100644
index 8faa651..0000000
--- a/trunk/src/modules-core/ac/config/cocoon-xconf/bypassable-access-controller.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.ac.AccessController/bypassable']">
- <component logger="lenya.ac.accesscontroller.bypassable"
- class="org.apache.lenya.ac.impl.BypassableAccessController"
- role="org.apache.lenya.ac.AccessController/bypassable">
-
- <public-extensions>css,jpg,gif,png,rng,xsl</public-extensions>
-
- <!-- bad performance, use only for complex patterns
- <public>.*[.]css|.*[.]jpg|.*[.]gif|.*[.]png|.*[.]rng|.*[.]xsl</public>
- -->
-
- </component>
-</xconf>
diff --git a/trunk/src/modules-core/ac/config/cocoon-xconf/policy-managers.xconf b/trunk/src/modules-core/ac/config/cocoon-xconf/policy-managers.xconf
deleted file mode 100644
index 6d53b02..0000000
--- a/trunk/src/modules-core/ac/config/cocoon-xconf/policy-managers.xconf
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/cocoon" unless="/cocoon/policy-managers">
- <policy-managers>
- <component-instance name="document"
- class="org.apache.lenya.cms.ac.DocumentPolicyManagerWrapper"
- logger="lenya.ac.policymanager.document"/>
- <component-instance name="file"
- class="org.apache.lenya.ac.file.FilePolicyManager"
- logger="lenya.ac.policymanager.file"/>
- <component-instance name="sitemap"
- class="org.apache.lenya.cms.ac.SitemapPolicyManager"
- logger="lenya.ac.policymanager.sitemap"/>
- </policy-managers>
-
-</xconf>
diff --git a/trunk/src/modules-core/ac/config/module.xml b/trunk/src/modules-core/ac/config/module.xml
deleted file mode 100644
index d69c1e9..0000000
--- a/trunk/src/modules-core/ac/config/module.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.ac</id>
- <export package="org.apache.lenya.ac.file"/>
- <depends module="org.apache.lenya.modules.cache"/>
- <depends module="org.apache.lenya.modules.linking"/>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>Access control</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>Access control</description>
-</module>
diff --git a/trunk/src/modules-core/ac/config/sitemap/actions.xmap b/trunk/src/modules-core/ac/config/sitemap/actions.xmap
deleted file mode 100644
index 1d58729..0000000
--- a/trunk/src/modules-core/ac/config/sitemap/actions.xmap
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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.
--->
-<!-- $Id: actions.xmap 280060 2005-09-11 01:56:31Z chestnut $ -->
-
-<xmap xpath="/sitemap/components/actions" unless="/sitemap/components/actions/action[@name = 'authenticator']"
- xmlns:map="http://apache.org/cocoon/sitemap/1.0">
- <map:action name="authenticator" src="org.apache.lenya.cms.cocoon.acting.DelegatingAuthenticatorAction" logger="lenya.sitemap.action.authenticator"/>
- <map:action name="authorizer" src="org.apache.lenya.cms.cocoon.acting.DelegatingAuthorizerAction" logger="lenya.sitemap.action.authorizer"/>
- <map:action name="ssl-redirect" src="org.apache.lenya.cms.cocoon.acting.SslRedirectAction" logger="lenya.sitemap.action.ssl-redirect"/>
-</xmap>
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/cifs/CIFSUser.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/cifs/CIFSUser.java
deleted file mode 100644
index 508f899..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/cifs/CIFSUser.java
+++ /dev/null
@@ -1,181 +0,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.
- *
- */
-
-package org.apache.lenya.ac.cifs;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.file.FileUser;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.Logger;
-
-import jcifs.smb.NtlmPasswordAuthentication;
-import jcifs.smb.SmbAuthException;
-import jcifs.smb.SmbException;
-import jcifs.smb.SmbSession;
-
-import jcifs.UniAddress;
-import java.net.UnknownHostException;
-
-/**
- * CIFS user.
- * @version $Id$
- */
-public class CIFSUser extends FileUser {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private static Properties defaultProperties = null;
-
- // The name for the cifs.properties domain controller lookup
- private static final String DOMAIN_CONTROLLER = "domain-controller";
-
- // The name for the cifs.properties domain name lookup
- private static final String DOMAIN = "domain";
-
- /**
- * Creates a new CIFSUser object.
- * @param itemManager The item manager.
- * @param logger The logger.
- */
- public CIFSUser(ItemManager itemManager, Logger logger) {
- super(itemManager, logger);
-
- }
-
- /**
- * Create a CIFSUser
- * @param itemManager The item manager.
- * @param logger The logger.
- * @param id The user ID.
- * @param fullName The user's name.
- * @param email The e-mail address.
- * @param password The password.
- */
- public CIFSUser(ItemManager itemManager, Logger logger, String id, String fullName,
- String email, String password) {
- super(itemManager, logger, id, fullName, email, password);
-
- }
-
- /**
- * Initializes this user.
- * @throws ConfigurationException when something went wrong.
- */
- protected void initialize() throws ConfigurationException {
- try {
- readProperties(super.getConfigurationDirectory());
- } catch (final IOException ioe) {
- throw new ConfigurationException("Reading cifs.properties file in ["
- + super.getConfigurationDirectory() + "] failed", ioe);
- }
- }
-
- /**
- * Create a new CIFSUser from a configuration
- * @param config the <code>Configuration</code> specifying the user
- * details
- * @throws ConfigurationException if the user could not be instantiated
- */
- public void configure(Configuration config) throws ConfigurationException {
- super.configure(config);
- initialize();
- }
-
- /**
- * Authenticate a user. This is done by NTDomain Authentication using jcifs
- * @param password to authenticate with
- * @return true if the given password matches the password for this user
- */
- public boolean authenticate(String password) {
-
- System.setProperty("jcifs.smb.client.disablePlainTextPasswords", "true");
- try {
- UniAddress mydomaincontroller = UniAddress.getByName(getDomainController());
- NtlmPasswordAuthentication mycreds = new NtlmPasswordAuthentication(getDomainName(),
- super.getId(), password);
- SmbSession.logon(mydomaincontroller, mycreds);
- // SUCCESS
- return true;
- } catch (final SmbAuthException sae) {
- // AUTHENTICATION FAILURE
- if (getLogger().isInfoEnabled()) {
- getLogger().info(
- "Authentication against [" + getDomainController() + "]" + " failed for "
- + getDomainName() + "/" + super.getId());
- }
- return false;
- } catch (final SmbException se) {
- // NETWORK PROBLEMS?
- return false;
- } catch (final UnknownHostException unho) {
- return false;
- }
-
- }
-
- /**
- * Read the properties
- * @param configurationDirectory The configuration directory.
- * @throws IOException if the properties cannot be found.
- */
- private void readProperties(File configurationDirectory) throws IOException {
- // create and load default properties
- File propertiesFile = new File(configurationDirectory, "cifs.properties");
-
- if (defaultProperties == null) {
- defaultProperties = new Properties();
-
- FileInputStream in = null;
- try {
- in = new FileInputStream(propertiesFile);
- defaultProperties.load(in);
- } finally {
- if (in != null) {
- in.close();
- }
- }
-
- }
- }
-
- /**
- * Get the domain controller we want to authenticate against
- * @return the name of the domain controller
- */
- private String getDomainController() {
- return (String) defaultProperties.get(DOMAIN_CONTROLLER);
- }
-
- /**
- * Get the domain name
- * @return the domain name
- */
- private String getDomainName() {
- return (String) defaultProperties.get(DOMAIN);
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileAccreditableManager.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileAccreditableManager.java
deleted file mode 100644
index d1c3cf5..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileAccreditableManager.java
+++ /dev/null
@@ -1,207 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.util.NetUtils;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.GroupManager;
-import org.apache.lenya.ac.IPRangeManager;
-import org.apache.lenya.ac.RoleManager;
-import org.apache.lenya.ac.UserManager;
-import org.apache.lenya.ac.UserType;
-import org.apache.lenya.ac.impl.AbstractAccreditableManager;
-import org.apache.lenya.util.Assert;
-
-/**
- * File-based accreditable manager.
- */
-public class FileAccreditableManager extends AbstractAccreditableManager {
-
- private ServiceManager manager;
-
- /**
- * Creates a new FileAccessController based on a configuration directory.
- * @param manager The service manager.
- * @param logger The logger.
- * @param configurationUri The configuration directory URI.
- * @param _userTypes The supported user types.
- */
- public FileAccreditableManager(ServiceManager manager, Logger logger,
- String configurationUri, UserType[] _userTypes) {
- super(logger);
-
- Assert.notNull("service manager", manager);
- this.manager = manager;
-
- Assert.notNull("configuration directory", configurationUri);
- this.configurationDirectoryUri = configurationUri;
-
- this.userTypes = new HashSet(Arrays.asList(_userTypes));
- }
-
- private File configurationDirectory;
- private Set userTypes;
-
- /**
- * Returns the supported user types.
- * @return An array of user types.
- * @throws AccessControlException if an error occurs.
- */
- public UserType[] getUserTypes() throws AccessControlException {
- if (this.userTypes == null)
- throw new AccessControlException("User types not initialized");
- return (UserType[]) this.userTypes.toArray(new UserType[this.userTypes.size()]);
- }
-
- /**
- * Returns the configuration directory.
- * @return The configuration directory.
- * @throws AccessControlException when something went wrong.
- */
- public File getConfigurationDirectory() throws AccessControlException {
-
- if (this.configurationDirectory == null) {
-
- if (this.configurationDirectoryUri == null) {
- throw new AccessControlException("Configuration directory not set!");
- }
-
- Source source = null;
- SourceResolver resolver = null;
- File directory;
- try {
-
- getLogger().debug(
- "Configuration directory Path: [" + this.configurationDirectoryUri + "]");
-
- resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);
- source = resolver.resolveURI(this.configurationDirectoryUri);
-
- getLogger().debug("Configuration directory URI: " + source.getURI());
- directory = new File(new URI(NetUtils.encodePath(source.getURI())));
- } catch (Exception e) {
- throw new AccessControlException(e);
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- getManager().release(resolver);
- }
- }
- this.configurationDirectory = directory;
- }
-
- return this.configurationDirectory;
- }
-
- // provided for backward compatibility
- protected static final String DEFAULT_USER_TYPE_CLASS = FileUser.class.getName();
- protected static final String DEFAULT_USER_TYPE_KEY = "Local User";
- protected static final String DEFAULT_USER_CREATE_USE_CASE = "userAddUser";
-
- /**
- * Returns the default user type.
- * @return A user type.
- */
- public static UserType getDefaultUserType() {
- return new UserType(DEFAULT_USER_TYPE_KEY, DEFAULT_USER_TYPE_CLASS,
- DEFAULT_USER_CREATE_USE_CASE);
- }
-
- private String configurationDirectoryUri;
-
- /**
- * Returns the service manager.
- * @return A service manager.
- */
- protected ServiceManager getManager() {
- return this.manager;
- }
-
- /**
- * @see org.apache.lenya.ac.impl.AbstractAccreditableManager#initializeGroupManager()
- */
- protected GroupManager initializeGroupManager() throws AccessControlException {
- FileGroupManager _manager = FileGroupManager.instance(this, getConfigurationDirectory(),
- getLogger());
- return _manager;
- }
-
- /**
- * @see org.apache.lenya.ac.impl.AbstractAccreditableManager#initializeIPRangeManager()
- */
- protected IPRangeManager initializeIPRangeManager() throws AccessControlException {
- FileIPRangeManager _manager = FileIPRangeManager.instance(this,
- getConfigurationDirectory(), getLogger());
- return _manager;
- }
-
- /**
- * @see org.apache.lenya.ac.impl.AbstractAccreditableManager#initializeRoleManager()
- */
- protected RoleManager initializeRoleManager() throws AccessControlException {
- FileRoleManager _manager = FileRoleManager.instance(this, getConfigurationDirectory(),
- getLogger());
- return _manager;
- }
-
- /**
- * @see org.apache.lenya.ac.impl.AbstractAccreditableManager#initializeUserManager()
- */
- protected UserManager initializeUserManager() throws AccessControlException {
- FileUserManager _manager = FileUserManager.instance(this, getConfigurationDirectory(),
- getUserTypes(), getLogger());
- return _manager;
- }
-
- public String getConfigurationCollectionUri() {
- try {
- return "file://" + getConfigurationDirectory().getCanonicalPath();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public String getId() {
- try {
- Assert.notNull("configuration directory", this.getConfigurationDirectory());
- return this.getConfigurationDirectory().getCanonicalPath();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- catch(AccessControlException e) {
- throw new RuntimeException(e);
- }
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileAccreditableManagerFactory.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileAccreditableManagerFactory.java
deleted file mode 100644
index 0193090..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileAccreditableManagerFactory.java
+++ /dev/null
@@ -1,102 +0,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.
- *
- */
-package org.apache.lenya.ac.file;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.AccreditableManagerFactory;
-import org.apache.lenya.ac.UserType;
-
-/**
- * Factory for file-based accreditable managers.
- */
-public class FileAccreditableManagerFactory extends AbstractLogEnabled implements
- AccreditableManagerFactory, ThreadSafe, Serviceable {
-
- private Map id2manager = new HashMap();
-
- protected static final String U_M_CHILD_TAG = "user-manager";
- protected static final String U_T_CHILD_TAG = "user-type";
- protected static final String U_T_CLASS_ATTRIBUTE = "class";
- protected static final String U_T_CREATE_ATTRIBUTE = "create-use-case";
-
- public AccreditableManager getAccreditableManager(Configuration config)
- throws ConfigurationException {
-
- try {
- String configUri = null;
- Configuration[] paramConfigs = config.getChildren("parameter");
- for (int i = 0; i < paramConfigs.length; i++) {
- if (paramConfigs[i].getAttribute("name").equals("directory")) {
- configUri = paramConfigs[i].getAttribute("value");
- }
- }
-
- if (configUri == null) {
- throw new RuntimeException("No <parameter name=\"directory\"> element found!");
- }
-
- if (this.id2manager.containsKey(configUri)) {
- return (AccreditableManager) this.id2manager.get(configUri);
- } else {
- Set userTypes = new HashSet();
- Configuration umConf = config.getChild(U_M_CHILD_TAG, false);
- if (umConf != null) {
- Configuration[] typeConfs = umConf.getChildren();
- for (int i = 0; i < typeConfs.length; i++) {
- userTypes.add(new UserType(typeConfs[i].getValue(), typeConfs[i]
- .getAttribute(U_T_CLASS_ATTRIBUTE), typeConfs[i]
- .getAttribute(U_T_CREATE_ATTRIBUTE)));
- }
- } else {
- getLogger().debug(
- "FileAccreditableManager: using default configuration for user types");
- // no "user-manager" block in access control: provide
- // a default for backward compatibility
- userTypes.add(FileAccreditableManager.getDefaultUserType());
- }
- UserType[] types = (UserType[]) userTypes.toArray(new UserType[userTypes.size()]);
- AccreditableManager mgr = new FileAccreditableManager(this.manager, getLogger(),
- configUri, types);
- this.id2manager.put(configUri, mgr);
- return mgr;
- }
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- protected ServiceManager manager;
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileGroup.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileGroup.java
deleted file mode 100644
index eb3c94e..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileGroup.java
+++ /dev/null
@@ -1,135 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfiguration;
-import org.apache.avalon.framework.configuration.DefaultConfigurationSerializer;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Item;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.impl.AbstractGroup;
-import org.apache.lenya.ac.impl.ItemConfiguration;
-
-/**
- * File-based group implementation.
- */
-public class FileGroup extends AbstractGroup implements Item {
-
- /**
- * @see org.apache.lenya.ac.Group#delete()
- */
- public void delete() throws AccessControlException {
- super.delete();
- getFile().delete();
- }
-
- /**
- * Creates a new FileGroup object.
- * @param itemManager The item manager.
- * @param logger The logger.
- */
- public FileGroup(ItemManager itemManager, Logger logger) {
- super(itemManager, logger);
- }
-
- /**
- * Create a new instance of <code>FileGroup</code>
- * @param itemManager The item manager.
- * @param logger The logger.
- * @param id the ID of the group
- */
- public FileGroup(ItemManager itemManager, Logger logger, String id) {
- super(itemManager, logger, id);
- FileItemManager fileItemManager = (FileItemManager) itemManager;
- setConfigurationDirectory(fileItemManager.getConfigurationDirectory());
- }
-
- /**
- * Configures this file group.
- * @param config The configuration.
- * @throws ConfigurationException when something went wrong.
- */
- public void configure(Configuration config) throws ConfigurationException {
- new ItemConfiguration().configure(this, config);
- }
-
- /**
- * Returns the configuration file.
- * @return A file object.
- */
- protected File getFile() {
- File xmlPath = getConfigurationDirectory();
- File xmlFile = new File(xmlPath, getId() + FileGroupManager.SUFFIX);
- return xmlFile;
- }
-
- /**
- * Save this group
- * @throws AccessControlException if the save failed
- */
- public void save() throws AccessControlException {
- DefaultConfigurationSerializer serializer = new DefaultConfigurationSerializer();
- Configuration config = createConfiguration();
- File xmlfile = getFile();
-
- try {
- serializer.serializeToFile(xmlfile, config);
- } catch (Exception e) {
- throw new AccessControlException(e);
- }
- }
-
- /**
- * Group configuration element.
- */
- public static final String GROUP = "group";
-
- /**
- * Create a configuration containing the group details
- * @return a <code>Configuration</code>
- */
- private Configuration createConfiguration() {
- DefaultConfiguration config = new DefaultConfiguration(GROUP);
- new ItemConfiguration().save(this, config);
-
- return config;
- }
-
- private File configurationDirectory;
-
- /**
- * Returns the configuration directory.
- * @return A file object.
- */
- protected File getConfigurationDirectory() {
- return this.configurationDirectory;
- }
-
- protected void setConfigurationDirectory(File _configurationDirectory) {
- assert (_configurationDirectory != null) && _configurationDirectory.isDirectory();
- this.configurationDirectory = _configurationDirectory;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileGroupManager.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileGroupManager.java
deleted file mode 100644
index 98a96cc..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileGroupManager.java
+++ /dev/null
@@ -1,125 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.GroupManager;
-import org.apache.lenya.ac.Item;
-
-/**
- * File-based group manager.
- */
-public final class FileGroupManager extends FileItemManager implements GroupManager {
-
- private static Map instances = new HashMap();
-
- /**
- * Ctor.
- * @param mgr The accreditable manager.
- */
- private FileGroupManager(AccreditableManager mgr) {
- super(mgr);
- }
-
- /**
- * Return the <code>GroupManager</code> for the given publication. The
- * <code>GroupManager</code> is a singleton.
- * @param mgr The accreditable manager.
- * @param configurationDirectory for which the GroupManager is requested
- * @param logger The logger.
- * @return a <code>GroupManager</code>
- * @throws AccessControlException if no GroupManager could be instanciated
- */
- public static FileGroupManager instance(AccreditableManager mgr, File configurationDirectory,
- Logger logger) throws AccessControlException {
- assert configurationDirectory != null;
-
- if (!instances.containsKey(configurationDirectory)) {
- FileGroupManager manager = new FileGroupManager(mgr);
- manager.enableLogging(logger);
- manager.configure(configurationDirectory);
- instances.put(configurationDirectory, manager);
- }
-
- return (FileGroupManager) instances.get(configurationDirectory);
- }
-
- /**
- * Get all groups
- *
- * @return an array of groups.
- */
- public Group[] getGroups() {
- Item[] items = super.getItems();
- Group[] groups = new Group[items.length];
- for (int i = 0; i < groups.length; i++) {
- groups[i] = (Group) items[i];
- }
- return groups;
- }
-
- /**
- * @see org.apache.lenya.ac.GroupManager#add(java.lang.String)
- */
- public Group add(String id) throws AccessControlException {
- Group group = new FileGroup(this, getLogger(), id);
- super.add(group);
- return group;
- }
-
- /**
- * Remove a group from this manager
- *
- * @param group the group to be removed
- * @throws AccessControlException when the notification failed.
- */
- public void remove(Group group) throws AccessControlException {
- super.remove(group);
- }
-
- /**
- * Get the group with the given group name.
- *
- * @param groupId the id of the requested group
- * @return a <code>Group</code> or null if there is no group with the
- * given name
- */
- public Group getGroup(String groupId) {
- return (Group) getItem(groupId);
- }
-
- protected static final String SUFFIX = ".gml";
-
- /**
- * @see org.apache.lenya.ac.file.FileItemManager#getSuffix()
- */
- protected String getSuffix() {
- return SUFFIX;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileIPRange.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileIPRange.java
deleted file mode 100644
index e570d44..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileIPRange.java
+++ /dev/null
@@ -1,166 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfiguration;
-import org.apache.avalon.framework.configuration.DefaultConfigurationSerializer;
-import org.apache.avalon.framework.logger.ConsoleLogger;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.Machine;
-import org.apache.lenya.ac.impl.AbstractIPRange;
-import org.apache.lenya.ac.impl.ItemConfiguration;
-import org.apache.lenya.net.InetAddressUtil;
-
-/**
- * IP range that is stored in a file.
- */
-public class FileIPRange extends AbstractIPRange implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Main method.
- * @param args The command-line arguments.
- * @deprecated This should be moved to a JUnit test.
- */
- public static void main(String[] args) {
- if (args.length == 0) {
- System.out
- .println("Usage: network, netmask, ip (e.g. 192.168.0.64 255.255.255.240 192.168.0.70)");
- return;
- }
- try {
- InetAddress networkAddress = InetAddress.getByName(args[0]);
- InetAddress subnetMask = InetAddress.getByName(args[1]);
- Machine machine = new Machine(args[2]);
-
- InetAddressUtil util = new InetAddressUtil(new ConsoleLogger());
- if (util.contains(networkAddress, subnetMask, machine.getAddress())) {
- System.out.println("true");
- } else {
- System.out.println("false");
- }
- } catch (final UnknownHostException e) {
- System.err.println(e);
- } catch (final AccessControlException e) {
- System.err.println(e);
- }
- }
-
- /**
- * Ctor.
- * @param itemManager The item manager.
- * @param logger The logger.
- */
- public FileIPRange(ItemManager itemManager, Logger logger) {
- super(itemManager, logger);
- }
-
- /**
- * Ctor.
- * @param itemManager The item manager.
- * @param logger The logger.
- * @param id The IP range ID.
- */
- public FileIPRange(ItemManager itemManager, Logger logger, String id) {
- super(itemManager, logger, id);
- FileItemManager fileItemManager = (FileItemManager) itemManager;
- setConfigurationDirectory(fileItemManager.getConfigurationDirectory());
- }
-
- /**
- * @see org.apache.lenya.ac.impl.AbstractIPRange#save()
- */
- public void save() throws AccessControlException {
- DefaultConfigurationSerializer serializer = new DefaultConfigurationSerializer();
- Configuration config = createConfiguration();
-
- try {
- serializer.serializeToFile(getFile(), config);
- } catch (Exception e) {
- throw new AccessControlException(e);
- }
- }
-
- /**
- * Returns the configuration file.
- * @return A file object.
- */
- protected File getFile() {
- File xmlPath = getConfigurationDirectory();
- File xmlFile = new File(xmlPath, getId() + FileIPRangeManager.SUFFIX);
- return xmlFile;
- }
-
- /**
- * @see org.apache.lenya.ac.Item#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration config) throws ConfigurationException {
- new ItemConfiguration().configure(this, config);
-
- String networkAddress = config.getChild(ELEMENT_NETWORK_ADDRESS).getValue();
- String subnetMask = config.getChild(ELEMENT_SUBNET_MASK).getValue();
-
- try {
- setNetworkAddress(networkAddress);
- setSubnetMask(subnetMask);
- } catch (AccessControlException e) {
- throw new ConfigurationException("Configuring IP range [" + getId() + "] failed: ", e);
- }
-
- }
-
- protected static final String IP_RANGE = "ip-range";
- protected static final String ELEMENT_NETWORK_ADDRESS = "network-address";
- protected static final String ELEMENT_SUBNET_MASK = "subnet-mask";
-
- /**
- * Create a configuration from the current user details. Can be used for saving.
- * @return a <code>Configuration</code>
- */
- protected Configuration createConfiguration() {
- DefaultConfiguration config = new DefaultConfiguration(IP_RANGE);
- new ItemConfiguration().save(this, config);
-
- DefaultConfiguration networkAddressConfig = new DefaultConfiguration(
- ELEMENT_NETWORK_ADDRESS);
- networkAddressConfig.setValue(getNetworkAddress().getHostAddress());
- config.addChild(networkAddressConfig);
-
- DefaultConfiguration subnetMaskConfig = new DefaultConfiguration(ELEMENT_SUBNET_MASK);
- subnetMaskConfig.setValue(getSubnetMask().getHostAddress());
- config.addChild(subnetMaskConfig);
-
- return config;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileIPRangeManager.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileIPRangeManager.java
deleted file mode 100644
index 915d53c..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileIPRangeManager.java
+++ /dev/null
@@ -1,122 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.IPRange;
-import org.apache.lenya.ac.IPRangeManager;
-import org.apache.lenya.ac.Item;
-
-/**
- * Manager for IP address ranges.
- */
-public class FileIPRangeManager extends FileItemManager implements IPRangeManager {
-
- /**
- * Ctor.
- * @param mgr The accreditable manager.
- */
- private FileIPRangeManager(AccreditableManager mgr) {
- super(mgr);
- }
-
- protected static final String SUFFIX = ".ipml";
-
- /**
- * @see org.apache.lenya.ac.file.FileItemManager#getSuffix()
- */
- protected String getSuffix() {
- return SUFFIX;
- }
-
- private static Map instances = new HashMap();
-
- /**
- * Return an instance of FileIPRangeManager
- * @param mgr The accreditable manager.
- * @param configurationDirectory a directory
- * @param logger The logger.
- * @return an <code>IPRangeManager</code> value
- * @exception AccessControlException if an error occurs
- */
- public static FileIPRangeManager instance(AccreditableManager mgr, File configurationDirectory, Logger logger)
- throws AccessControlException {
-
- assert configurationDirectory != null;
- if (!configurationDirectory.isDirectory()) {
- throw new AccessControlException("Configuration directory [" + configurationDirectory
- + "] does not exist!");
- }
-
- if (!instances.containsKey(configurationDirectory)) {
- FileIPRangeManager manager = new FileIPRangeManager(mgr);
- manager.enableLogging(logger);
- manager.configure(configurationDirectory);
- instances.put(configurationDirectory, manager);
- }
-
- return (FileIPRangeManager) instances.get(configurationDirectory);
- }
-
- /**
- * Get all IP ranges.
- * @return an array of IP ranges.
- */
- public IPRange[] getIPRanges() {
- Item[] items = super.getItems();
- IPRange[] ranges = new IPRange[items.length];
- for (int i = 0; i < ranges.length; i++) {
- ranges[i] = (IPRange) items[i];
- }
- return ranges;
- }
-
- public IPRange add(String id) throws AccessControlException {
- IPRange range = new FileIPRange(this, getLogger(), id);
- super.add(range);
- return range;
- }
-
- /**
- * Remove the given IP range
- * @param range IP range that is to be removed
- * @throws AccessControlException when the notification failed.
- */
- public void remove(IPRange range) throws AccessControlException {
- super.remove(range);
- }
-
- /**
- * Get the IPRange with the given id.
- * @param rangeId user id of requested IP range
- * @return the requested IP range or null if there is no IP range with the given id
- */
- public IPRange getIPRange(String rangeId) {
- return (IPRange) getItem(rangeId);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileItemManager.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileItemManager.java
deleted file mode 100644
index e2dc1f8..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileItemManager.java
+++ /dev/null
@@ -1,497 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-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 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.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.Groupable;
-import org.apache.lenya.ac.Item;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.ItemManagerListener;
-import org.apache.lenya.ac.impl.ItemConfiguration;
-
-/**
- * Abstract superclass for classes that manage items loaded from configuration
- * files.
- */
-public abstract class FileItemManager extends AbstractLogEnabled implements ItemManager {
-
- private Map items = new HashMap();
- private File configurationDirectory;
- private DirectoryChangeNotifier notifier;
-
- private AccreditableManager accreditableManager;
-
- /**
- * Create a new ItemManager.
- * @param accreditableManager The {@link AccreditableManager}.
- */
- protected FileItemManager(AccreditableManager accreditableManager) {
- this.accreditableManager = accreditableManager;
- }
-
- /**
- * Configures the item manager.
- * @param _configurationDirectory where the items are fetched from
- * @throws AccessControlException if the item manager cannot be instantiated
- */
- public void configure(File _configurationDirectory) throws AccessControlException {
- assert _configurationDirectory != null;
-
- if (!_configurationDirectory.exists() || !_configurationDirectory.isDirectory()) {
- throw new AccessControlException("The directory ["
- + _configurationDirectory.getAbsolutePath() + "] does not exist!");
- }
-
- this.configurationDirectory = _configurationDirectory;
- this.notifier = new DirectoryChangeNotifier(_configurationDirectory, getFileFilter());
- this.notifier.enableLogging(getLogger());
- loadItems();
- }
-
- /**
- * Reloads the items if an item was changed / added / removed.
- * @throws AccessControlException when something went wrong.
- */
- protected void loadItems() throws AccessControlException {
-
- boolean changed;
- try {
- changed = this.notifier.hasChanged();
- } catch (IOException e) {
- throw new AccessControlException(e);
- }
-
- if (changed) {
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Item configuration has changed - reloading.");
- }
-
- File[] addedFiles = this.notifier.getAddedFiles();
-
- for (int i = 0; i < addedFiles.length; i++) {
- Item item = loadItem(addedFiles[i]);
- add(item);
- }
-
- File[] removedFiles = this.notifier.getRemovedFiles();
- for (int i = 0; i < removedFiles.length; i++) {
- String fileName = removedFiles[i].getName();
- String id = fileName.substring(0, fileName.length() - getSuffix().length());
-
- Item item = (Item) this.items.get(id);
-
- if (item != null) {
-
- if (item instanceof Groupable) {
- ((Groupable) item).removeFromAllGroups();
- }
- if (item instanceof Group) {
- ((Group) item).removeAllMembers();
- }
-
- remove(item);
- }
- }
-
- File[] changedFiles = this.notifier.getChangedFiles();
- for (int i = 0; i < changedFiles.length; i++) {
- Item item = loadItem(changedFiles[i]);
- update(item);
- }
-
- }
-
- }
-
- /**
- * Loads an item from a file.
- * @param file The file.
- * @return An item.
- * @throws AccessControlException when something went wrong.
- */
- protected Item loadItem(File file) throws AccessControlException {
- Configuration config = getItemConfiguration(file);
-
- String fileName = file.getName();
- String id = fileName.substring(0, fileName.length() - getSuffix().length());
- Item item = (Item) this.items.get(id);
-
- String klass = ItemConfiguration.getItemClass(config);
- if (item == null) {
- try {
- Class[] paramTypes = { ItemManager.class, Logger.class };
- Constructor ctor = Class.forName(klass).getConstructor(paramTypes);
- Object[] params = { this, getLogger() };
- item = (Item) ctor.newInstance(params);
- } catch (Exception e) {
- String errorMsg = "Exception when trying to instanciate: " + klass
- + " with exception: " + e.fillInStackTrace();
-
- // an exception occured when trying to instanciate
- // a user.
- getLogger().error(errorMsg);
- throw new AccessControlException(errorMsg, e);
- }
- }
-
- try {
- item.configure(config);
- } catch (ConfigurationException e) {
- String errorMsg = "Exception when trying to configure: " + klass;
- throw new AccessControlException(errorMsg, e);
- }
- return item;
- }
-
- /**
- * Loads teh configuration of an item from a file.
- * @param file The file.
- * @return A configuration.
- * @throws AccessControlException when something went wrong.
- */
- protected Configuration getItemConfiguration(File file) throws AccessControlException {
- DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
- Configuration config = null;
-
- try {
- assert file.exists();
- config = builder.buildFromFile(file);
- } catch (Exception e) {
- String errorMsg = "Exception when reading the configuration from file: "
- + file.getName();
-
- // an exception occured when trying to read the configuration
- // from the identity file.
- getLogger().error(errorMsg);
- throw new AccessControlException(errorMsg, e);
- }
- return config;
- }
-
- protected void removeItem(File file) {
- // do nothing
- }
-
- /**
- * Returns an item for a given ID.
- * @param id The id.
- * @return An item.
- */
- public Item getItem(String id) {
- try {
- loadItems();
- } catch (AccessControlException e) {
- throw new IllegalStateException(e.getMessage());
- }
- return (Item) this.items.get(id);
- }
-
- /**
- * get all items
- * @return an array of items
- */
- public Item[] getItems() {
- try {
- loadItems();
- } catch (AccessControlException e) {
- throw new IllegalStateException(e.getMessage());
- }
- return (Item[]) this.items.values().toArray(new Item[this.items.values().size()]);
- }
-
- /**
- * Add an Item to this manager
- * @param item to be added
- * @throws AccessControlException when the notification threw this
- * exception.
- */
- public void add(Item item) throws AccessControlException {
- assert item != null;
- this.items.put(item.getId(), item);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Item [" + item + "] added.");
- }
- notifyAdded(item);
- }
-
- /**
- * Remove an item from this manager
- * @param item to be removed
- * @throws AccessControlException when the notification threw this
- * exception.
- */
- public void remove(Item item) throws AccessControlException {
- this.items.remove(item.getId());
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Item [" + item + "] removed.");
- }
- notifyRemoved(item);
- }
-
- /**
- * Update an item.
- * @param newItem The new version of the item.
- * @throws AccessControlException when the notification threw this
- * exception.
- */
- public void update(Item newItem) throws AccessControlException {
- this.items.remove(newItem.getId());
- this.items.put(newItem.getId(), newItem);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Item [" + newItem + "] updated.");
- }
- }
-
- /**
- * Returns if the ItemManager contains an object.
- * @param item The object.
- * @return A boolean value.
- */
- public boolean contains(Item item) {
- try {
- loadItems();
- } catch (AccessControlException e) {
- throw new IllegalStateException(e.getMessage());
- }
- return this.items.containsValue(item);
- }
-
- /**
- * Get the directory where the items are located.
- * @return a <code>File</code>
- */
- public File getConfigurationDirectory() {
- return this.configurationDirectory;
- }
-
- /**
- * Get a file filter which filters for files containing items.
- * @return a <code>FileFilter</code>
- */
- protected FileFilter getFileFilter() {
- FileFilter filter = new FileFilter() {
- public boolean accept(File pathname) {
- return (pathname.getName().endsWith(getSuffix()));
- }
- };
-
- return filter;
- }
-
- /**
- * Returns the file extension to be used.
- * @return A string.
- */
- protected abstract String getSuffix();
-
- private List itemManagerListeners = new ArrayList();
-
- /**
- * Attaches an item manager listener to this item manager.
- * @param listener An item manager listener.
- */
- public void addItemManagerListener(ItemManagerListener listener) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Adding listener: [" + listener + "]");
- }
- if (!this.itemManagerListeners.contains(listener)) {
- this.itemManagerListeners.add(listener);
- }
- }
-
- /**
- * Removes an item manager listener from this item manager.
- * @param listener An item manager listener.
- */
- public void removeItemManagerListener(ItemManagerListener listener) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Removing listener: [" + listener + "]");
- }
- this.itemManagerListeners.remove(listener);
- }
-
- /**
- * Notifies the listeners that an item was added.
- * @param item The item that was added.
- * @throws AccessControlException if an error occurs.
- */
- protected void notifyAdded(Item item) throws AccessControlException {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Item was added: [" + item + "]");
- }
- List clone = new ArrayList(this.itemManagerListeners);
- for (Iterator i = clone.iterator(); i.hasNext();) {
- ItemManagerListener listener = (ItemManagerListener) i.next();
- listener.itemAdded(item);
- }
- }
-
- /**
- * Notifies the listeners that an item was removed.
- * @param item The item that was removed.
- * @throws AccessControlException if an error occurs.
- */
- protected void notifyRemoved(Item item) throws AccessControlException {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Item was removed: [" + item + "]");
- }
- List clone = new ArrayList(this.itemManagerListeners);
- for (Iterator i = clone.iterator(); i.hasNext();) {
- ItemManagerListener listener = (ItemManagerListener) i.next();
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Notifying listener: [" + listener + "]");
- }
- listener.itemRemoved(item);
- }
- }
-
- /**
- * Helper class to observe a directory for changes.
- */
- public static class DirectoryChangeNotifier extends AbstractLogEnabled {
-
- /**
- * Ctor.
- * @param _directory The directory to observe.
- * @param _filter A filter to specify the file type to observe.
- */
- public DirectoryChangeNotifier(File _directory, FileFilter _filter) {
- this.directory = _directory;
- this.filter = _filter;
- }
-
- private File directory;
- private FileFilter filter;
- private Map canonicalPath2LastModified = new HashMap();
-
- private Set addedFiles = new HashSet();
- private Set removedFiles = new HashSet();
- private Set changedFiles = new HashSet();
-
- /**
- * Checks if the directory has changed (a new file was added, a file was
- * removed, a file has changed).
- * @return A boolean value.
- * @throws IOException when something went wrong.
- */
- public boolean hasChanged() throws IOException {
-
- this.addedFiles.clear();
- this.removedFiles.clear();
- this.changedFiles.clear();
-
- File[] files = this.directory.listFiles(this.filter);
-
- Set newPathSet = new HashSet();
-
- for (int i = 0; i < files.length; i++) {
- String canonicalPath = files[i].getCanonicalPath();
- newPathSet.add(canonicalPath);
-
- if (!this.canonicalPath2LastModified.containsKey(canonicalPath)) {
- this.addedFiles.add(new File(canonicalPath));
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("New file: [" + canonicalPath + "]");
- }
-
- } else {
- Long lastModifiedObject = (Long) this.canonicalPath2LastModified
- .get(canonicalPath);
- long lastModified = lastModifiedObject.longValue();
- if (lastModified < files[i].lastModified()) {
- this.changedFiles.add(files[i]);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("File has changed: [" + canonicalPath + "]");
- }
- }
- }
- Long lastModified = new Long(files[i].lastModified());
- this.canonicalPath2LastModified.put(canonicalPath, lastModified);
- }
-
- Set oldPathSet = this.canonicalPath2LastModified.keySet();
- String[] oldPaths = (String[]) oldPathSet.toArray(new String[oldPathSet.size()]);
- for (int i = 0; i < oldPaths.length; i++) {
- if (!newPathSet.contains(oldPaths[i])) {
- this.removedFiles.add(new File(oldPaths[i]));
- this.canonicalPath2LastModified.remove(oldPaths[i]);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("File removed: [" + oldPaths[i] + "]");
- }
- }
- }
-
- return !this.addedFiles.isEmpty() || !this.removedFiles.isEmpty()
- || !this.changedFiles.isEmpty();
- }
-
- /**
- * Returns the added files.
- * @return An array of files.
- */
- public File[] getAddedFiles() {
- return (File[]) this.addedFiles.toArray(new File[this.addedFiles.size()]);
- }
-
- /**
- * Returns the removed files.
- * @return An array of files.
- */
- public File[] getRemovedFiles() {
- return (File[]) this.removedFiles.toArray(new File[this.removedFiles.size()]);
- }
-
- /**
- * Returns the changed files.
- * @return An array of files.
- */
- public File[] getChangedFiles() {
- return (File[]) this.changedFiles.toArray(new File[this.changedFiles.size()]);
- }
-
- }
-
- public AccreditableManager getAccreditableManager() {
- return this.accreditableManager;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FilePolicyManager.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FilePolicyManager.java
deleted file mode 100644
index cedcf4d..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FilePolicyManager.java
+++ /dev/null
@@ -1,544 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-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.util.NetUtils;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.SourceUtil;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Credential;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.InheritingPolicyManager;
-import org.apache.lenya.ac.ModifiablePolicy;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.cache.CachingException;
-import org.apache.lenya.ac.cache.SourceCache;
-import org.apache.lenya.ac.impl.CredentialImpl;
-import org.apache.lenya.ac.impl.DefaultPolicy;
-import org.apache.lenya.ac.impl.PolicyBuilder;
-import org.apache.lenya.ac.impl.RemovedAccreditablePolicyBuilder;
-import org.apache.lenya.ac.impl.URLPolicy;
-import org.apache.lenya.xml.DocumentHelper;
-import org.w3c.dom.Document;
-
-/**
- * A PolicyBuilder is used to build policies.
- */
-public class FilePolicyManager extends AbstractLogEnabled implements InheritingPolicyManager,
- Parameterizable, Disposable, Serviceable {
-
- private static final class SubtreeFileFilter implements FileFilter {
-
- private final String subtree;
-
- private SubtreeFileFilter(String _subtree) {
- super();
- this.subtree = _subtree;
- }
-
- /**
- * @see java.io.FileFilter#accept(java.io.File)
- */
- public boolean accept(File file) {
- return file.getName().equals(this.subtree);
- }
- }
-
- private static final class IsDirectoryFileFilter implements FileFilter {
- /**
- * @see java.io.FileFilter#accept(java.io.File)
- */
- public boolean accept(File file) {
- return file.isDirectory();
- }
- }
-
- /**
- * Creates a new FilePolicyManager.
- */
- public FilePolicyManager() {
- // do nothing
- }
-
- /**
- * Returns the source cache.
- *
- * @return A source cache.
- */
- protected SourceCache getCache() {
- return this.cache;
- }
-
- private SourceCache cache;
-
- protected static final String SUBTREE_FILENAME = "subtree-policy.acml";
-
- /**
- * Builds a subtree policy from a file. When the file is not present, an
- * empty policy is returned.
- *
- * @param controller The access controller to use.
- * @param url The URL inside the web application.
- * @return A policy.
- * @throws AccessControlException when something went wrong.
- */
- public Policy buildSubtreePolicy(AccreditableManager controller, String url)
- throws AccessControlException {
- return buildPolicy(controller, url, SUBTREE_FILENAME);
- }
-
- /**
- * Builds a policy from a file. When the file is not present, an empty
- * policy is returned.
- *
- * @param controller The access controller to use.
- * @param url The url.
- * @param policyFilename The policy filename.
- * @return A policy.
- * @throws AccessControlException when something went wrong.
- */
- protected DefaultPolicy buildPolicy(AccreditableManager controller, String url,
- String policyFilename) throws AccessControlException {
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Building policy for URL [" + url + "]");
- }
-
- DefaultPolicy policy = null;
-
- String policyUri = getPolicySourceURI(url, policyFilename);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Policy source URI resolved to: " + policyUri);
- }
-
- try {
- PolicyBuilder builder = new PolicyBuilder(controller);
- policy = (DefaultPolicy) getCache().get(policyUri, builder);
- } catch (CachingException e) {
- throw new AccessControlException(e);
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Policy exists: [" + (policy != null) + "]");
- }
-
- if (policy == null) {
- policy = new DefaultPolicy();
- }
- return policy;
- }
-
- /**
- * Returns the policy file URI for a URL and a policy filename.
- *
- * @param url The url to get the file for.
- * @param policyFilename The name of the policy file.
- * @return A String.
- * @throws AccessControlException if an error occurs
- */
- protected String getPolicySourceURI(String url, String policyFilename)
- throws AccessControlException {
- if (url.startsWith("/")) {
- url = url.substring(1);
- }
-
- // remove publication ID
- if (url.indexOf("/") > -1) {
- url = url.substring(url.indexOf("/") + 1);
- }
- else {
- url = "";
- }
-
- final String policyUri = this.policiesDirectoryUri + "/" + url + "/" + policyFilename;
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Computing policy URI [" + policyUri + "]");
- }
- return policyUri;
- }
-
- /**
- * Returns the policy file for a certain URL.
- *
- * @param url The URL to get the policy for.
- * @param policyFilename The policy filename.
- * @return A file.
- * @throws AccessControlException when an error occurs.
- */
- protected File getPolicyFile(String url, String policyFilename) throws AccessControlException {
- String fileUri = getPolicySourceURI(url, policyFilename);
- SourceResolver resolver = null;
- Source source = null;
- try {
- resolver = (SourceResolver) this.serviceManager.lookup(SourceResolver.ROLE);
- source = resolver.resolveURI(fileUri);
- return SourceUtil.getFile(source);
- } catch (final Exception e) {
- throw new AccessControlException(e);
- }
- finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- this.serviceManager.release(resolver);
- }
- }
- }
-
- /**
- * Saves a Subtree policy.
- *
- * @param url The url to save the policy for.
- * @param policy The policy to save.
- * @throws AccessControlException when something went wrong.
- */
- public void saveSubtreePolicy(String url, Policy policy) throws AccessControlException {
- getLogger().debug("Saving subtree policy for URL [" + url + "]");
- savePolicy(url, policy, SUBTREE_FILENAME);
- }
-
- /**
- * Saves a policy to a file.
- *
- * @param url The URL to save the policy for.
- * @param policy The policy.
- * @param filename The file.
- * @throws AccessControlException if something goes wrong.
- */
- protected void savePolicy(String url, Policy policy, String filename)
- throws AccessControlException {
-
- File file = getPolicyFile(url, filename);
- savePolicy(policy, file);
- }
-
- /**
- * Saves a policy to a file.
- *
- * @param policy The policy to save.
- * @param file The file.
- * @throws AccessControlException when an error occurs.
- */
- protected void savePolicy(Policy policy, File file) throws AccessControlException {
- Document document = PolicyBuilder.savePolicy(policy);
-
- try {
- if (!file.exists()) {
- file.getParentFile().mkdirs();
- if (!file.createNewFile()) {
- throw new AccessControlException("File [" + file + "] could not be created.");
- }
- }
- DocumentHelper.writeDocument(document, file);
- } catch (AccessControlException e) {
- throw e;
- } catch (Exception e) {
- throw new AccessControlException("Path: [" + file.getAbsolutePath() + "]", e);
- }
- }
-
- /**
- * @see org.apache.lenya.ac.PolicyManager#getPolicy(org.apache.lenya.ac.AccreditableManager,
- * java.lang.String)
- */
- public Policy getPolicy(AccreditableManager controller, String url)
- throws AccessControlException {
-
- return new URLPolicy(controller, url, this);
- }
-
- protected static final String DIRECTORY_PARAMETER = "directory";
-
- private String policiesDirectoryUri;
-
- private File policiesDirectory;
-
- /**
- * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
- */
- public void parameterize(Parameters parameters) throws ParameterException {
- if (parameters.isParameter(DIRECTORY_PARAMETER)) {
- this.policiesDirectoryUri = parameters.getParameter(DIRECTORY_PARAMETER);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Policies directory URI: " + this.policiesDirectoryUri);
- }
- }
- }
-
- /**
- * Get the path to the policies directory.
- *
- * @return the path to the policies directory
- * @throws AccessControlException if an error occurs
- */
- public File getPoliciesDirectory() throws AccessControlException {
-
- if (this.policiesDirectory == null) {
- SourceResolver resolver = null;
- Source source = null;
- File directory;
-
- try {
- resolver = (SourceResolver) getServiceManager().lookup(SourceResolver.ROLE);
- source = resolver.resolveURI(this.policiesDirectoryUri);
- getLogger().debug("Policies directory source: [" + source.getURI() + "]");
- directory = new File(new URI(NetUtils.encodePath(source.getURI())));
- } catch (final Exception e) {
- throw new AccessControlException("Resolving policies directory failed: ", e);
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- getServiceManager().release(resolver);
- }
- }
-
- getLogger().debug(
- "Policies directory resolved to [" + directory.getAbsolutePath() + "]");
- setPoliciesDirectory(directory);
- }
-
- return this.policiesDirectory;
- }
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager manager) throws ServiceException {
- this.serviceManager = manager;
- this.cache = (SourceCache) manager.lookup(SourceCache.ROLE);
- }
-
- /**
- * Sets the policies directory.
- *
- * @param directory The directory.
- * @throws AccessControlException if the directory is not a directory
- */
- public void setPoliciesDirectory(File directory) throws AccessControlException {
- getLogger().debug("Setting policies directory [" + directory.getAbsolutePath() + "]");
- if (!directory.isDirectory()) {
- throw new AccessControlException("Policies directory invalid: ["
- + directory.getAbsolutePath() + "]");
- }
- this.policiesDirectory = directory;
- }
-
- /**
- * @see org.apache.lenya.ac.InheritingPolicyManager#getPolicies(org.apache.lenya.ac.AccreditableManager,
- * java.lang.String)
- */
- public Policy[] getPolicies(AccreditableManager controller, String url)
- throws AccessControlException {
-
- if (!url.startsWith("/")) {
- throw new IllegalArgumentException("The URL [" + url + "] doesn't start with a slash!");
- }
-
- url = url.substring(1);
-
- List policies = new LinkedList();
- HashMap orderedPolicies = new LinkedHashMap();
- int position = 1;
- Policy policy;
- String[] directories = url.split("/");
- url = directories[0] + "/";
-
- for (int i = 1; i < directories.length; i++) {
- url += directories[i] + "/";
- policy = buildSubtreePolicy(controller, url);
- orderedPolicies.put(String.valueOf(position), policy);
- position++;
- }
- for (int i = orderedPolicies.size(); i > 0; i--) {
- policies.add(orderedPolicies.get(String.valueOf(i)));
- }
- return (DefaultPolicy[]) policies.toArray(new DefaultPolicy[policies.size()]);
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
-
- if (getCache() != null) {
- getServiceManager().release(getCache());
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Disposing [" + this + "]");
- }
- }
-
- /**
- * Removes an accreditable from all policies within a certain directory
- * tree.
- *
- * @param manager The accreditable manager which owns the accreditable.
- * @param accreditable The accreditable to remove.
- * @param policyDirectory The directory where the policies are located.
- * @throws AccessControlException when an error occurs.
- */
- protected void removeAccreditable(AccreditableManager manager, Accreditable accreditable,
- File policyDirectory) throws AccessControlException {
-
- File[] policyFiles = policyDirectory.listFiles(new SubtreeFileFilter(SUBTREE_FILENAME));
-
- try {
- RemovedAccreditablePolicyBuilder builder = new RemovedAccreditablePolicyBuilder(manager);
- builder.setRemovedAccreditable(accreditable);
- for (int i = 0; i < policyFiles.length; i++) {
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Removing roles");
- getLogger().debug(" Accreditable: [" + accreditable + "]");
- getLogger().debug(
- " File: [" + policyFiles[i].getAbsolutePath() + "]");
- }
-
- InputStream stream = new FileInputStream(policyFiles[i]);
- ModifiablePolicy policy = builder.buildPolicy(stream);
- policy.removeRoles(accreditable);
- savePolicy(policy, policyFiles[i]);
- }
- } catch (final FileNotFoundException e1) {
- throw new AccessControlException(e1);
- }
-
- File[] directories = policyDirectory.listFiles(new IsDirectoryFileFilter());
-
- for (int i = 0; i < directories.length; i++) {
- removeAccreditable(manager, accreditable, directories[i]);
- }
-
- }
-
- /**
- * @see org.apache.lenya.ac.PolicyManager#accreditableRemoved(org.apache.lenya.ac.AccreditableManager,
- * org.apache.lenya.ac.Accreditable)
- */
- public void accreditableRemoved(AccreditableManager manager, Accreditable accreditable)
- throws AccessControlException {
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("An accreditable was removed: [" + accreditable + "]");
- }
-
- removeAccreditable(manager, accreditable, getPoliciesDirectory());
- }
-
- private ServiceManager serviceManager;
-
- /**
- * Returns the service manager.
- *
- * @return A service manager.
- */
- protected ServiceManager getServiceManager() {
- return this.serviceManager;
- }
-
- /**
- * @see org.apache.lenya.ac.PolicyManager#accreditableAdded(org.apache.lenya.ac.AccreditableManager,
- * org.apache.lenya.ac.Accreditable)
- */
- public void accreditableAdded(AccreditableManager manager, Accreditable accreditable)
- throws AccessControlException {
- }
-
- public Credential[] getCredentials(AccreditableManager controller, String url)
- throws AccessControlException {
-
- if (!url.startsWith("/")) {
- throw new IllegalArgumentException("The URL [" + url + "] doesn't start with a slash!");
- }
-
- url = url.substring(1);
-
- HashMap orderedCredential = new LinkedHashMap();
- int position = 1;
-
- String[] directories = url.split("/");
- url = directories[0] + "/";
-
- for (int i = 1; i < directories.length; i++) {
- url += directories[i] + "/";
- Policy policy = buildSubtreePolicy(controller, url);
- Credential[] tmp = policy.getCredentials();
- // we need to revert the order of the credentials
- // to keep the most important policy on top
- for (int j = tmp.length - 1; j >= 0; j--) {
- Credential credential = tmp[j];
- orderedCredential.put(String.valueOf(position), credential);
- position++;
- }
- }
- Credential[] returnCredential = new CredentialImpl[orderedCredential.size()];
- int y = 0;
- for (int i = orderedCredential.size(); i > 0; i--) {
- returnCredential[y] = (Credential) orderedCredential.get(String.valueOf(i));
- y++;
- }
-
- return returnCredential;
- }
-
- public Role[] getGrantedRoles(AccreditableManager accreditableManager, Identity identity,
- String url) throws AccessControlException {
- Role[] roles = accreditableManager.getRoleManager().getRoles();
- Set grantedRoles = new HashSet();
- Policy policy = getPolicy(accreditableManager, url);
- for (int i = 0; i < roles.length; i++) {
- if (policy.check(identity, roles[i]) == Policy.RESULT_GRANTED) {
- grantedRoles.add(roles[i]);
- }
- }
- return (Role[]) grantedRoles.toArray(new Role[grantedRoles.size()]);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileRole.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileRole.java
deleted file mode 100644
index d826f1d..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileRole.java
+++ /dev/null
@@ -1,122 +0,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.
- *
- */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfiguration;
-import org.apache.avalon.framework.configuration.DefaultConfigurationSerializer;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Item;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.impl.AbstractRole;
-import org.apache.lenya.ac.impl.ItemConfiguration;
-
-/**
- * File-based role implementation.
- * @version $Id$
- */
-public class FileRole extends AbstractRole implements Item {
-
- protected static final String ATTR_ASSIGNABLE = "assignable";
-
- /**
- * Creates a new file role.
- * @param itemManager The item manager.
- * @param logger The logger.
- * @param id The role ID.
- */
- public FileRole(ItemManager itemManager, Logger logger, String id) {
- this(itemManager, logger);
- setId(id);
- }
-
- protected static final String ROLE = "role";
-
- /**
- * Creates a new FileRole object.
- * @param itemManager The item manager.
- * @param logger The logger.
- */
- public FileRole(ItemManager itemManager, Logger logger) {
- super(itemManager, logger);
- FileItemManager fileItemManager = (FileItemManager) itemManager;
- setConfigurationDirectory(fileItemManager.getConfigurationDirectory());
- }
-
- /**
- * Configure this instance of <code>FileRole</code>
- * @param config containing the role details
- * @throws ConfigurationException if the <code>FileRole</code> could not
- * be configured
- */
- public void configure(Configuration config) throws ConfigurationException {
- new ItemConfiguration().configure(this, config);
- this.isAssignable = config.getAttributeAsBoolean(ATTR_ASSIGNABLE, true);
- }
-
- /**
- * Save the role
- * @throws AccessControlException if the save fails
- */
- public void save() throws AccessControlException {
- DefaultConfigurationSerializer serializer = new DefaultConfigurationSerializer();
- Configuration config = createConfiguration();
- File xmlPath = getConfigurationDirectory();
- File xmlfile = new File(xmlPath, getId() + FileRoleManager.SUFFIX);
-
- try {
- serializer.serializeToFile(xmlfile, config);
- } catch (Exception e) {
- throw new AccessControlException(e);
- }
- }
-
- /**
- * Create a configuration containing the role details
- * @return a <code>Configuration</code>
- */
- private Configuration createConfiguration() {
- DefaultConfiguration config = new DefaultConfiguration(ROLE);
- new ItemConfiguration().save(this, config);
- return config;
- }
-
- private File configurationDirectory;
- private boolean isAssignable;
-
- /**
- * Returns the configuration directory.
- * @return A file object.
- */
- public File getConfigurationDirectory() {
- return this.configurationDirectory;
- }
-
- protected void setConfigurationDirectory(File file) {
- this.configurationDirectory = file;
- }
-
- public boolean isAssignable() {
- return this.isAssignable;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileRoleManager.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileRoleManager.java
deleted file mode 100644
index eb9042d..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileRoleManager.java
+++ /dev/null
@@ -1,119 +0,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.
- *
- */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Item;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.RoleManager;
-
-/**
- * File-based role manager implementation.
- * @version $Id$
- */
-public final class FileRoleManager extends FileItemManager implements RoleManager {
- protected static final String SUFFIX = ".rml";
- private static Map instances = new HashMap();
-
- /**
- * Return the <code>RoleManager</code> for this configuration directory. The
- * <code>RoleManager</code> is a singleton.
- * @param mgr The accreditable manager.
- */
- protected FileRoleManager(AccreditableManager mgr) {
- super(mgr);
- }
-
- /**
- * Returns the role manager for this configuration directory.
- * @param mgr The accreditable manager.
- * @param configurationDirectory The configuration directory.
- * @param logger The logger.
- * @return A role manager.
- * @throws AccessControlException when something went wrong.
- */
- public static FileRoleManager instance(AccreditableManager mgr, File configurationDirectory, Logger logger)
- throws AccessControlException {
- if (!instances.containsKey(configurationDirectory)) {
- FileRoleManager manager = new FileRoleManager(mgr);
- manager.enableLogging(logger);
- manager.configure(configurationDirectory);
- instances.put(configurationDirectory, manager);
- }
-
- return (FileRoleManager) instances.get(configurationDirectory);
- }
-
- /**
- * Get the role for the given ID.
- * @param roleId The name of the role requested.
- * @return a <code>Role</code> or null if no role with the given name found
- */
- public Role getRole(String roleId) {
- return (Role) getItem(roleId);
- }
-
- /**
- * @see org.apache.lenya.ac.file.FileItemManager#getSuffix()
- */
- protected String getSuffix() {
- return SUFFIX;
- }
-
- /**
- * Get all roles
- * @return an array of roles.
- */
- public Role[] getRoles() {
- Item[] items = super.getItems();
- Role[] roles = new Role[items.length];
- for (int i = 0; i < roles.length; i++) {
- roles[i] = (Role) items[i];
- }
- return roles;
- }
-
- /**
- * Add a role
- * @param role The role to add.
- * @throws AccessControlException if an error occurs.
- */
- public void add(Role role) throws AccessControlException {
- super.add(role);
- }
-
- /**
- * Remove a role
- * @param role The role to remove.
- * @throws AccessControlException if an error occurs.
- */
- public void remove(Role role) throws AccessControlException {
- super.remove(role);
- }
-
- protected Item createItem() {
- return new FileRole(this, getLogger());
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileUser.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileUser.java
deleted file mode 100644
index 0670bce..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileUser.java
+++ /dev/null
@@ -1,223 +0,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.
- *
- */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-import java.io.Serializable;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfiguration;
-import org.apache.avalon.framework.configuration.DefaultConfigurationSerializer;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.GroupManager;
-import org.apache.lenya.ac.Item;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.impl.AbstractUser;
-import org.apache.lenya.ac.impl.ItemConfiguration;
-
-/**
- * File-based user implementation.
- * @version $Id$
- */
-public class FileUser extends AbstractUser implements Item, Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- protected static final String ID = "identity";
- protected static final String EMAIL = "email";
- protected static final String MENU_LOCALE = "default-menu-locale";
- protected static final String DOCUMENT_LOCALE = "default-document-locale";
- protected static final String PASSWORD = "password";
- protected static final String GROUPS = "groups";
- protected static final String GROUP = "group";
- protected static final String PASSWORD_ATTRIBUTE = "type";
-
- /**
- * Creates a new FileUser object.
- * @param itemManager The item manager.
- * @param logger The logger.
- */
- public FileUser(ItemManager itemManager, Logger logger) {
- super(itemManager, logger);
- FileItemManager fileItemManager = (FileItemManager) itemManager;
- setConfigurationDirectory(fileItemManager.getConfigurationDirectory());
- }
-
- /**
- * Create a FileUser
- * @param itemManager The item manager.
- * @param logger The logger.
- * @param id the user id
- * @param fullName the full name of the user
- * @param email the users email address
- * @param password the users password
- */
- public FileUser(ItemManager itemManager, Logger logger, String id, String fullName,
- String email, String password) {
- super(itemManager, logger, id, fullName, email, password);
- FileItemManager fileItemManager = (FileItemManager) itemManager;
- setConfigurationDirectory(fileItemManager.getConfigurationDirectory());
- }
-
- /**
- * Configure this FileUser.
- * @param config where the user details are specified
- * @throws ConfigurationException if the necessary details aren't specified
- * in the config
- */
- public void configure(Configuration config) throws ConfigurationException {
- new ItemConfiguration().configure(this, config);
- setEmail(config.getChild(EMAIL).getValue(""));
- setDefaultMenuLocale(config.getChild(MENU_LOCALE).getValue(""));
- setDefaultDocumentLocale(config.getChild(DOCUMENT_LOCALE).getValue(""));
- setEncryptedPassword(config.getChild(PASSWORD).getValue(null));
-
- removeFromAllGroups();
- Configuration[] groups = config.getChildren(GROUPS);
-
- if (groups.length == 1) {
- groups = groups[0].getChildren(GROUP);
-
- GroupManager manager;
- try {
- manager = getAccreditableManager().getGroupManager();
- } catch (AccessControlException e) {
- throw new ConfigurationException("configuration failed: ", e);
- }
-
- for (int i = 0; i < groups.length; i++) {
- String groupId = groups[i].getValue();
- Group group = manager.getGroup(groupId);
-
- if (group == null) {
- throw new ConfigurationException("Couldn't find Group for group name ["
- + groupId + "]");
- }
-
- if (!group.contains(this)) {
- group.add(this);
- }
-
- }
- } else {
- // strange, it should have groups
- getLogger().error("User " + getId() + " doesn't seem to have any groups");
- }
- }
-
- /**
- * Create a configuration from the current user details. Can be used for
- * saving.
- * @return a <code>Configuration</code>
- */
- protected Configuration createConfiguration() {
- DefaultConfiguration config = new DefaultConfiguration(ID);
- new ItemConfiguration().save(this, config);
-
- DefaultConfiguration child = null;
-
- // add email node
- child = new DefaultConfiguration(EMAIL);
- child.setValue(getEmail());
- config.addChild(child);
-
- // add defaultMenuLocale node
- child = new DefaultConfiguration(MENU_LOCALE);
- child.setValue(getDefaultMenuLocale());
- config.addChild(child);
-
- // add defaultDocumentLocale node
- child = new DefaultConfiguration(DOCUMENT_LOCALE);
- child.setValue(getDefaultDocumentLocale());
- config.addChild(child);
-
- // add password node
- child = new DefaultConfiguration(PASSWORD);
- child.setValue(getEncryptedPassword());
- child.setAttribute(PASSWORD_ATTRIBUTE, "md5");
- config.addChild(child);
-
- // add group nodes
- child = new DefaultConfiguration(GROUPS);
- config.addChild(child);
-
- Group[] groups = getGroups();
-
- for (int i = 0; i < groups.length; i++) {
- DefaultConfiguration groupNode = new DefaultConfiguration(GROUP);
- groupNode.setValue(groups[i].getId());
- child.addChild(groupNode);
- }
-
- return config;
- }
-
- /**
- * @see org.apache.lenya.ac.User#save()
- */
- public void save() throws AccessControlException {
- DefaultConfigurationSerializer serializer = new DefaultConfigurationSerializer();
- Configuration config = createConfiguration();
-
- try {
- serializer.serializeToFile(getFile(), config);
- } catch (Exception e) {
- throw new AccessControlException(e);
- }
- }
-
- /**
- * @see org.apache.lenya.ac.User#delete()
- */
- public void delete() throws AccessControlException {
- super.delete();
- getFile().delete();
- }
-
- /**
- * Returns the configuration file.
- * @return A file object.
- */
- protected File getFile() {
- File xmlPath = getConfigurationDirectory();
- File xmlFile = new File(xmlPath, getId() + FileUserManager.SUFFIX);
- return xmlFile;
- }
-
- private File configurationDirectory;
-
- /**
- * Returns the configuration directory.
- * @return A file object.
- */
- protected File getConfigurationDirectory() {
- return this.configurationDirectory;
- }
-
- protected void setConfigurationDirectory(File _configurationDirectory) {
- assert (_configurationDirectory != null) && _configurationDirectory.isDirectory();
- this.configurationDirectory = _configurationDirectory;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileUserManager.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileUserManager.java
deleted file mode 100644
index 0f97dbe..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/file/FileUserManager.java
+++ /dev/null
@@ -1,141 +0,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.
- *
- */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Item;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.UserManager;
-import org.apache.lenya.ac.UserType;
-
-/**
- * File-based user manager implementation.
- * @version $Id$
- */
-public class FileUserManager extends FileItemManager implements UserManager {
-
- private static Map instances = new HashMap();
- private Set userTypes;
-
- /**
- * Create a UserManager
- *
- * @param mgr The accreditable manager.
- * @param _userTypes The supported user types.
- * @throws AccessControlException if the UserManager could not be instantiated.
- */
- private FileUserManager(AccreditableManager mgr, UserType[] _userTypes)
- throws AccessControlException {
- super(mgr);
- this.userTypes = new HashSet(Arrays.asList(_userTypes));
- }
-
- /**
- * Describe <code>instance</code> method here.
- *
- * @param mgr The accreditable manager.
- * @param configurationDirectory a directory
- * @param userTypes The supported user types.
- * @param logger The logger.
- * @return an <code>UserManager</code> value
- * @exception AccessControlException if an error occurs
- */
- public static FileUserManager instance(AccreditableManager mgr, File configurationDirectory, UserType[] userTypes, Logger logger)
- throws AccessControlException {
-
- assert configurationDirectory != null;
- if (!configurationDirectory.isDirectory()) {
- throw new AccessControlException("Configuration directory [" + configurationDirectory
- + "] does not exist!");
- }
-
- if (!instances.containsKey(configurationDirectory)) {
- FileUserManager manager = new FileUserManager(mgr, userTypes);
- manager.enableLogging(logger);
- manager.configure(configurationDirectory);
- instances.put(configurationDirectory, manager);
- }
-
- return (FileUserManager) instances.get(configurationDirectory);
- }
-
- /**
- * Get all users.
- *
- * @return an Iterator to iterate over all users
- */
- public User[] getUsers() {
- Item[] items = super.getItems();
- User[] users = new User[items.length];
- for (int i = 0; i < users.length; i++) {
- users[i] = (User) items[i];
- }
- return users;
- }
-
- /**
- * @see org.apache.lenya.ac.UserManager#add(org.apache.lenya.ac.User)
- */
- public void add(User user) throws AccessControlException {
- super.add(user);
- }
-
- /**
- * @see org.apache.lenya.ac.UserManager#remove(org.apache.lenya.ac.User)
- */
- public void remove(User user) throws AccessControlException {
- super.remove(user);
- }
-
- /**
- * Get the user with the given user id.
- *
- * @param userId user id of requested user
- * @return the requested user or null if there is no user with the given user id
- */
- public User getUser(String userId) {
- return (User) getItem(userId);
- }
-
- /**
- * @see org.apache.lenya.ac.UserManager#getUserTypes()
- */
- public UserType[] getUserTypes() {
- return (UserType[]) this.userTypes.toArray(new UserType[this.userTypes.size()]);
- }
-
- protected static final String SUFFIX = ".iml";
-
- /**
- * @see org.apache.lenya.ac.file.FileItemManager#getSuffix()
- */
- protected String getSuffix() {
- return SUFFIX;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java
deleted file mode 100644
index d821b4b..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java
+++ /dev/null
@@ -1,146 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.AccessControllerResolver;
-import org.apache.lenya.ac.cache.URLKeyUtil;
-import org.apache.lenya.util.CacheMap;
-
-/**
- * Abstract implementation for access controller resolvers.
- * @version $Id$
- */
-public abstract class AbstractAccessControllerResolver
- extends AbstractLogEnabled
- implements AccessControllerResolver, Serviceable, ThreadSafe {
-
- protected static final int CAPACITY = 1000;
- private CacheMap cache;
-
- protected CacheMap getCache() {
- if (this.cache == null) {
- this.cache = new CacheMap(CAPACITY, getLogger());
- }
- return this.cache;
- }
-
- /**
- * @see org.apache.lenya.ac.AccessControllerResolver#resolveAccessController(java.lang.String)
- */
- public AccessController resolveAccessController(String webappUrl)
- throws AccessControlException {
-
- SourceResolver resolver = null;
- AccessController controller = null;
- Object key = null;
-
- try {
- resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);
- key = generateCacheKey(webappUrl, resolver);
- getLogger().debug("Access controller cache key: [" + key + "]");
-
- } catch (Exception e) {
- throw new AccessControlException(e);
- } finally {
- if (resolver != null) {
- getManager().release(resolver);
- }
- }
-
- CacheMap cache = getCache();
-
- synchronized (cache) {
- controller = (AccessController) cache.get(key);
- if (controller == null) {
- getLogger().debug("No access controller in cache.");
- controller = doResolveAccessController(webappUrl);
- cache.put(key, controller);
- } else {
- getLogger().debug("Getting access controller from cache.");
- }
- }
-
- return controller;
- }
-
- /**
- * Generates a cache key for the access controller.
- * @param webappUrl The webapp URL.
- * @param resolver The source resolver.
- * @return An object.
- * @throws AccessControlException when something went wrong.
- */
- protected Object generateCacheKey(String webappUrl, SourceResolver resolver)
- throws AccessControlException {
- Object key;
- try {
- key = URLKeyUtil.generateKey(resolver, webappUrl);
- } catch (Exception e) {
- throw new AccessControlException(e);
- }
- return key;
- }
-
- /**
- * The actual resolving method.
- * @param webappUrl The URL within the web application.
- * @return An access controller.
- * @throws AccessControlException when something went wrong.
- */
- protected abstract AccessController doResolveAccessController(String webappUrl)
- throws AccessControlException;
-
- /**
- * @see org.apache.lenya.ac.AccessControllerResolver#release(org.apache.lenya.ac.AccessController)
- */
- public void release(AccessController controller) {
- /*
- if (controller != null) {
- getManager().release(controller);
- }
- */
- }
-
- protected ServiceManager manager;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager _manager) throws ServiceException {
- getLogger().debug("Servicing [" + getClass().getName() + "]");
- this.manager = _manager;
- }
-
- /**
- * Returns the service manager of this Serviceable.
- * @return A service manager.
- */
- public ServiceManager getManager() {
- return this.manager;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractAccreditableManager.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractAccreditableManager.java
deleted file mode 100644
index 8a1282b..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractAccreditableManager.java
+++ /dev/null
@@ -1,209 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.GroupManager;
-import org.apache.lenya.ac.IPRangeManager;
-import org.apache.lenya.ac.Item;
-import org.apache.lenya.ac.ItemManagerListener;
-import org.apache.lenya.ac.RoleManager;
-import org.apache.lenya.ac.UserManager;
-
-/**
- * Abstract base class for accreditable managers.
- */
-public abstract class AbstractAccreditableManager
- extends AbstractLogEnabled
- implements AccreditableManager, ItemManagerListener {
-
- /**
- * @param logger The logger.
- */
- public AbstractAccreditableManager(Logger logger) {
- ContainerUtil.enableLogging(this, logger);
- }
-
- private UserManager userManager = null;
- private GroupManager groupManager = null;
- private IPRangeManager ipRangeManager = null;
- private RoleManager roleManager = null;
-
- private List itemManagerListeners = new ArrayList();
-
- /**
- * Attaches an item manager listener to this accreditable manager.
- * @param listener An item manager listener.
- */
- public void addItemManagerListener(ItemManagerListener listener) {
- if (!this.itemManagerListeners.contains(listener)) {
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Adding listener: [" + listener + "]");
- }
-
- this.itemManagerListeners.add(listener);
- }
- }
-
- /**
- * Removes an item manager listener from this accreditable manager.
- * @param listener An item manager listener.
- */
- public void removeItemManagerListener(ItemManagerListener listener) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Removing listener: [" + listener + "]");
- }
-
- this.itemManagerListeners.remove(listener);
- }
-
- /**
- * Notifies the listeners that an item was added.
- * @param item The item that was added.
- * @throws AccessControlException when a notified listener threw this exception.
- */
- protected void notifyAdded(Item item) throws AccessControlException {
- List clone = new ArrayList(this.itemManagerListeners);
- for (Iterator i = clone.iterator(); i.hasNext();) {
- ItemManagerListener listener = (ItemManagerListener) i.next();
- listener.itemAdded(item);
- }
- }
-
- /**
- * Notifies the listeners that an item was removed.
- * @param item The item that was removed.
- * @throws AccessControlException when a notified listener threw this exception.
- */
- protected void notifyRemoved(Item item) throws AccessControlException {
- List clone = new ArrayList(this.itemManagerListeners);
- for (Iterator i = clone.iterator(); i.hasNext();) {
- ItemManagerListener listener = (ItemManagerListener) i.next();
- listener.itemRemoved(item);
- }
- }
-
- /**
- * @see org.apache.lenya.ac.ItemManagerListener#itemAdded(org.apache.lenya.ac.Item)
- */
- public void itemAdded(Item item) throws AccessControlException {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Item was added: [" + item + "] - notifying listeners");
- }
- notifyAdded(item);
- }
-
- /**
- * @see org.apache.lenya.ac.ItemManagerListener#itemRemoved(org.apache.lenya.ac.Item)
- */
- public void itemRemoved(Item item) throws AccessControlException {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Item was removed: [" + item + "] - notifying listeners");
- }
- notifyRemoved(item);
- }
-
- /**
- * @see org.apache.lenya.ac.AccreditableManager#getUserManager()
- */
- public UserManager getUserManager() throws AccessControlException {
- if (this.userManager == null) {
- this.userManager = initializeUserManager();
- this.userManager.addItemManagerListener(this);
- }
- return this.userManager;
- }
-
- /**
- * @see org.apache.lenya.ac.AccreditableManager#getGroupManager()
- */
- public GroupManager getGroupManager() throws AccessControlException {
- if (this.groupManager == null) {
- this.groupManager = initializeGroupManager();
- this.groupManager.addItemManagerListener(this);
- }
- return this.groupManager;
- }
-
- /**
- * @see org.apache.lenya.ac.AccreditableManager#getRoleManager()
- */
- public RoleManager getRoleManager() throws AccessControlException {
- if (this.roleManager == null) {
- this.roleManager = initializeRoleManager();
- this.roleManager.addItemManagerListener(this);
- }
- return this.roleManager;
- }
-
- /**
- * @see org.apache.lenya.ac.AccreditableManager#getIPRangeManager()
- */
- public IPRangeManager getIPRangeManager() throws AccessControlException {
- if (this.ipRangeManager == null) {
- this.ipRangeManager = initializeIPRangeManager();
- this.ipRangeManager.addItemManagerListener(this);
- }
- return this.ipRangeManager;
- }
-
- /**
- * Initializes the group manager.
- *
- * @return A group manager.
- * @throws AccessControlException when something went wrong.
- */
- protected abstract GroupManager initializeGroupManager() throws AccessControlException;
-
- /**
- * Initializes the IP range manager.
- *
- * @return An IP range manager.
- * @throws AccessControlException when something went wrong.
- */
- protected abstract IPRangeManager initializeIPRangeManager() throws AccessControlException;
-
- /**
- * Initializes the role manager.
- *
- * @return A role manager.
- * @throws AccessControlException when something went wrong.
- */
- protected abstract RoleManager initializeRoleManager() throws AccessControlException;
-
- /**
- * Initializes the user manager.
- *
- * @return A user manager.
- * @throws AccessControlException when something went wrong.
- */
- protected abstract UserManager initializeUserManager() throws AccessControlException;
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractGroup.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractGroup.java
deleted file mode 100644
index 2f3e04b..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractGroup.java
+++ /dev/null
@@ -1,124 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.Groupable;
-import org.apache.lenya.ac.ItemManager;
-
-
-/**
- * A group is a set of {@link Groupable}s.
- */
-public abstract class AbstractGroup extends AbstractItem implements Accreditable, Group {
-
- /**
- * Creates a new group.
- * @param itemManager The item manager.
- * @param logger The logger.
- */
- public AbstractGroup(ItemManager itemManager, Logger logger) {
- super(itemManager, logger);
- }
-
- /**
- * Creates a new group.
- * @param itemManager The item manager.
- * @param logger The logger.
- * @param id The group ID.
- */
- public AbstractGroup(ItemManager itemManager, Logger logger, String id) {
- super(itemManager, logger);
- setId(id);
- }
-
- private Set members = new HashSet();
-
- /**
- * Returns the members of this group.
- * @return An array of {@link Groupable}s.
- */
- public Groupable[] getMembers() {
- return (Groupable[]) this.members.toArray(new Groupable[this.members.size()]);
- }
-
- /**
- * Adds a member to this group.
- * @param member The member to add.
- */
- public void add(Groupable member) {
- assert (member != null) && !this.members.contains(member);
- this.members.add(member);
- member.addedToGroup(this);
- }
-
- /**
- * Removes a member from this group.
- * @param member The member to remove.
- */
- public void remove(Groupable member) {
- assert (member != null) && this.members.contains(member);
- this.members.remove(member);
- member.removedFromGroup(this);
- }
-
- /**
- * Removes all members from this group.
- */
- public void removeAllMembers() {
- Groupable[] _members = getMembers();
- for (int i = 0; i < _members.length; i++) {
- remove(_members[i]);
- }
- }
-
- /**
- * Returns if this group contains this member.
- * @param member The member to check.
- * @return A boolean value.
- */
- public boolean contains(Groupable member) {
- return this.members.contains(member);
- }
-
- /**
- * @see org.apache.lenya.ac.Accreditable#getAccreditables()
- */
- public Accreditable[] getAccreditables() {
- Accreditable[] accreditables = { this };
- return accreditables;
- }
-
- /**
- * Delete a group
- * @throws AccessControlException if the delete failed
- */
- public void delete() throws AccessControlException {
- removeAllMembers();
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractGroupable.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractGroupable.java
deleted file mode 100644
index 4bf843d..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractGroupable.java
+++ /dev/null
@@ -1,101 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.Groupable;
-import org.apache.lenya.ac.ItemManager;
-
-/**
- * Abstract implementation for group members.
- * @version $Id$
- */
-public abstract class AbstractGroupable extends AbstractItem implements Groupable, Accreditable {
-
- /**
- * Ctor.
- * @param itemManager The item manager.
- * @param logger The logger.
- */
- public AbstractGroupable(ItemManager itemManager, Logger logger) {
- super(itemManager, logger);
- }
-
- private Set groups = new HashSet();
-
- /**
- * @see org.apache.lenya.ac.Groupable#addedToGroup(org.apache.lenya.ac.Group)
- */
- public void addedToGroup(Group group) {
- assert group != null;
- assert group.contains(this);
- this.groups.add(group);
- }
-
- /**
- * @see org.apache.lenya.ac.Groupable#removedFromGroup(org.apache.lenya.ac.Group)
- */
- public void removedFromGroup(Group group) {
- assert group != null;
- assert !group.contains(this);
- this.groups.remove(group);
- }
-
- /**
- * @see org.apache.lenya.ac.Groupable#getGroups()
- */
- public Group[] getGroups() {
- return (Group[]) this.groups.toArray(new Group[this.groups.size()]);
- }
-
- /**
- * Removes this groupable from all its groups.
- */
- public void removeFromAllGroups() {
- Group[] _groups = getGroups();
-
- for (int i = 0; i < _groups.length; i++) {
- _groups[i].remove(this);
- }
- }
-
- /**
- * @see org.apache.lenya.ac.Accreditable#getAccreditables()
- */
- public Accreditable[] getAccreditables() {
- Set accreditables = new HashSet();
- accreditables.add(this);
-
- Group[] _groups = getGroups();
-
- for (int i = 0; i < _groups.length; i++) {
- Accreditable[] groupAccreditables = _groups[i].getAccreditables();
- accreditables.addAll(Arrays.asList(groupAccreditables));
- }
-
- return (Accreditable[]) accreditables.toArray(new Accreditable[accreditables.size()]);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractIPRange.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractIPRange.java
deleted file mode 100644
index c60b91a..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractIPRange.java
+++ /dev/null
@@ -1,366 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import java.io.File;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.IPRange;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.Machine;
-import org.apache.lenya.net.InetAddressUtil;
-
-/**
- * <p>
- * A range of IP addresses, expressed by a network address and a subnet mask.
- * </p>
- * <p>
- * Note: this class does not enforce that the network address and the subnet mask have the same size
- * (i.e. either both IPv4 or both IPv6 addresses). If the the network address and subnet mask have
- * different sizes, the range does not contain any hosts, that is {@link #contains(Machine)} will
- * always return <code>false</code>.
- * </p>
- */
-public abstract class AbstractIPRange extends AbstractGroupable implements IPRange {
- /*
- * FIXME by zisch@dals.ch: Fixed this class for IPv6. However there are still some general
- * flaws, partly coming from the IPRange interface. A redesign of (Abstract/File)IPRange and
- * it's helper class org.apache.lenya.net.InetAddressUtil would be a good idea. Some problems of
- * this implementation are:
- * - The whole initialization seems flawed. Objects can be in an unitialized state and the
- * class seems not to be aware of this.
- * - Network-address and -mask can be set independently. Therefore it cannot be enforced that
- * these have the same size (i.e. that both are IPv4 or both are IPv6). This shows up in
- * InetAddressUtil.contains(...), where in a case of mismatch there is no good way to inform the
- * user about the problem. This should be done once when the AbstractIPRange object is
- * initialized.
- * - Unless this functionality would be needed by other parts of Lenya or external software
- * (which seems not to be the case ;-), InetAddressUtil should be removed (resp. deprecated)
- * altogether, because it's mostly an internal implementation detail of AbstractIPRange.
- * AbstractIPRange should implement the contains(...)-method internally to make use of the fact
- * that the network- addresses and -masks validity and compatibility has already been checked
- * when setting these. (Once the above problems have been fixed. ;-)
- * - Especially for IPv6 it would be nice to have the possibility to specify the netmask as the
- * number of bits (as in "::1/128" or "127.0.0.1/24").
- *
- * FIXME II (from the previous version): why are we in the business of implementing IP ranges??
- */
-
- /**
- * Ctor.
- * Initializes the the IP range with the local host (127.0.0.1/24 for IPv4, ::1/128 for IPv6).
- * @param itemManager The item manager.
- * @param logger The logger.
- */
- public AbstractIPRange(ItemManager itemManager, Logger logger) {
- super(itemManager, logger);
- try {
- this.networkAddress = InetAddress.getLocalHost();
- byte[] mask = null;
- int masklen = this.networkAddress.getAddress().length;
- if (masklen == 4) {
- /* IPv4: */
- /*
- * FIXME? by zisch@dals.ch: Should this be { -1, 0, 0, 0 }??
- */
- mask = new byte[] { -1, -1, -1, 0 };
- } else {
- /* IPv6 (and others ;-): */
- mask = new byte[masklen];
- Arrays.fill(mask, (byte) -1);
- }
- this.subnetMask = InetAddress.getByAddress(mask);
- } catch (UnknownHostException ignore) {
- /*
- * FIXME? by zisch@dals.ch: Is it safe to ignore the exception and just leave the
- * IPRange uninitialized!?
- */
- }
- }
-
- /**
- * Ctor.
- * @param itemManager The item manager.
- * @param logger The logger.
- * @param id The IP range ID.
- */
- public AbstractIPRange(ItemManager itemManager, Logger logger, String id) {
- super(itemManager, logger);
- setId(id);
- }
-
- private File configurationDirectory;
-
- /**
- * Returns the configuration directory.
- * @return A file object.
- */
- public File getConfigurationDirectory() {
- return this.configurationDirectory;
- }
-
- protected void setConfigurationDirectory(File _configurationDirectory) {
- this.configurationDirectory = _configurationDirectory;
- }
-
- /**
- * Save the IP range
- * @throws AccessControlException if the save failed
- */
- public abstract void save() throws AccessControlException;
-
- /**
- * Delete an IP range
- * @throws AccessControlException if the delete failed
- */
- public void delete() throws AccessControlException {
- removeFromAllGroups();
- }
-
- private InetAddress networkAddress;
-
- /**
- * Sets the network address. This method accepts numeric IPv4 addresses like
- * <code>"129.168.0.32"</code>, numeric IPv6 addresses like
- * <code>"1080::8:800:200C:417A"</code> as well as hostnames (if DNS resolution is available)
- * like <code>"localhost"</code> or <code>"www.apache.com"</code>.
- * @param address a <code>String</code> like <code>"192.168.0.32"</code>,
- * <code>"::1"</code>, ...
- * @throws AccessControlException when the conversion of the <code>String</code> to an
- * <code>InetAddress</code> failed
- * @see #setNetworkAddress(byte[])
- */
- public void setNetworkAddress(String address) throws AccessControlException {
- try {
- this.networkAddress = InetAddress.getByName(address);
- } catch (UnknownHostException e) {
- throw new AccessControlException("Failed to convert address [" + address + "]: ", e);
- }
- }
-
- /**
- * Sets the network address. The method accepts numeric IPv4 addresses (specified by byte arrays
- * of length 4) or IPv6 addresses (specified by byte arrays of length 16).
- * @param address a byte array of the length 4 or 16
- * @throws AccessControlException when the conversion of the byte array to an InetAddress
- * failed.
- * @see #setNetworkAddress(String)
- */
- public void setNetworkAddress(byte[] address) throws AccessControlException {
- try {
- this.networkAddress = InetAddress.getByAddress(address);
- } catch (UnknownHostException e) {
- throw new AccessControlException("Failed to convert address [" + addr2string(address)
- + "]: ", e);
- }
- }
-
- /**
- * Returns the network address.
- * @return an <code>InetAddress</code> representing the network address
- */
- public InetAddress getNetworkAddress() {
- return this.networkAddress;
- }
-
- private InetAddress subnetMask;
-
- /**
- * Sets the subnet mask. See {@link #setNetworkAddress(String)} for the allowed formats of the
- * <code>mask</code> string. (However, the hostname format will usually not be of much use for
- * setting the mask.)
- * <p>
- * Only valid subnet masks are accepted, for which the binary representation is a sequence of
- * 1-bits followed by a sequence of 0-bits. For example <code>"255.128.0.0"</code> is valid
- * while <code>"255.128.0.1"</code> is not.
- * @param mask a <code>String</code> like <code>"255.255.255.0"</code>
- * @throws AccessControlException when the conversion of the String to an
- * <code>InetAddress</code> failed.
- * @see #setSubnetMask(byte[])
- */
- public void setSubnetMask(String mask) throws AccessControlException {
- try {
- /* use setSubnetMask(...) to check the mask-format: */
- setSubnetMask(InetAddress.getByName(mask).getAddress());
- } catch (final UnknownHostException e) {
- throw new AccessControlException("Failed to convert mask [" + mask + "]: ", e);
- }
-
- }
-
- /**
- * Sets the subnet mask.
- * <p>
- * Only valid subnet masks are accepted, for which the binary representation is a sequence of
- * 1-bits followed by a sequence of 0-bits. For example <code>{ 255, 128, 0, 0 }</code> is
- * valid while <code>{ 255, 128, 0, 1 }</code> is not.
- * @param mask A byte array of the length 4.
- * @throws AccessControlException when the conversion of the byte array to an InetAddress
- * failed.
- * @see #setSubnetMask(String)
- */
- public void setSubnetMask(byte[] mask) throws AccessControlException {
- /*
- * check for correct netmask (i.e. any number of 1-bits followed by 0-bits filling the right
- * part of the mask) ...
- *
- * FIXME: This "algorithm" is rather unelegant. There should be a better way to do it! ;-)
- */
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("CHECK_NETMASK: check " + addr2string(mask));
- }
- int i = 0;
- CHECK_NETMASK: while (i < mask.length) {
- int b = mask[i++] & 0xff;
- /* the initial byte(s) must be 255: */
- if (b != 0xff) {
- /* first byte != 255, test all possibilities: */
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("CHECK_NETMASK: first byte != 255: idx: " + (i - 1)
- + ", mask[idx]: 0x" + b);
- }
- /* check if 0: */
- if (b == 0) {
- break CHECK_NETMASK;
- }
- for (int tst = 0xfe; tst != 0; tst = (tst << 1) & 0xff) {
- getLogger().debug("CHECK_NETMASK: tst == 0x" + Integer.toHexString(tst));
- if (b == tst) {
- break CHECK_NETMASK;
- }
- }
- /*
- * Invalid byte found, i.e. one which is not element of { 11111111, 11111110,
- * 11111100, 11111000, ..., 00000000 }
- */
- throw new AccessControlException("Invalid byte in mask [" + addr2string(mask) + "]");
- }
- }
- /* the remaining byte(s) (if any) must be 0: */
- while (++i < mask.length) {
- if (mask[i] != 0) {
- /*
- * Invalid byte found, i.e. some non-zero byte right of the first non-zero byte.
- */
- throw new AccessControlException("Invalid non-zero byte in mask ["
- + addr2string(mask) + "]");
- }
- }
-
- /* convert the checked mask to InetAddress: */
- try {
- this.subnetMask = InetAddress.getByAddress(mask);
- } catch (final UnknownHostException e) {
- throw new AccessControlException(
- "Failed to convert mask [" + addr2string(mask) + "]: ", e);
- }
- }
-
- /**
- * Returns the subnet mask.
- * @return An InetAddress value.
- */
- public InetAddress getSubnetMask() {
- return this.subnetMask;
- }
-
- /**
- * Checks if a network address / subnet mask combination describes a valid subnet.
- * @param networkAddress The network address.
- * @param subnetMask The subnet mask.
- * @return A boolean value.
- * @deprecated This method is currently not implemented, probably not necessary.and could be
- * removed in the future. Therefore it should not be used.
- */
- public static boolean isValidSubnet(InetAddress networkAddress, InetAddress subnetMask) {
- /*
- * FIXME? by zisch@dals.ch: Is this method really necessary (what for?) and (if so)
- * shouldn't it be an internal (private) utility-method??
- */
- // TODO implement class
- return false;
- }
-
- /**
- * Checks if this IP range contains a certain machine.
- * <p>
- * Note: if the network address and the subnet mask of this IP range have different sizes (i.e.
- * one is IPv4 and one is IPv6), this method will always return <code>false</code>, no matter
- * what machine has been specified!
- * <p>
- * Further, if the machine address and the IP range (i.e. network address and subnet mask) have
- * different sizes, the method will return <code>false</code>. (In other words: an IPv4 range
- * never contains an IPv6 address and the other way round.)
- * <p>
- * Note that the above can lead to confusion. For example the local subnet in IPv4 (
- * <code>127.0.0.0/8</code>) will <b>not </b> contain the localhost in IPv6 (
- * <code>::1</code>), and the localhost in IPv4 (<code>127.0.0.1</code>) will <b>not </b>
- * be contained in the local subnet in IPv6 (<code>::1/128</code>).
- * @param machine the machine to check for
- * @return a boolean value
- * @see InetAddressUtil#contains
- */
- public boolean contains(Machine machine) {
- /*
- * FIXME? by zisch@dals.ch: Maybe some mapping between IPv4/v6 should be done here, p.e. for
- * the localhost (see the javdoc comment above)? (I'm not a TCP/IP-guru, so I'm not sure
- * about this. ;-)
- */
- getLogger().debug("Checking IP range: [" + getId() + "]");
- InetAddressUtil util = new InetAddressUtil(getLogger());
- return util.contains(this.networkAddress, this.subnetMask, machine.getAddress());
- }
-
- /**
- * Format the specified numeric IP address.
- * @param addr the raw numeric IP address
- * @return the formatted address
- */
- private static String addr2string(byte[] addr) {
- StringBuffer buf = new StringBuffer();
- if (addr.length > 4) {
- /* IPv6-format if more than 4 bytes: */
- for (int i = 0; i < addr.length; i++) {
- if (i > 0 && (i & 1) == 0) {
- buf.append(':');
- }
- String hex = Integer.toHexString(addr[i] & 0xff);
- if (hex.length() == 1) {
- buf.append('0');
- }
- buf.append(hex);
- }
- } else {
- /* IPv4-format: */
- for (int i = 0; i < addr.length; i++) {
- if (i > 0) {
- buf.append('.');
- }
- buf.append(addr[i] & 0xff);
- }
- }
- return buf.toString();
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractItem.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractItem.java
deleted file mode 100644
index ab7ad28..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractItem.java
+++ /dev/null
@@ -1,158 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Item;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.ItemUtil;
-import org.apache.lenya.util.Assert;
-
-/**
- * Abstract superclass for all access control objects that can be managed by an
- * {@link org.apache.lenya.ac.ItemManager}. It is only used for code reuse.
- * @version $Id$
- */
-public abstract class AbstractItem extends AbstractLogEnabled implements Item, Comparable {
-
- private String id;
- private String description = "";
- private String name = "";
-
- private ItemManager itemManager;
-
- /**
- * Ctor.
- * @param itemManager The item manager this item belongs to.
- * @param logger The logger.
- */
- public AbstractItem(ItemManager itemManager, Logger logger) {
- Assert.notNull("item manager", itemManager);
- this.itemManager = itemManager;
-
- Assert.notNull("logger", logger);
- ContainerUtil.enableLogging(this, logger);
- }
-
- /**
- * @return The accreditable manager.
- */
- public AccreditableManager getAccreditableManager() {
- return getItemManager().getAccreditableManager();
- }
-
- /**
- * Sets the ID.
- * @param string The ID.
- */
- protected void setId(String string) {
- assert ItemUtil.isValidId(string);
- this.id = string;
- }
-
- /**
- * Returns the ID.
- * @return The ID.
- */
- public String getId() {
- return this.id;
- }
-
- /**
- * Returns the description of this object.
- * @return A string.
- */
- public String getDescription() {
- return this.description;
- }
-
- /**
- * Sets the description of this object.
- * @param _description A string.
- */
- public void setDescription(String _description) {
- assert _description != null;
- this.description = _description;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return getId();
-
- }
-
- /**
- * Returns the name of this object.
- * @return A <code>String</code>.
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * Set the full name
- * @param _name the new full name
- */
- public void setName(String _name) {
- assert _name != null;
- this.name = _name;
- }
-
- /**
- * @see java.lang.Object#equals(Object)
- */
- public boolean equals(Object otherObject) {
- boolean equals = false;
-
- if (getClass().isInstance(otherObject)) {
- AbstractItem otherManageable = (AbstractItem) otherObject;
- String thisMgrId = getAccreditableManager().getId();
- String otherMgrId = otherManageable.getAccreditableManager().getId();
- equals = getId().equals(otherManageable.getId()) && thisMgrId.equals(otherMgrId);
- }
- return equals;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getId().hashCode();
- }
-
- /**
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object obj) {
- if (obj instanceof AbstractItem) {
- return getId().compareTo(((AbstractItem) obj).getId());
- }
- return 0;
- }
-
- public ItemManager getItemManager() {
- return this.itemManager;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractRole.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractRole.java
deleted file mode 100644
index 6c45151..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractRole.java
+++ /dev/null
@@ -1,55 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.util.Assert;
-
-
-/**
- * A Role embodies the privilege to do certain things.
- */
-public abstract class AbstractRole extends AbstractItem implements Role {
-
- /**
- * Creates a new instance of Role.
- * @param itemManager The item manager.
- * @param logger The logger.
- */
- public AbstractRole(ItemManager itemManager, Logger logger) {
- super(itemManager, logger);
- }
-
- /**
- * Creates a new instance of Role.
- * @param itemManager The item manager.
- * @param logger The logger.
- * @param name The role name.
- */
- public AbstractRole(ItemManager itemManager, Logger logger, String name) {
- this(itemManager, logger);
- Assert.notNull("name", name);
- setName(name);
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractUser.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractUser.java
deleted file mode 100644
index 053e810..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractUser.java
+++ /dev/null
@@ -1,171 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.Password;
-import org.apache.lenya.ac.User;
-
-/**
- * Abstract user implementation.
- * @version $Id$
- */
-public abstract class AbstractUser extends AbstractGroupable implements User {
-
- private String email;
- private String encryptedPassword;
- private String defaultMenuLocale;
- private String defaultDocumentLocale;
-
- /**
- * Creates a new User.
- * @param itemManager The item manager.
- * @param logger The logger.
- */
- public AbstractUser(ItemManager itemManager, Logger logger) {
- super(itemManager, logger);
- }
-
- /**
- * Create a User instance
- * @param itemManager The item manager.
- * @param logger The logger.
- * @param id the user id
- * @param fullName the full name of the user
- * @param _email the users email address
- * @param password the users password
- */
- public AbstractUser(ItemManager itemManager, Logger logger, String id, String fullName,
- String _email, String password) {
- this(itemManager, logger);
- setId(id);
- setName(fullName);
- this.email = _email;
- setPassword(password);
- }
-
- /**
- * Get the email address
- * @return a <code>String</code>
- */
- public String getEmail() {
- return this.email;
- }
-
- /**
- * Set the email address
- * @param _email the new email address
- */
- public void setEmail(String _email) {
- this.email = _email;
- }
-
- /**
- * Sets the password.
- * @param plainTextPassword The plain text passwrod.
- */
- public void setPassword(String plainTextPassword) {
- this.encryptedPassword = Password.encrypt(plainTextPassword);
- }
-
- /**
- * This method can be used for subclasses to set the password without it
- * being encrypted again. Some subclass might have knowledge of the
- * encrypted password and needs to be able to set it.
- * @param _encryptedPassword the encrypted password
- */
- protected void setEncryptedPassword(String _encryptedPassword) {
- this.encryptedPassword = _encryptedPassword;
- }
-
- /**
- * Get the encrypted password
- * @return the encrypted password
- */
- protected String getEncryptedPassword() {
- return this.encryptedPassword;
- }
-
- /**
- * Checks support for changing password
- * @return true if password change is supported
- */
- public boolean canChangePassword() {
- return true;
- }
-
- /**
- * @return Returns the defaultDocumentLocale.
- */
- public String getDefaultDocumentLocale() {
- return defaultDocumentLocale;
- }
-
- /**
- * @param defaultDocumentLocale The defaultDocumentLocale to set.
- */
- public void setDefaultDocumentLocale(String defaultDocumentLocale) {
- this.defaultDocumentLocale = defaultDocumentLocale;
- }
-
- /**
- * @return Returns the defaultMenuLocale.
- */
- public String getDefaultMenuLocale() {
- return defaultMenuLocale;
- }
-
- /**
- * @param defaultMenuLocale The defaultMenuLocale to set.
- */
- public void setDefaultMenuLocale(String defaultMenuLocale) {
- this.defaultMenuLocale = defaultMenuLocale;
- }
-
- /**
- * Save the user
- * @throws AccessControlException if the save failed
- */
- public abstract void save() throws AccessControlException;
-
- /**
- * Delete a user
- * @throws AccessControlException if the delete failed
- */
- public void delete() throws AccessControlException {
- removeFromAllGroups();
- }
-
- /**
- * Authenticate a user. This is done by encrypting the given password and
- * comparing this to the encryptedPassword.
- * @param password to authenticate with
- * @return true if the given password matches the password for this user
- */
- public boolean authenticate(String password) {
- getLogger().debug("LDAP Password: " + password);
- getLogger().debug("LDAP pw encypted: " + Password.encrypt(password));
- getLogger().debug("LDAP orig encrypted pw: " + this.encryptedPassword);
-
- return this.encryptedPassword.equals(Password.encrypt(password));
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AnonymousAuthenticator.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AnonymousAuthenticator.java
deleted file mode 100644
index ed96774..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AnonymousAuthenticator.java
+++ /dev/null
@@ -1,83 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Authenticator;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.User;
-
-
-/**
- * The anonymous authenticator authenticates to an anonymous user with no password
- * (you just have to add a user named 'anonymous' with an arbitrary password and the permissions
- * you'd like via the admin screen). This is useful in conjunction with client certificates.
- * @version $Id$
- */
-public class AnonymousAuthenticator extends AbstractLogEnabled implements Authenticator {
-
-
- /**
- * @see org.apache.lenya.ac.Authenticator#authenticate(org.apache.lenya.ac.AccreditableManager,
- * org.apache.cocoon.environment.Request)
- */
- public boolean authenticate(AccreditableManager accreditableManager, Request request)
- throws AccessControlException {
-
- String username = "anonymous";
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- "Authenticating username [" + username + "]");
- }
-
- Identity identity = (Identity) request.getSession(false).getAttribute(Identity.class.getName());
-
- User user = accreditableManager.getUserManager().getUser(username);
-
- boolean authenticated = false;
- if (user != null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("User [" + user + "] authenticated.");
- }
-
- if (!identity.contains(user)) {
- User oldUser = identity.getUser();
- if (oldUser != null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Removing user [" + oldUser + "] from identity.");
- }
- identity.removeIdentifiable(oldUser);
- }
- identity.addIdentifiable(user);
- }
- authenticated = true;
- } else {
- if (getLogger().isDebugEnabled()) {
- if (user == null) {
- getLogger().debug("No such user: [" + username + "]");
- }
- getLogger().debug("User [" + username + "] not authenticated.");
- }
- }
- return authenticated;
- }
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/BypassableAccessController.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/BypassableAccessController.java
deleted file mode 100644
index cc7d4e9..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/BypassableAccessController.java
+++ /dev/null
@@ -1,185 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.sitemap.PatternException;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.regexp.RE;
-import org.apache.regexp.RECompiler;
-import org.apache.regexp.REProgram;
-import org.apache.regexp.RESyntaxException;
-
-/**
- * AccessController that can be bypassed for certain URL patterns.
- */
-public class BypassableAccessController extends DefaultAccessController {
-
- /**
- * Ctor.
- */
- public BypassableAccessController() {
- // do nothing
- }
-
- private List publicMatchers = new ArrayList();
- private List publicExtensions = new ArrayList();
-
- /**
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration conf) throws ConfigurationException {
- super.configure(conf);
-
- getLogger().debug("Configuring bypass patterns");
-
- Configuration[] publics = conf.getChildren("public");
-
- for (int i = 0; i < publics.length; i++) {
- String publicHref = publics[i].getValue(null);
-
- try {
- this.publicMatchers.add(preparePattern(publicHref));
- } catch (PatternException pe) {
- throw new ConfigurationException("invalid pattern for public hrefs", pe);
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("CONFIGURATION: public: " + publicHref);
- }
- }
-
- Configuration[] extensionConfigs = conf.getChildren("public-extensions");
- for (int i = 0; i < extensionConfigs.length; i++) {
- String extensionString = extensionConfigs[i].getValue();
- String[] extensions = extensionString.split(",");
- for (int e = 0; e < extensions.length; e++) {
- String ext = extensions[e].trim();
- if (!ext.startsWith(".")) {
- ext = "." + ext;
- }
- this.publicExtensions.add(ext);
- }
- }
-
- }
-
- /**
- * Compile the pattern in a <code>org.apache.regexp.REProgram</code>.
- * @param pattern The pattern to compile.
- * @return A RE program representing the pattern.
- * @throws PatternException when something went wrong.
- */
- protected REProgram preparePattern(String pattern)
- throws PatternException {
- if (pattern == null) {
- throw new PatternException("null passed as a pattern", null);
- }
-
- if (pattern.length() == 0) {
- pattern = "^$";
-
- if (getLogger().isWarnEnabled()) {
- getLogger().warn("The empty pattern string was rewritten to '^$'" +
- " to match for empty strings. If you intended" +
- " to match all strings, please change your" + " pattern to '.*'");
- }
- }
-
- try {
- RECompiler compiler = new RECompiler();
- REProgram program = compiler.compile(pattern);
-
- return program;
- } catch (RESyntaxException rse) {
- getLogger().debug("Failed to compile the pattern '" + pattern + "'", rse);
- throw new PatternException(rse.getMessage(), rse);
- }
- }
-
- /**
- * Matches a string using a prepared pattern program.
- * @param preparedPattern The pattern program.
- * @param match The string to match.
- * @return <code>true</code> if the string matched the pattern, <code>false</code> otherwise.
- */
- protected boolean preparedMatch(REProgram preparedPattern, String match) {
- boolean result = false;
-
- if (match != null) {
- RE re = new RE(preparedPattern);
- result = re.match(match);
- }
- return result;
- }
-
- /**
- * @see org.apache.lenya.ac.AccessController#authorize(org.apache.cocoon.environment.Request)
- */
- public boolean authorize(Request request)
- throws AccessControlException {
-
- assert request != null;
-
- resolveRoles(request);
-
- boolean authorized = false;
-
- String uri = request.getRequestURI();
- String context = request.getContextPath();
- if (context == null) {
- context = "";
- }
- uri = uri.substring(context.length());
-
- // Check public uris from configuration above. Should only be used during development before the implementation of a concrete authorizer.
- int i = 0;
- while (!authorized && i < this.publicMatchers.size()) {
- getLogger().debug("Trying pattern: [" + this.publicMatchers.get(i) + "] with URL [" + uri + "]");
- if (preparedMatch((REProgram) this.publicMatchers.get(i), uri)) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Permission granted for free: [" + uri + "]");
- }
- authorized = true;
- }
- i++;
- }
-
- i = 0;
- while (!authorized && i < this.publicExtensions.size()) {
- String ext = (String) this.publicExtensions.get(i);
- authorized = uri.endsWith(ext);
- i++;
- }
-
- if (!authorized) {
- authorized = super.authorize(request);
- }
-
- return authorized;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/ComposableAccessControllerResolver.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/ComposableAccessControllerResolver.java
deleted file mode 100644
index 48dcb2c..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/ComposableAccessControllerResolver.java
+++ /dev/null
@@ -1,146 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.AccessControllerResolver;
-
-/**
- * Access controller resolver composed of other access controller resolvers.
- * The member resolvers are called one after the other to resolve the access controllers.
- *
- * @version $Id$
- */
-public class ComposableAccessControllerResolver
- extends AbstractAccessControllerResolver
- implements Configurable, Disposable {
-
- /**
- * @see org.apache.lenya.ac.impl.AbstractAccessControllerResolver#doResolveAccessController(java.lang.String)
- */
- public AccessController doResolveAccessController(String url) throws AccessControlException {
-
- AccessController controller = null;
-
- try {
-
- if (this.selector == null) {
- this.selector =
- (ServiceSelector) getManager().lookup(AccessControllerResolver.ROLE + "Selector");
- }
-
- String[] types = getResolverTypes();
- int i = 0;
- while (controller == null && i < types.length) {
-
- getLogger().debug("Trying to resolve AC resolver for type [" + types[i] + "]");
- AccessControllerResolver resolver =
- (AccessControllerResolver) this.selector.select(types[i]);
- controller = resolver.resolveAccessController(url);
- setResolver(controller, resolver);
- getLogger().debug("Resolved access controller [" + controller + "]");
- i++;
- }
-
- } catch (ServiceException e) {
- throw new AccessControlException(e);
- }
-
- return controller;
- }
-
- private Map controllerToResolver = new HashMap();
-
- /**
- * @see org.apache.lenya.ac.AccessControllerResolver#release(org.apache.lenya.ac.AccessController)
- */
- public void release(AccessController controller) {
- assert controller != null;
- AccessControllerResolver resolver = getResolver(controller);
- resolver.release(controller);
- this.selector.release(resolver);
- }
-
- /**
- * Returns the access controller resolver that was used to resolve a
- * specific access controller.
- * @param controller The access controller.
- * @return An AC resolver.
- */
- protected AccessControllerResolver getResolver(AccessController controller) {
- AccessControllerResolver resolver =
- (AccessControllerResolver) this.controllerToResolver.get(controller);
- return resolver;
- }
-
- /**
- * Sets the access controller resolver that was used to resolve a
- * specific access controller.
- * @param controller The access controller.
- * @param resolver An AC resolver.
- */
- protected void setResolver(AccessController controller, AccessControllerResolver resolver) {
- this.controllerToResolver.put(controller, resolver);
- }
-
- protected static final String RESOLVER_ELEMENT = "resolver";
- protected static final String TYPE_ATTRIBUTE = "type";
-
- private String[] resolverTypes;
- private ServiceSelector selector;
-
- /**
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration configuration) throws ConfigurationException {
- Configuration[] accessControllerConfigs = configuration.getChildren(RESOLVER_ELEMENT);
- this.resolverTypes = new String[accessControllerConfigs.length];
- for (int i = 0; i < accessControllerConfigs.length; i++) {
- this.resolverTypes[i] = accessControllerConfigs[i].getAttribute(TYPE_ATTRIBUTE);
- }
- }
-
- /**
- * Returns the access controller types.
- * @return A string array.
- */
- protected String[] getResolverTypes() {
- return this.resolverTypes;
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- if (this.selector != null) {
- getManager().release(this.selector);
- }
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/ConfigurableAccessControllerResolver.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/ConfigurableAccessControllerResolver.java
deleted file mode 100644
index c476cad..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/ConfigurableAccessControllerResolver.java
+++ /dev/null
@@ -1,72 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccessController;
-
-/**
- * Configurable access controller resolver.
- * @version $Id$
- */
-public class ConfigurableAccessControllerResolver
- extends AbstractAccessControllerResolver
- implements Configurable {
-
- /**
- * @see org.apache.lenya.ac.impl.AbstractAccessControllerResolver#doResolveAccessController(java.lang.String)
- */
- public AccessController doResolveAccessController(String webappUrl)
- throws AccessControlException {
- AccessController accessController = null;
-
- try {
- accessController =
- (AccessController) getManager().lookup(
- AccessController.ROLE + "/" + this.accessControllerType);
-
- if (accessController instanceof Configurable) {
- ((Configurable) accessController).configure(this.accessControllerConfiguration);
- }
-
- } catch (Exception e) {
- throw new AccessControlException(e);
- }
-
- return accessController;
- }
-
- protected static final String ACCESS_CONTROLLER_ELEMENT = "access-controller";
- protected static final String TYPE_ATTRIBUTE = "type";
- private String accessControllerType;
-
- private Configuration accessControllerConfiguration;
-
- /**
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration configuration) throws ConfigurationException {
- this.accessControllerConfiguration = configuration.getChild(ACCESS_CONTROLLER_ELEMENT);
- this.accessControllerType = this.accessControllerConfiguration.getAttribute(TYPE_ATTRIBUTE);
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/CredentialImpl.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/CredentialImpl.java
deleted file mode 100644
index ef14695..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/CredentialImpl.java
+++ /dev/null
@@ -1,112 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.Credential;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.util.Assert;
-
-/**
- * Credential implementation.
- */
-public class CredentialImpl implements Credential {
- private Accreditable accreditable;
- private Role role;
- private String method = DENY;
-
- /**
- * Creates a new credential object.
- *
- * @param accreditable The accreditable.
- * @param role The role.
- */
- public CredentialImpl(Accreditable accreditable, Role role) {
- Assert.notNull("accreditable", accreditable);
- this.accreditable = accreditable;
- Assert.notNull("role", role);
- this.role = role;
- }
-
- /**
- * Returns the role of this credential.
- *
- * @return A role.
- */
- public Role getRole() {
- return this.role;
- }
-
- /**
- * Returns the accreditable of this credential.
- *
- * @return An accreditable.
- */
- public Accreditable getAccreditable() {
- return this.accreditable;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "[" + getAccreditable() + ":" + getRole() + " (" + getMethod() + ")]";
- }
-
- /**
- * Set the method of the credential, grant or deny
- *
- * @param method A string grant or deny
- */
- public void setMethod(String method) {
- this.method = method;
- }
-
- public String getMethod() {
- return method;
- }
-
- /**
- * @return if the method is {@link Credential#GRANT}.
- */
- public boolean isGranted() {
- return this.method.equals(GRANT);
- }
-
- /**
- * @return if the method is {@link Credential#DENY}.
- */
- public boolean isDenied() {
- return this.method.equals(DENY);
- }
-
- public boolean equals(Object obj) {
- if (!getClass().isInstance(obj)) {
- return false;
- }
- Credential cred = (Credential) obj;
- return cred.getAccreditable().equals(getAccreditable()) && cred.getRole().equals(getRole());
- }
-
- public int hashCode() {
- return Integer.valueOf(getAccreditable().hashCode() + getRole().hashCode()).hashCode();
- }
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/DefaultAccessController.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/DefaultAccessController.java
deleted file mode 100644
index 6b08014..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/DefaultAccessController.java
+++ /dev/null
@@ -1,482 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.*;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.component.Component;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-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.ServiceSelector;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Session;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.AccreditableManagerFactory;
-import org.apache.lenya.ac.Authenticator;
-import org.apache.lenya.ac.Authorizer;
-import org.apache.lenya.ac.IPRange;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.Item;
-import org.apache.lenya.ac.ItemManagerListener;
-import org.apache.lenya.ac.Machine;
-import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Default access controller implementation.
- * @version $Id: DefaultAccessController.java 563459 2007-08-07 12:00:20Z
- * nettings $
- */
-public class DefaultAccessController extends AbstractLogEnabled implements AccessController,
- Configurable, Serviceable, Disposable, ItemManagerListener {
-
- protected static final String AUTHORIZER_ELEMENT = "authorizer";
- protected static final String TYPE_ATTRIBUTE = "type";
- protected static final String ACCREDITABLE_MANAGER_ELEMENT = "accreditable-manager";
- protected static final String POLICY_MANAGER_ELEMENT = "policy-manager";
-
- private static final String VALID_IP = "([0-9]{1,3}\\.){3}[0-9]{1,3}";
- private ServiceManager manager;
- private ServiceSelector authorizerSelector;
- private ServiceSelector policyManagerSelector;
- private AccreditableManager accreditableManager;
- private PolicyManager policyManager;
- private Map authorizers = new HashMap();
- private List authorizerKeys = new ArrayList();
- private Authenticator authenticator;
-
- /**
- * @see org.apache.lenya.ac.AccessController#authenticate(org.apache.cocoon.environment.Request)
- */
- public boolean authenticate(Request request) throws AccessControlException {
-
- assert request != null;
- boolean authenticated = getAuthenticator().authenticate(getAccreditableManager(), request);
-
- return authenticated;
- }
-
- /**
- * @see org.apache.lenya.ac.AccessController#authorize(org.apache.cocoon.environment.Request)
- */
- public boolean authorize(Request request) throws AccessControlException {
- assert request != null;
-
- boolean authorized = false;
-
- getLogger().debug("=========================================================");
- getLogger().debug("Beginning authorization.");
-
- resolveRoles(request);
-
- if (hasAuthorizers()) {
- Authorizer[] _authorizers = getAuthorizers();
- int i = 0;
- authorized = true;
-
- while ((i < _authorizers.length) && authorized) {
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("---------------------------------------------------------");
- getLogger().debug("Invoking authorizer [" + _authorizers[i] + "]");
- }
-
- authorized = authorized && _authorizers[i].authorize(request);
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- "Authorizer [" + _authorizers[i] + "] returned [" + authorized + "]");
- }
-
- i++;
- }
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("=========================================================");
- getLogger().debug("Authorization complete, result: [" + authorized + "]");
- getLogger().debug("=========================================================");
- }
-
- return authorized;
- }
-
- protected void resolveRoles(Request request) throws AccessControlException {
- String webappUrl = ServletHelper.getWebappURI(request);
- Session session = request.getSession(true);
- Identity identity = (Identity) session.getAttribute(Identity.class.getName());
-
- Role[] roles;
- if (identity.belongsTo(this.accreditableManager)) {
- roles = this.policyManager.getGrantedRoles(this.accreditableManager, identity, webappUrl);
- } else {
- roles = new Role[0];
- getLogger().debug(
- "No roles resolved for identity [" + identity
- + "] - belongs to wrong accreditable manager.");
- }
- saveRoles(request, roles);
- }
-
- /**
- * Saves the roles of the current identity to the request.
- * @param request The request.
- * @param roles The roles.
- */
- protected void saveRoles(Request request, Role[] roles) {
- if(getLogger().isDebugEnabled()) {
- StringBuffer rolesBuffer = new StringBuffer();
- for (int i = 0; i < roles.length; i++) {
- rolesBuffer.append(" ").append(roles[i]);
- }
- getLogger().debug("Adding roles [" + rolesBuffer + " ] to request [" + request + "]");
- }
- request.setAttribute(Role.class.getName(), Arrays.asList(roles));
- }
-
- /**
- * Configures or parameterizes a component, depending on the implementation
- * as Configurable or Parameterizable.
- * @param component The component.
- * @param configuration The configuration to use.
- * @throws ConfigurationException when an error occurs during configuration.
- * @throws ParameterException when an error occurs during parameterization.
- */
- public static void configureOrParameterize(Component component, Configuration configuration)
- throws ConfigurationException, ParameterException {
- if (component instanceof Configurable) {
- ((Configurable) component).configure(configuration);
- }
- if (component instanceof Parameterizable) {
- Parameters parameters = Parameters.fromConfiguration(configuration);
- ((Parameterizable) component).parameterize(parameters);
- }
- }
-
- /**
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration conf) throws ConfigurationException {
-
- try {
- setupAccreditableManager(conf);
- setupAuthorizers(conf);
- setupPolicyManager(conf);
- setupAuthenticator();
- } catch (ConfigurationException e) {
- throw e;
- } catch (Exception e) {
- throw new ConfigurationException("Configuration failed: ", e);
- }
- }
-
- /**
- * Creates the accreditable manager.
- *
- * @param configuration The access controller configuration.
- * @throws ConfigurationException when the configuration failed.
- * @throws ServiceException when something went wrong.
- * @throws ParameterException when something went wrong.
- */
- protected void setupAccreditableManager(Configuration configuration)
- throws ConfigurationException, ServiceException, ParameterException {
- Configuration config = configuration.getChild(ACCREDITABLE_MANAGER_ELEMENT, false);
- if (config != null) {
- AccreditableManagerFactory factory = null;
- try {
- factory = (AccreditableManagerFactory) this.manager
- .lookup(AccreditableManagerFactory.ROLE);
- this.accreditableManager = factory.getAccreditableManager(config);
- this.accreditableManager.addItemManagerListener(this);
- } finally {
- if (factory != null) {
- this.manager.release(factory);
- }
- }
- }
- }
-
- /**
- * Creates the authorizers.
- *
- * @param configuration The access controller configuration.
- * @throws ConfigurationException when the configuration failed.
- * @throws ServiceException when something went wrong.
- * @throws ParameterException when something went wrong.
- */
- protected void setupAuthorizers(Configuration configuration) throws ServiceException,
- ConfigurationException, ParameterException {
- Configuration[] authorizerConfigurations = configuration.getChildren(AUTHORIZER_ELEMENT);
- if (authorizerConfigurations.length > 0) {
- this.authorizerSelector = (ServiceSelector) this.manager.lookup(Authorizer.ROLE
- + "Selector");
-
- for (int i = 0; i < authorizerConfigurations.length; i++) {
- String type = authorizerConfigurations[i].getAttribute(TYPE_ATTRIBUTE);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Adding authorizer [" + type + "]");
- }
-
- Authorizer authorizer = (Authorizer) this.authorizerSelector.select(type);
- this.authorizerKeys.add(type);
- this.authorizers.put(type, authorizer);
- configureOrParameterize(authorizer, authorizerConfigurations[i]);
- }
- }
- }
-
- /**
- * Creates the policy manager.
- *
- * @param configuration The access controller configuration.
- * @throws ConfigurationException when the configuration failed.
- * @throws ServiceException when something went wrong.
- * @throws ParameterException when something went wrong.
- */
- protected void setupPolicyManager(Configuration configuration) throws ServiceException,
- ConfigurationException, ParameterException {
- Configuration policyManagerConfiguration = configuration.getChild(POLICY_MANAGER_ELEMENT,
- false);
- if (policyManagerConfiguration != null) {
- String policyManagerType = policyManagerConfiguration.getAttribute(TYPE_ATTRIBUTE);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Adding policy manager type: [" + policyManagerType + "]");
- }
- this.policyManagerSelector = (ServiceSelector) this.manager.lookup(PolicyManager.ROLE
- + "Selector");
- this.policyManager = (PolicyManager) this.policyManagerSelector
- .select(policyManagerType);
- configureOrParameterize(this.policyManager, policyManagerConfiguration);
- }
- }
-
- /**
- * Sets up the authenticator.
- * @throws ServiceException when something went wrong.
- */
- protected void setupAuthenticator() throws ServiceException {
- this.authenticator = (Authenticator) this.manager.lookup(Authenticator.ROLE);
- }
-
- /**
- * Set the global component manager.
- *
- * @param _manager The global component manager
- * @throws ServiceException when something went wrong.
- */
- public void service(ServiceManager _manager) throws ServiceException {
- this.manager = _manager;
- }
-
- /**
- * Returns the service manager.
- * @return A service manager.
- */
- protected ServiceManager getManager() {
- return this.manager;
- }
-
- /**
- * Returns the authorizers of this action.
- * @return An array of authorizers.
- */
- public Authorizer[] getAuthorizers() {
-
- Authorizer[] authorizerArray = new Authorizer[this.authorizers.size()];
- for (int i = 0; i < this.authorizers.size(); i++) {
- String key = (String) this.authorizerKeys.get(i);
- authorizerArray[i] = (Authorizer) this.authorizers.get(key);
- }
- return authorizerArray;
- }
-
- /**
- * Returns if this action has authorizers.
- * @return A boolean value.
- */
- protected boolean hasAuthorizers() {
- return !this.authorizers.isEmpty();
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
-
- if (this.accreditableManager != null) {
- this.accreditableManager.removeItemManagerListener(this);
- }
-
- if (this.policyManagerSelector != null) {
- if (this.policyManager != null) {
- this.policyManagerSelector.release(this.policyManager);
- }
- getManager().release(this.policyManagerSelector);
- }
-
- if (this.authorizerSelector != null) {
- Authorizer[] _authorizers = getAuthorizers();
- for (int i = 0; i < _authorizers.length; i++) {
- this.authorizerSelector.release(_authorizers[i]);
- }
- getManager().release(this.authorizerSelector);
- }
-
- if (this.authenticator != null) {
- getManager().release(this.authenticator);
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Disposing [" + this + "]");
- }
- }
-
- /**
- * Returns the accreditable manager.
- * @return An accreditable manager.
- */
- public AccreditableManager getAccreditableManager() {
- return this.accreditableManager;
- }
-
- /**
- * Returns the policy manager.
- * @return A policy manager.
- */
- public PolicyManager getPolicyManager() {
- return this.policyManager;
- }
-
- /**
- * Returns the authenticator.
- * @return The authenticator.
- */
- public Authenticator getAuthenticator() {
- return this.authenticator;
- }
-
- /**
- * Checks if this identity was initialized by this access controller.
- *
- * @param identity An identity.
- * @return A boolean value.
- * @throws AccessControlException when something went wrong.
- */
- public boolean ownsIdenity(Identity identity) throws AccessControlException {
- return identity.belongsTo(getAccreditableManager());
- }
-
- /**
- * @see org.apache.lenya.ac.AccessController#setupIdentity(org.apache.cocoon.environment.Request)
- */
- public void setupIdentity(Request request) throws AccessControlException {
- Session session = request.getSession(true);
- if (!hasValidIdentity(session)) {
- Identity identity = new Identity(getLogger());
- identity.initialize();
- String remoteAddress = request.getRemoteAddr();
- String clientAddress = request.getHeader("x-forwarded-for");
-
- if (clientAddress != null) {
- Pattern p = Pattern.compile(VALID_IP);
- Matcher m = p.matcher(clientAddress);
-
- if (m.find()) {
- remoteAddress = m.group();
- }
- }
-
- getLogger().info("Remote Address to use: [" + remoteAddress + "]");
-
- Machine machine = new Machine(remoteAddress);
- IPRange[] ranges = this.accreditableManager.getIPRangeManager().getIPRanges();
- for (int i = 0; i < ranges.length; i++) {
- if (ranges[i].contains(machine)) {
- machine.addIPRange(ranges[i]);
- }
- }
-
- identity.addIdentifiable(machine);
- session.setAttribute(Identity.class.getName(), identity);
- }
- }
-
- /**
- * Checks if the session contains an identity that is not null and belongs
- * to the used access controller.
- *
- * @param session The current session.
- * @return A boolean value.
- * @throws AccessControlException when something went wrong.
- */
- protected boolean hasValidIdentity(Session session) throws AccessControlException {
- boolean valid = true;
- Identity identity = (Identity) session.getAttribute(Identity.class.getName());
- if (identity == null || !ownsIdenity(identity)) {
- valid = false;
- }
- return valid;
- }
-
- /**
- * @see org.apache.lenya.ac.ItemManagerListener#itemAdded(org.apache.lenya.ac.Item)
- */
- public void itemAdded(Item item) throws AccessControlException {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Item was added: [" + item + "]");
- getLogger().debug("Notifying policy manager");
- }
- if (item instanceof Accreditable) {
- getPolicyManager().accreditableAdded(getAccreditableManager(), (Accreditable) item);
- }
- }
-
- /**
- * @see org.apache.lenya.ac.ItemManagerListener#itemRemoved(org.apache.lenya.ac.Item)
- */
- public void itemRemoved(Item item) throws AccessControlException {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Item was removed: [" + item + "]");
- getLogger().debug("Notifying policy manager");
- }
-
- if (!(item instanceof Role)) {
- getPolicyManager().accreditableRemoved(getAccreditableManager(), (Accreditable) item);
- }
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/DefaultPolicy.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/DefaultPolicy.java
deleted file mode 100644
index 197d36f..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/DefaultPolicy.java
+++ /dev/null
@@ -1,228 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.Credential;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.ModifiablePolicy;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.Role;
-
-/**
- * A DefaultPolicy is the own policy of a certain URL (not merged).
- */
-public class DefaultPolicy implements ModifiablePolicy {
-
- private List credentials = new ArrayList();
-
- /**
- * Adds a credential to this policy.
- *
- * @param credential A credential.
- */
- public void addCredential(Credential credential) {
- assert credential != null;
- if (this.credentials.contains(credential)) {
- throw new IllegalArgumentException("The credential [" + credential
- + "] is already contained!");
- } else {
- this.credentials.add(credential);
- }
- }
-
- /**
- * Adds a role to this policy for a certain accreditable and a certain role.
- *
- * @param accreditable An accreditable.
- * @param role A role.
- */
- public void addRole(Accreditable accreditable, Role role, String method) {
- assert accreditable != null;
- assert role != null;
- CredentialImpl cred = new CredentialImpl(accreditable, role);
- cred.setMethod(method);
- addCredential(cred);
- }
-
- /**
- * Removes a role from this policy for a certain accreditable and a certain
- * role.
- *
- * @param accreditable An accreditable.
- * @param role A role.
- * @throws AccessControlException if the accreditable-role pair is not
- * contained.
- */
- public void removeRole(Accreditable accreditable, Role role) throws AccessControlException {
- assert accreditable != null;
- assert role != null;
- removeCredential(getCredential(accreditable, role));
- }
-
- /**
- * Returns the credentials of this policy in top-down order.
- *
- * @return An array of credentials.
- */
- public Credential[] getCredentials() {
- return (Credential[]) this.credentials.toArray(new Credential[this.credentials.size()]);
- }
-
- /**
- * Returns the credentials for a certain accreditable.
- *
- * @param accreditable An accreditable.
- * @param role
- * @return A credential.
- */
- public Credential getCredential(Accreditable accreditable, Role role) {
- Credential credential = null;
- for (Iterator i = this.credentials.iterator(); i.hasNext();) {
- Credential cred = (Credential) i.next();
- if (cred.getAccreditable().equals(accreditable) && cred.getRole().equals(role)) {
- credential = cred;
- }
- }
- return credential;
- }
-
- private boolean isSSL;
-
- /**
- * @see org.apache.lenya.ac.Policy#isSSLProtected()
- */
- public boolean isSSLProtected() throws AccessControlException {
- return this.isSSL;
- }
-
- /**
- * Sets if this policy requires SSL protection.
- *
- * @param ssl A boolean value.
- */
- public void setSSL(boolean ssl) {
- this.isSSL = ssl;
- }
-
- /**
- * @see org.apache.lenya.ac.Policy#isEmpty()
- */
- public boolean isEmpty() throws AccessControlException {
- return getCredentials().length == 0;
- }
-
- /**
- * Removes a credential.
- *
- * @param credential The credential to remove.
- * @throws AccessControlException If the credential does not exist.
- */
- protected void removeCredential(Credential credential) throws AccessControlException {
- if (this.credentials.contains(credential)) {
- this.credentials.remove(credential);
- }
- }
-
- /**
- * Removes all roles for a certain accreditable.
- *
- * @param accreditable The accreditable to remove all roles for.
- * @throws AccessControlException If no credential exists for this
- * accreditable.
- */
- public void removeRoles(Accreditable accreditable) throws AccessControlException {
- Credential[] credentials = getCredentials();
- for (int credIndex = 0; credIndex < credentials.length; credIndex++) {
- Credential credential = credentials[credIndex];
- if (credential.getAccreditable().equals(accreditable)) {
- this.credentials.remove(credential);
- }
- }
- }
-
- public Credential[] getCredentials(Identity identity) throws AccessControlException {
- Accreditable[] accreditables = identity.getAccreditables();
- Credential[] credentials = getCredentials();
- Set returnCredential = new LinkedHashSet();
- for (int credIndex = 0; credIndex < credentials.length; credIndex++) {
- Credential credential = credentials[credIndex];
- for (int accrIndex = 0; accrIndex < accreditables.length; accrIndex++) {
- Accreditable accreditable = accreditables[accrIndex];
- if (credential.getAccreditable().equals(accreditable)) {
- returnCredential.add(credential);
- }
- }
- }
- return (Credential[]) returnCredential.toArray(new Credential[returnCredential.size()]);
- }
-
- public void moveRoleDown(Accreditable accreditable, Role role) throws AccessControlException {
- moveRole(accreditable, role, true);
- }
-
- private void moveRole(Accreditable accreditable, Role role, boolean down) {
-
- Credential cred = getCredential(accreditable, role);
- int position = this.credentials.indexOf(cred);
-
- if (!down && position > 0) {
- this.credentials.remove(cred);
- this.credentials.add(position - 1, cred);
- } else if (down && position < this.credentials.size() - 1) {
- this.credentials.remove(cred);
- this.credentials.add(position + 1, cred);
- }
- }
-
- public void moveRoleUp(Accreditable accreditable, Role role) throws AccessControlException {
- moveRole(accreditable, role, false);
- }
-
- public int check(Identity identity, Role role) throws AccessControlException {
- Credential[] credentials = getCredentials();
- for (int i = credentials.length - 1; i >= 0; i--) {
- if (matches(identity, credentials[i].getAccreditable())
- && credentials[i].getRole().equals(role)) {
- if (credentials[i].getMethod().equals(CredentialImpl.GRANT)) {
- return Policy.RESULT_GRANTED;
- } else {
- return Policy.RESULT_DENIED;
- }
- }
- }
- return Policy.RESULT_NOT_MATCHED;
- }
-
- protected boolean matches(Identity identity, Accreditable accreditable) {
- Accreditable[] accrs = identity.getAccreditables();
- return Arrays.asList(accrs).contains(accreditable);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/ItemConfiguration.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/ItemConfiguration.java
deleted file mode 100644
index 30a0434..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/ItemConfiguration.java
+++ /dev/null
@@ -1,102 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfiguration;
-import org.apache.lenya.ac.AccessControlException;
-
-/**
- * Use this class to create configurations from {@link AbstractItem}s or
- * to build {@link AbstractItem}s from configurations.
- */
-public class ItemConfiguration {
-
- /**
- * Ctor.
- */
- public ItemConfiguration() {
- // do nothing
- }
-
- /**
- * Saves the ID, name and description of the Manageable to the configuration.
- * @param manageable A manageable.
- * @param configuration A configuration.
- */
- public void save(AbstractItem manageable, DefaultConfiguration configuration) {
- configuration.setAttribute(ATTRIBUTE_CLASS, manageable.getClass().getName());
- configuration.setAttribute(ATTRIBUTE_ID, manageable.getId());
-
- DefaultConfiguration child = null;
-
- // add name node
- child = new DefaultConfiguration(ELEMENT_NAME);
- child.setValue(manageable.getName());
- configuration.addChild(child);
-
- // add description node
- child = new DefaultConfiguration(ELEMENT_DESCRIPTION);
- child.setValue(manageable.getDescription());
- configuration.addChild(child);
-
- }
-
- protected static final String ELEMENT_NAME = "name";
- protected static final String ELEMENT_DESCRIPTION = "description";
- protected static final String ATTRIBUTE_ID = "id";
- protected static final String ATTRIBUTE_CLASS = "class";
-
- /**
- * Configures a Manageable.
- * @param manageable The manageable.
- * @param configuration The configuration.
- * @throws ConfigurationException when something went wrong.
- */
- public void configure(AbstractItem manageable, Configuration configuration) throws ConfigurationException {
- manageable.setId(configuration.getAttribute(ATTRIBUTE_ID));
- manageable.setName(configuration.getChild(ELEMENT_NAME).getValue(""));
- manageable.setDescription(configuration.getChild(ELEMENT_DESCRIPTION).getValue(""));
- }
-
- /**
- * Returns the class name of an item.
- * @param config The item configuration.
- * @return The class name.
- * @throws AccessControlException when something went wrong.
- */
- public static String getItemClass(Configuration config) throws AccessControlException {
- String klass = null;
-
- try {
- klass = config.getAttribute(ItemConfiguration.ATTRIBUTE_CLASS);
- } catch (ConfigurationException e) {
- String errorMsg =
- "Exception when extracting class name from identity file: "
- + klass
- + config.getAttributeNames();
- throw new AccessControlException(errorMsg, e);
- }
- return klass;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyBuilder.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyBuilder.java
deleted file mode 100644
index e1a5006..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyBuilder.java
+++ /dev/null
@@ -1,271 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import java.io.InputStream;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Credential;
-import org.apache.lenya.ac.ModifiablePolicy;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.World;
-import org.apache.lenya.ac.cache.BuildException;
-import org.apache.lenya.ac.cache.InputStreamBuilder;
-import org.apache.lenya.xml.DocumentHelper;
-import org.apache.lenya.xml.NamespaceHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Builds policies from input streams.
- * @version $Id$
- */
-public class PolicyBuilder implements InputStreamBuilder {
-
- /**
- * Ctor.
- * @param _accreditableManager An accreditable manager.
- */
- public PolicyBuilder(AccreditableManager _accreditableManager) {
- assert _accreditableManager != null;
- this.accreditableManager = _accreditableManager;
- }
-
- /**
- * Returns the accreditable manager.
- * @return An accreditable manager.
- */
- public AccreditableManager getAccreditableManager() {
- return this.accreditableManager;
- }
-
- private AccreditableManager accreditableManager;
-
- protected static final String POLICY_ELEMENT = "policy";
- protected static final String GROUP_ELEMENT = "group";
- protected static final String USER_ELEMENT = "user";
- protected static final String ROLE_ELEMENT = "role";
- protected static final String WORLD_ELEMENT = "world";
- protected static final String IP_RANGE_ELEMENT = "ip-range";
- protected static final String ID_ATTRIBUTE = "id";
- protected static final String SSL_ATTRIBUTE = "ssl";
- protected static final String METHOD_ATTRIBUTE = "method";
-
- /**
- * Builds a policy from an input stream.
- * @param stream The input stream to read the policy from.
- * @return A policy.
- * @throws AccessControlException when something went wrong.
- */
- public ModifiablePolicy buildPolicy(InputStream stream)
- throws AccessControlException {
-
- Document document;
-
- try {
- document = DocumentHelper.readDocument(stream);
- } catch (Exception e) {
- throw new AccessControlException(e);
- }
-
- return buildPolicy(document);
- }
-
- /**
- * Builds a policy from an XML document.
- * @param document The XML document.
- * @return A policy.
- * @throws AccessControlException when something went wrong.
- */
- public ModifiablePolicy buildPolicy(Document document)
- throws AccessControlException {
-
- DefaultPolicy policy = new DefaultPolicy();
- Element policyElement = document.getDocumentElement();
- assert policyElement.getLocalName().equals(POLICY_ELEMENT);
-
- NamespaceHelper helper =
- new NamespaceHelper(
- AccessController.NAMESPACE,
- AccessController.DEFAULT_PREFIX,
- document);
-
- Element[] credentialElements = helper.getChildren(policyElement);
-
- for (int i = 0; i < credentialElements.length; i++) {
- Accreditable accreditable = null;
-
- String id = credentialElements[i].getAttribute(ID_ATTRIBUTE);
- accreditable = getAccreditable(credentialElements[i].getLocalName(), id);
-
- Element[] roleElements = helper.getChildren(credentialElements[i], ROLE_ELEMENT);
-
- for (int j = 0; j < roleElements.length; j++) {
- String roleId = roleElements[j].getAttribute(ID_ATTRIBUTE);
- Role role = getAccreditableManager().getRoleManager().getRole(roleId);
- CredentialImpl credential = new CredentialImpl(accreditable, role);
- String method = roleElements[j].getAttribute(METHOD_ATTRIBUTE);
- // If method is not set, we assume DENY
- if (method.length() == 0) method = CredentialImpl.DENY;
- credential.setMethod(method);
- policy.addCredential(credential);
- }
-
- }
-
- boolean ssl = false;
- String sslString = policyElement.getAttribute(SSL_ATTRIBUTE);
- if (sslString != null) {
- ssl = Boolean.valueOf(sslString).booleanValue();
- }
- policy.setSSL(ssl);
-
- return policy;
- }
-
- /**
- * Creates an accredtiable for an element.
- * @param elementName The elment name.
- * @param id The ID of the accreditable.
- * @return An accreditable.
- * @throws AccessControlException when something went wrong.
- */
- protected Accreditable getAccreditable(
- String elementName,
- String id)
- throws AccessControlException {
- Accreditable accreditable = null;
-
- if (elementName.equals(USER_ELEMENT)) {
- accreditable = getAccreditableManager().getUserManager().getUser(id);
- } else if (elementName.equals(GROUP_ELEMENT)) {
- accreditable = getAccreditableManager().getGroupManager().getGroup(id);
- } else if (elementName.equals(WORLD_ELEMENT)) {
- accreditable = World.getInstance();
- } else if (elementName.equals(IP_RANGE_ELEMENT)) {
- accreditable = getAccreditableManager().getIPRangeManager().getIPRange(id);
- }
-
- if (accreditable == null) {
- throw new AccessControlException(
- "Unknown accreditable [" + elementName + "] with ID [" + id + "]");
- }
-
- return accreditable;
- }
-
- /**
- * Saves a policy to an XML document.
- * @param policy The policy to save.
- * @return A DOM document.
- * @throws AccessControlException when something went wrong.
- */
- public static Document savePolicy(Policy policy) throws AccessControlException {
- NamespaceHelper helper;
-
- try {
- helper =
- new NamespaceHelper(
- AccessController.NAMESPACE,
- AccessController.DEFAULT_PREFIX,
- POLICY_ELEMENT);
- } catch (ParserConfigurationException e) {
- throw new AccessControlException(e);
- }
-
- Credential[] credentials = ((DefaultPolicy) policy).getCredentials();
- Element policyElement = helper.getDocument().getDocumentElement();
-
- for (int i = 0; i < credentials.length; i++) {
- Accreditable accreditable = credentials[i].getAccreditable();
- Element accreditableElement = save(accreditable, helper);
-
- Role role = credentials[i].getRole();
- Element roleElement = helper.createElement(ROLE_ELEMENT);
- roleElement.setAttribute(ID_ATTRIBUTE, role.getId());
- roleElement.setAttribute(METHOD_ATTRIBUTE, credentials[i].getMethod());
- accreditableElement.appendChild(roleElement);
-
- policyElement.appendChild(accreditableElement);
- }
-
- policyElement.setAttribute(SSL_ATTRIBUTE, Boolean.toString(policy.isSSLProtected()));
-
- return helper.getDocument();
- }
-
- /**
- * Saves an accreditable to an XML element.
- * @param accreditable The accreditable.
- * @param helper The namespace helper to be used.
- * @return An XML element.
- * @throws AccessControlException when something went wrong.
- */
- protected static Element save(Accreditable accreditable, NamespaceHelper helper)
- throws AccessControlException {
- String localName = null;
- String id = null;
-
- if (accreditable instanceof User) {
- localName = USER_ELEMENT;
- id = ((User) accreditable).getId();
- } else if (accreditable instanceof AbstractGroup) {
- localName = GROUP_ELEMENT;
- id = ((AbstractGroup) accreditable).getId();
- } else if (accreditable instanceof World) {
- localName = WORLD_ELEMENT;
- } else if (accreditable instanceof AbstractIPRange) {
- localName = IP_RANGE_ELEMENT;
- id = ((AbstractIPRange) accreditable).getId();
- }
-
- if (localName == null) {
- throw new AccessControlException("Could not save accreditable [" + accreditable + "]");
- }
-
- Element element = helper.createElement(localName);
-
- if (id != null) {
- element.setAttribute(ID_ATTRIBUTE, id);
- }
-
- return element;
- }
-
- /**
- * @see org.apache.lenya.ac.cache.InputStreamBuilder#build(java.io.InputStream)
- */
- public Object build(InputStream stream) throws BuildException {
- Object value = null;
- try {
- value = buildPolicy(stream);
- } catch (AccessControlException e) {
- throw new BuildException(e);
- }
- return value;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/RemovedAccreditablePolicyBuilder.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/RemovedAccreditablePolicyBuilder.java
deleted file mode 100644
index 02bea34..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/RemovedAccreditablePolicyBuilder.java
+++ /dev/null
@@ -1,83 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.IPRange;
-import org.apache.lenya.ac.User;
-
-/**
- * A PolicyBuilder which can be used after an accreditable was removed.
- */
-public class RemovedAccreditablePolicyBuilder extends PolicyBuilder {
-
- /**
- * Ctor.
- * @param accreditableManager The accreditable manager.
- */
- public RemovedAccreditablePolicyBuilder(AccreditableManager accreditableManager) {
- super(accreditableManager);
- }
-
- private Accreditable removedAccreditable;
-
- /**
- * Sets the removed accreditable.
- *
- * @param accreditable An accreditable.
- */
- public void setRemovedAccreditable(Accreditable accreditable) {
- this.removedAccreditable = accreditable;
- }
-
- /**
- * @see org.apache.lenya.ac.impl.PolicyBuilder#getAccreditable(java.lang.String, java.lang.String)
- */
- protected Accreditable getAccreditable(String elementName, String id)
- throws AccessControlException {
-
- Accreditable accreditable;
-
- if (this.removedAccreditable instanceof User
- && elementName.equals(USER_ELEMENT)
- && ((User) this.removedAccreditable).getId().equals(id)) {
- accreditable = this.removedAccreditable;
- } else if (
- this.removedAccreditable instanceof Group
- && elementName.equals(GROUP_ELEMENT)
- && ((Group) this.removedAccreditable).getId().equals(id)) {
- accreditable = this.removedAccreditable;
- } else if (
- this.removedAccreditable instanceof IPRange
- && elementName.equals(IP_RANGE_ELEMENT)
- && ((IPRange) this.removedAccreditable).getId().equals(id)) {
- accreditable = this.removedAccreditable;
- } else {
-
- accreditable = super.getAccreditable(elementName, id);
- }
- return accreditable;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/URLPolicy.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/URLPolicy.java
deleted file mode 100644
index 6ac811f..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/URLPolicy.java
+++ /dev/null
@@ -1,284 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Credential;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.InheritingPolicyManager;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.Role;
-
-/**
- * A policy at a certain URL. The final policy is computed by merging the
- * subtree policies of all ancestor-or-self directories with the URL policy of
- * the actual URL.
- */
-public class URLPolicy implements Policy {
-
- /**
- * Returns the resulting policy for a certain URL.
- *
- * @param controller
- * The acccess controller.
- * @param _url
- * The URL.
- * @param manager
- * The policy manager.
- */
- public URLPolicy(AccreditableManager controller, String _url,
- InheritingPolicyManager manager) {
- assert _url != null;
- this.url = _url;
-
- assert manager != null;
- this.policyManager = manager;
-
- assert controller != null;
- this.accreditableManager = controller;
- }
-
- private String url;
-
- private InheritingPolicyManager policyManager;
-
- private AccreditableManager accreditableManager;
-
- private Policy[] policies = null;
-
- private Credential[] credentials = null;
-
- /**
- * Obtains the policies from the policy manager. This method is expensive
- * and therefore only called when needed.
- *
- * @throws AccessControlException
- * when something went wrong.
- */
- protected void obtainPolicies() throws AccessControlException {
- if (this.policies == null) {
- this.policies = getPolicyManager().getPolicies(
- getAccreditableManager(), getUrl());
- }
- }
-
- /**
- * Obtains the credentials from the policy manager. This method is expensive
- * and therefore only called when needed.
- *
- * @throws AccessControlException
- * when something went wrong.
- */
- protected void obtainCredentials() throws AccessControlException {
- if (this.credentials == null) {
- this.credentials = getPolicyManager().getCredentials(
- getAccreditableManager(), getUrl());
- }
- }
-
- static final String[] VISITOR_ROLES = { "visitor", "visit" };
-
- static final String[] ADMINISTRATOR_ROLES = { "administrator", "admin",
- "organize" };
-
- static final String[] AUTHOR_ROLES = { "author", "edit" };
-
- /**
- * @see org.apache.lenya.ac.Policy#check(org.apache.lenya.ac.Identity, org.apache.lenya.ac.Role)
- * Iterate the policy tree bottom-up.
- */
- public int check(Identity identity, Role role) throws AccessControlException {
- obtainPolicies();
-
- for (int i = 0; i < this.policies.length; i++) {
- int result = this.policies[i].check(identity, role);
- if (result == Policy.RESULT_GRANTED || result == Policy.RESULT_DENIED) {
- return result;
- }
- }
- return Policy.RESULT_NOT_MATCHED;
- }
-
- /**
- * Returns the visitor role.
- *
- * @param manager
- * The accreditable manager.
- * @return A role.
- * @throws AccessControlException
- * when something went wrong.
- */
- public static Role getVisitorRole(AccreditableManager manager)
- throws AccessControlException {
- Role visitorRole = null;
- for (int i = 0; i < VISITOR_ROLES.length; i++) {
- Role role = manager.getRoleManager().getRole(VISITOR_ROLES[i]);
- if (role != null) {
- visitorRole = role;
- }
- }
- return visitorRole;
- }
-
- /**
- * Returns the administrator role.
- *
- * @param manager
- * The accreditable manager.
- * @return A role.
- * @throws AccessControlException
- * when something went wrong.
- */
- public static Role getAdministratorRole(AccreditableManager manager)
- throws AccessControlException {
- Role administratorRole = null;
- for (int i = 0; i < ADMINISTRATOR_ROLES.length; i++) {
- Role role = manager.getRoleManager()
- .getRole(ADMINISTRATOR_ROLES[i]);
- if (role != null) {
- administratorRole = role;
- }
- }
- return administratorRole;
- }
-
- /**
- * Returns the author role.
- *
- * @param manager
- * The accreditable manager.
- * @return A role.
- * @throws AccessControlException
- * when something went wrong.
- */
- public static Role getAuthorRole(AccreditableManager manager)
- throws AccessControlException {
- Role administratorRole = null;
- for (int i = 0; i < AUTHOR_ROLES.length; i++) {
- Role role = manager.getRoleManager().getRole(AUTHOR_ROLES[i]);
- if (role != null) {
- administratorRole = role;
- }
- }
- return administratorRole;
- }
-
- /**
- * Returns the URL of this policy.
- *
- * @return The URL of this policy.
- */
- public String getUrl() {
- return this.url;
- }
-
- /**
- * Returns the policy builder.
- *
- * @return A policy builder.
- */
- public InheritingPolicyManager getPolicyManager() {
- return this.policyManager;
- }
-
- /**
- * Returns the access controller.
- *
- * @return An access controller.
- */
- public AccreditableManager getAccreditableManager() {
- return this.accreditableManager;
- }
-
- /**
- * The URL policy requires SSL protection if one of its member policies
- * requires SSL protection.
- *
- * @see org.apache.lenya.ac.Policy#isSSLProtected()
- */
- public boolean isSSLProtected() throws AccessControlException {
- obtainPolicies();
-
- boolean ssl = false;
-
- int i = 0;
- while (!ssl && i < this.policies.length) {
- ssl = ssl || this.policies[i].isSSLProtected();
- i++;
- }
-
- return ssl;
- }
-
- /**
- * @see org.apache.lenya.ac.Policy#isEmpty()
- */
- public boolean isEmpty() throws AccessControlException {
- boolean empty = true;
-
- int i = 0;
- while (empty && i < this.policies.length) {
- empty = empty && this.policies[i].isEmpty();
- i++;
- }
-
- return empty;
- }
-
- public Credential[] getCredentials() throws AccessControlException {
- obtainCredentials();
- Set credentials = new LinkedHashSet();
-
- for (int accrIndex = 0; accrIndex < this.credentials.length; accrIndex++) {
- credentials.add(this.credentials[accrIndex]);
- }
- return (Credential[]) credentials.toArray(new Credential[credentials
- .size()]);
- }
-
- public Credential[] getCredentials(Identity identity)
- throws AccessControlException {
- Accreditable[] accreditables = identity.getAccreditables();
- Credential[] credentials = getCredentials();
- Set returnCredential = new LinkedHashSet();
-
- for (int credIndex = 0; credIndex < credentials.length; credIndex++) {
- Credential credential = credentials[credIndex];
-
- for (int accrIndex = 0; accrIndex < accreditables.length; accrIndex++) {
- Accreditable accreditable = accreditables[accrIndex];
-
- if (credential.getAccreditable().equals(accreditable)) {
- returnCredential.add(credential);
- }
- }
- }
-
- return (Credential[]) returnCredential
- .toArray(new Credential[returnCredential.size()]);
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/UserAuthenticator.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/UserAuthenticator.java
deleted file mode 100644
index 089932c..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/UserAuthenticator.java
+++ /dev/null
@@ -1,133 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Authenticator;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.User;
-
-/**
- * User authenticator.
- * @version $Id$
- */
-public class UserAuthenticator extends AbstractLogEnabled implements Authenticator {
-
- /**
- * @see org.apache.lenya.ac.Authenticator#authenticate(org.apache.lenya.ac.AccreditableManager,
- * org.apache.cocoon.environment.Request) Note that this implementation first checks if the
- * user has authenticated over basic HTTP authentication. If yes, it uses these
- * credentials.
- */
- public boolean authenticate(AccreditableManager accreditableManager, Request request)
- throws AccessControlException {
-
- String encoded = "";
- String unencoded = "";
- String username = "";
- String password = "";
- if (request.getHeader("Authorization") != null) {
- encoded = request.getHeader("Authorization");
- }
- if (encoded.indexOf("Basic") > -1) {
- encoded = encoded.trim();
- encoded = encoded.substring(encoded.indexOf(' ') + 1);
- unencoded = new String(Base64.decodeBase64(encoded.getBytes()));
- }
- if (unencoded.indexOf(":") - 1 > -1) {
- username = unencoded.substring(0, unencoded.indexOf(":"));
- password = unencoded.substring(unencoded.indexOf(":") + 1);
- }
-
- if (encoded.length() == 0 && request.getParameter("username") != null) {
- username = request.getParameter("username").toLowerCase();
- password = request.getParameter("password");
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- "Authenticating username [" + username + "] with password [" + password + "]");
- }
-
- if (username == null || password == null) {
- throw new AccessControlException("Username or password is null!");
- }
-
- Identity identity = (Identity) request.getSession(false).getAttribute(
- Identity.class.getName());
-
- if (identity == null) {
- throw new AccessControlException("The session does not contain the identity!");
- }
-
- boolean authenticated = authenticate(accreditableManager, username, password, identity);
- return authenticated;
- }
-
- /**
- * Authenticates a user with a given username and password. When the authentication is
- * successful, the user is added to the identity.
- * @param accreditableManager The accreditable manager.
- * @param username The username.
- * @param password The password.
- * @param identity The identity to add the user to.
- * @throws AccessControlException when something went wrong.
- * @return <code>true</code> if the user was authenticated, <code>false</code> otherwise.
- */
- protected boolean authenticate(AccreditableManager accreditableManager, String username,
- String password, Identity identity) throws AccessControlException {
-
- User user = accreditableManager.getUserManager().getUser(username);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Authenticating user: [" + user + "]");
- }
-
- boolean authenticated = false;
- if (user != null && user.authenticate(password)) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("User [" + user + "] authenticated.");
- }
-
- if (!identity.contains(user)) {
- User oldUser = identity.getUser();
- if (oldUser != null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Removing user [" + oldUser + "] from identity.");
- }
- identity.removeIdentifiable(oldUser);
- }
- identity.addIdentifiable(user);
- }
- authenticated = true;
- } else {
- if (getLogger().isDebugEnabled()) {
- if (user == null) {
- getLogger().debug("No such user: [" + username + "]");
- }
- getLogger().debug("User [" + username + "] not authenticated.");
- }
- }
-
- return authenticated;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java
deleted file mode 100644
index c85dd3a..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java
+++ /dev/null
@@ -1,332 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.ac;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.parameters.ParameterException;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Credential;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.InheritingPolicyManager;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.impl.DefaultAccessController;
-import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * A PolicyManager which is capable of mapping all URLs of a document to the
- * appropriate canonical URL, e.g. <code>/foo/bar_de.print.html</code> is
- * mapped to <code>/foo/bar</code>.
- */
-public class DocumentPolicyManagerWrapper extends AbstractLogEnabled implements
- InheritingPolicyManager, Serviceable, Configurable, Disposable {
-
- /**
- * Ctor.
- */
- public DocumentPolicyManagerWrapper() {
- // do nothing
- }
-
- private InheritingPolicyManager policyManager;
- private ServiceSelector policyManagerSelector;
-
- /**
- * Returns the URI which is used to obtain the policy for a webapp URL.
- * @param webappUrl The web application URL.
- * @return A string.
- * @throws AccessControlException when something went wrong.
- */
- protected String getPolicyURL(String webappUrl)
- throws AccessControlException {
- return getPolicyUrlCorrect(webappUrl);
- }
-
- /**
- * Returns the URI which is used to obtain the policy for a webapp URL.
- * @param webappUrl The web application URL.
- * @return A string.
- * @throws AccessControlException when something went wrong.
- */
- protected String getPolicyUrlCorrect(String webappUrl)
- throws AccessControlException {
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Resolving policy for webapp URL [" + webappUrl + "]");
- }
-
- String url = null;
- ContextUtility contextUtility = null;
- try {
- contextUtility = (ContextUtility) serviceManager.lookup(ContextUtility.ROLE);
- Session session = RepositoryUtil.getSession(this.serviceManager, contextUtility
- .getRequest());
- DocumentFactory map = DocumentUtil.createDocumentFactory(this.serviceManager, session);
-
- // always check for authoring URL since the live document doesn't
- // have to exist
-
- URLInformation info = new URLInformation(webappUrl);
- // Danger, Will Robinson! If area or pubId is null, webappUrl.substring()
- // will be out of bounds, because null becomes "null" in string concatenation
- String pubId = info.getPublicationId();
- String area = info.getArea();
- String prefix = "/" + ((pubId != null) ? pubId + "/" : "");
- // String prefix = "/" + pubId + "/";
- String prefixWithArea = prefix + ((area != null) ? area : "");
- // String prefixWithArea = prefix + area;
- String authoringUrl = prefix + Publication.AUTHORING_AREA
- + ((webappUrl.length()>prefixWithArea.length())?webappUrl.substring(prefixWithArea.length()):"/");
-
- if (map.isDocument(authoringUrl)) {
- Document authoringDoc = map.getFromURL(authoringUrl);
- url = "/" + authoringDoc.getPublication().getId() + "/" + area
- + authoringDoc.getPath();
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(" Document exists");
- getLogger().debug(" Document path: [" + authoringDoc.getPath() + "]");
- }
- }
- } catch (ServiceException e) {
- throw new AccessControlException("Error looking up ContextUtility component", e);
- } catch (Exception e) {
- throw new AccessControlException(e);
- } finally {
- if (contextUtility != null) {
- serviceManager.release(contextUtility);
- }
- }
-
- if (url == null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(" Document does not exist.");
- }
- url = webappUrl;
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(" Using URL: [" + url + "]");
- }
- return url;
- }
-
- protected String getPolicyUrlFast(String webappUrl)
- throws AccessControlException {
- String strippedUrl = strip(strip(webappUrl, '.'), '_');
- return strippedUrl;
- }
-
- protected String strip(String strippedUrl, char delimiter) {
- int lastDotIndex = strippedUrl.lastIndexOf(delimiter);
- if (lastDotIndex != -1) {
- strippedUrl = strippedUrl.substring(0, lastDotIndex);
- }
- return strippedUrl;
- }
-
- /**
- * Returns the publication for a certain URL.
- * @param url The webapp url.
- * @return A publication.
- * @throws AccessControlException when the publication could not be created.
- */
- protected Publication getPublication(String url) throws AccessControlException {
- getLogger().debug("Building publication");
-
- ContextUtility util = null;
- try {
- util = (ContextUtility) this.serviceManager.lookup(ContextUtility.ROLE);
- Request request = util.getRequest();
- DocumentFactory factory = DocumentUtil.getDocumentFactory(this.serviceManager, request);
- return PublicationUtil.getPublicationFromUrl(this.serviceManager, factory, url);
- } catch (Exception e) {
- throw new AccessControlException(e);
- } finally {
- if (util != null) {
- this.serviceManager.release(util);
- }
- }
- }
-
- private ServiceManager serviceManager;
-
- /**
- * Returns the service manager.
- * @return A service manager.
- */
- protected ServiceManager getServiceManager() {
- return this.serviceManager;
- }
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager manager) throws ServiceException {
- this.serviceManager = manager;
- }
-
- /**
- * @return Returns the policyManager.
- */
- public InheritingPolicyManager getPolicyManager() {
- return this.policyManager;
- }
-
- /**
- * @param _policyManager The policyManager to set.
- */
- public void setPolicyManager(InheritingPolicyManager _policyManager) {
- this.policyManager = _policyManager;
- }
-
- public Policy buildSubtreePolicy(AccreditableManager controller, String url)
- throws AccessControlException {
- return getPolicyManager().buildSubtreePolicy(controller, getPolicyURL(url));
- }
-
- public Policy[] getPolicies(AccreditableManager controller, String url)
- throws AccessControlException {
- return getPolicyManager().getPolicies(controller, getPolicyURL(url));
- }
-
- public void saveSubtreePolicy(String url, Policy policy) throws AccessControlException {
- getPolicyManager().saveSubtreePolicy(getPolicyURL(url), policy);
- }
-
- /**
- * @see org.apache.lenya.ac.PolicyManager#getPolicy(org.apache.lenya.ac.AccreditableManager,
- * java.lang.String)
- */
- public Policy getPolicy(AccreditableManager controller, String url)
- throws AccessControlException {
- return getPolicyManager().getPolicy(controller, getPolicyURL(url));
- }
-
- /**
- * @see org.apache.lenya.ac.PolicyManager#accreditableRemoved(org.apache.lenya.ac.AccreditableManager,
- * org.apache.lenya.ac.Accreditable)
- */
- public void accreditableRemoved(AccreditableManager manager, Accreditable accreditable)
- throws AccessControlException {
- getPolicyManager().accreditableRemoved(manager, accreditable);
-
- }
-
- String ELEMENT_POLICY_MANAGER = "policy-manager";
- String ATTRIBUTE_TYPE = "type";
-
- /**
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration configuration) throws ConfigurationException {
- Configuration policyManagerConfiguration = configuration.getChild(
- this.ELEMENT_POLICY_MANAGER, false);
- if (policyManagerConfiguration != null) {
- String type = null;
- try {
- type = policyManagerConfiguration.getAttribute(this.ATTRIBUTE_TYPE);
-
- this.policyManagerSelector = (ServiceSelector) getServiceManager().lookup(
- PolicyManager.ROLE + "Selector");
-
- PolicyManager _policyManager = (PolicyManager) this.policyManagerSelector
- .select(type);
-
- if (!(_policyManager instanceof InheritingPolicyManager)) {
- throw new AccessControlException("The " + getClass().getName()
- + " can only be used with an "
- + InheritingPolicyManager.class.getName() + ".");
- }
-
- DefaultAccessController.configureOrParameterize(_policyManager,
- policyManagerConfiguration);
- setPolicyManager((InheritingPolicyManager) _policyManager);
- } catch (final ConfigurationException e1) {
- throw new ConfigurationException("Obtaining policy manager for type [" + type
- + "] failed: ", e1);
- } catch (final ServiceException e1) {
- throw new ConfigurationException("Obtaining policy manager for type [" + type
- + "] failed: ", e1);
- } catch (final ParameterException e1) {
- throw new ConfigurationException("Obtaining policy manager for type [" + type
- + "] failed: ", e1);
- } catch (final AccessControlException e1) {
- throw new ConfigurationException("Obtaining policy manager for type [" + type
- + "] failed: ", e1);
- }
- }
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- if (this.policyManagerSelector != null) {
- if (getPolicyManager() != null) {
- this.policyManagerSelector.release(getPolicyManager());
- }
- getServiceManager().release(this.policyManagerSelector);
- }
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Disposing [" + this + "]");
- }
-
- }
-
- /**
- * @see org.apache.lenya.ac.PolicyManager#accreditableAdded(org.apache.lenya.ac.AccreditableManager,
- * org.apache.lenya.ac.Accreditable)
- */
- public void accreditableAdded(AccreditableManager manager, Accreditable accreditable)
- throws AccessControlException {
- getPolicyManager().accreditableAdded(manager, accreditable);
- }
-
- public Credential[] getCredentials(AccreditableManager controller, String url)
- throws AccessControlException {
- return getPolicyManager().getCredentials(controller, getPolicyURL(url));
- }
-
- public Role[] getGrantedRoles(AccreditableManager accreditableManager, Identity identity,
- String url) throws AccessControlException {
- return getPolicyManager().getGrantedRoles(accreditableManager, identity, getPolicyURL(url));
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/PublicationAccessControllerResolver.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/PublicationAccessControllerResolver.java
deleted file mode 100644
index c0bcbd6..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/PublicationAccessControllerResolver.java
+++ /dev/null
@@ -1,220 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.ac;
-
-import java.io.File;
-
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-import org.apache.cocoon.environment.Request;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.SourceUtil;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.impl.AbstractAccessControllerResolver;
-import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.URLInformation;
-
-/**
- * Resolves the access controller according to the <code>access-control.xml</code> file of a publication.
- */
-public class PublicationAccessControllerResolver extends AbstractAccessControllerResolver implements
- Initializable {
-
- protected static final String AC_CONFIGURATION_FILE
- = "config/access-control/access-control.xml".replace('/', File.separatorChar);
- protected static final String TYPE_ATTRIBUTE = "type";
-
- /**
- * This implementation uses the publication ID in combination with the context path as cache
- * key.
- * @see org.apache.lenya.ac.impl.AbstractAccessControllerResolver#generateCacheKey(java.lang.String,
- * org.apache.excalibur.source.SourceResolver)
- */
- protected Object generateCacheKey(String webappUrl, SourceResolver resolver)
- throws AccessControlException {
-
- URLInformation info = new URLInformation(webappUrl);
-
- String publicationId = info.getPublicationId();
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Using first URL step (might be publication ID) as cache key: ["
- + publicationId + "]");
- }
-
- return super.generateCacheKey(publicationId, resolver);
- }
-
- /**
- * @see org.apache.lenya.ac.impl.AbstractAccessControllerResolver#doResolveAccessController(java.lang.String)
- */
- public AccessController doResolveAccessController(String webappUrl)
- throws AccessControlException {
- getLogger().debug("Resolving controller for URL [" + webappUrl + "]");
-
- AccessController controller = null;
- Publication publication = getPublication(webappUrl);
-
- if (publication != null) {
- String publicationUrl = webappUrl.substring(("/" + publication.getId()).length());
- controller = resolveAccessController(publication, publicationUrl);
- }
- return controller;
- }
-
- /**
- * Returns the publication for the webapp URL or null if the URL is not included in a
- * publication.
- * @param webappUrl The webapp URL.
- * @return A publication.
- * @throws AccessControlException when something went wrong.
- */
- protected Publication getPublication(String webappUrl) throws AccessControlException {
- Publication publication = null;
-
- assert webappUrl.startsWith("/");
- // remove leading slash
- String url = webappUrl.substring(1);
-
- if (url.length() > 0) {
-
- URLInformation info = new URLInformation(webappUrl);
- String pubId = info.getPublicationId();
-
- ContextUtility util = null;
- try {
- util = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
- Request request = util.getRequest();
- DocumentFactory factory = DocumentUtil.getDocumentFactory(manager, request);
- if (pubId != null && factory.existsPublication(pubId)) {
- publication = factory.getPublication(pubId);
- }
- } catch (Exception e) {
- throw new AccessControlException(e);
- } finally {
- if (util != null) {
- this.manager.release(util);
- }
- }
- if (publication != null) {
- getLogger().debug("Publication [" + pubId + "] exists.");
- }
- }
- return publication;
- }
-
- /**
- * Returns the servlet context.
- * @return A file.
- */
- protected File getContext() {
- return this.context;
- }
-
- /**
- * Retrieves access control configuration of a specific publication.
- * @param publication The publication.
- * @return Configuration
- * @throws AccessControlException when something went wrong.
- */
- public Configuration getConfiguration(Publication publication) throws AccessControlException {
- File configurationFile = new File(publication.getDirectory(), AC_CONFIGURATION_FILE);
-
- if (configurationFile.isFile()) {
- try {
- Configuration configuration = new DefaultConfigurationBuilder().buildFromFile(configurationFile);
- return configuration;
- } catch (Exception e) {
- throw new AccessControlException(e);
- }
- } else {
- throw new AccessControlException("No such file or directory: " + configurationFile);
- }
- }
-
- private File context;
-
- /**
- * Resolves an access controller for a certain URL within a publication.
- * @param publication The publication.
- * @param url The url within the publication.
- * @return An access controller.
- * @throws AccessControlException when something went wrong.
- */
- public AccessController resolveAccessController(Publication publication, String url)
- throws AccessControlException {
-
- assert publication != null;
-
- AccessController accessController = null;
-
- try {
- Configuration configuration = getConfiguration(publication);
- String type = configuration.getAttribute(TYPE_ATTRIBUTE);
-
- accessController = (AccessController) getManager().lookup(AccessController.ROLE + "/"
- + type);
-
- if (accessController instanceof Configurable) {
- ((Configurable) accessController).configure(configuration);
- }
-
- } catch (Exception e) {
- throw new AccessControlException(e);
- }
-
- return accessController;
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Initializable#initialize()
- */
- public void initialize() throws Exception {
- SourceResolver resolver = null;
- Source contextSource = null;
- File contextDir;
- try {
- resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);
- contextSource = resolver.resolveURI("context:///");
- contextDir = SourceUtil.getFile(contextSource);
-
- if (contextDir == null || !contextDir.isDirectory()) {
- throw new AccessControlException("The servlet context is not a directory!");
- }
-
- } finally {
- if (resolver != null) {
- if (contextSource != null) {
- resolver.release(contextSource);
- }
- getManager().release(resolver);
- }
- }
- this.context = contextDir;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/SitemapPolicyManager.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/SitemapPolicyManager.java
deleted file mode 100644
index 7ad38a5..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/SitemapPolicyManager.java
+++ /dev/null
@@ -1,167 +0,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.
- *
- */
-
-package org.apache.lenya.cms.ac;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Credential;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.impl.PolicyBuilder;
-import org.apache.lenya.xml.DocumentHelper;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/**
- * Policy manager based on Cocoon sitemaps.
- * @version $Id$
- */
-public class SitemapPolicyManager extends AbstractLogEnabled implements PolicyManager, Serviceable {
-
- private Credential[] credentials;
-
- /**
- * @see org.apache.lenya.ac.PolicyManager#getPolicy(org.apache.lenya.ac.AccreditableManager,
- * java.lang.String)
- */
- public Policy getPolicy(AccreditableManager accreditableManager, String url)
- throws AccessControlException {
-
- url = url.substring(1);
-
- int slashIndex = url.indexOf("/");
- if (slashIndex == -1) {
- slashIndex = url.length();
- }
-
- String publicationId = url.substring(0, slashIndex);
- url = url.substring(publicationId.length());
-
- SourceResolver resolver = null;
- Policy policy = null;
- Source source = null;
- try {
- resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);
-
- String policyUrl = publicationId + "/policies" + url + ".acml";
- getLogger().debug("Policy URL: " + policyUrl);
- source = resolver.resolveURI("cocoon://" + policyUrl);
- Document document = DocumentHelper.readDocument(source.getInputStream());
- policy = new PolicyBuilder(accreditableManager).buildPolicy(document);
- this.credentials=policy.getCredentials();
- } catch (SourceNotFoundException e) {
- throw new AccessControlException(e);
- } catch (ServiceException e) {
- throw new AccessControlException(e);
- } catch (MalformedURLException e) {
- throw new AccessControlException(e);
- } catch (IOException e) {
- throw new AccessControlException(e);
- } catch (ParserConfigurationException e) {
- throw new AccessControlException(e);
- } catch (SAXException e) {
- throw new AccessControlException(e);
- } catch (AccessControlException e) {
- throw new AccessControlException(e);
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- getManager().release(resolver);
- }
- }
-
- return policy;
- }
-
- private ServiceManager manager;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager _manager) throws ServiceException {
- this.manager = _manager;
- }
-
- /**
- * Returns the service manager.
- * @return A service manager.
- */
- public ServiceManager getManager() {
- return this.manager;
- }
-
- /**
- * @see org.apache.lenya.ac.PolicyManager#accreditableRemoved(org.apache.lenya.ac.AccreditableManager,
- * org.apache.lenya.ac.Accreditable)
- */
- public void accreditableRemoved(AccreditableManager _manager, Accreditable accreditable)
- throws AccessControlException {
- // do nothing
- }
-
- /**
- * @see org.apache.lenya.ac.PolicyManager#accreditableAdded(org.apache.lenya.ac.AccreditableManager,
- * org.apache.lenya.ac.Accreditable)
- */
- public void accreditableAdded(AccreditableManager _manager, Accreditable accreditable)
- throws AccessControlException {
- // do nothing
- }
-
- public Credential[] getCredentials(AccreditableManager controller, String url) throws AccessControlException {
- Credential[] copy = new Credential[credentials.length];
- for (int i = 0; i < credentials.length; i++) {
- copy[i]=credentials[i];
- }
- return copy;
- }
-
- public Role[] getGrantedRoles(AccreditableManager accreditableManager, Identity identity,
- String url) throws AccessControlException {
- Role[] roles = accreditableManager.getRoleManager().getRoles();
- Set grantedRoles = new HashSet();
- Policy policy = getPolicy(accreditableManager, url);
- for (int i = 0; i < roles.length; i++) {
- if (policy.check(identity, roles[i]) == Policy.RESULT_GRANTED) {
- grantedRoles.add(roles[i]);
- }
- }
- return (Role[]) grantedRoles.toArray(new Role[grantedRoles.size()]);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/AccessControlAction.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/AccessControlAction.java
deleted file mode 100644
index c37e83a..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/AccessControlAction.java
+++ /dev/null
@@ -1,136 +0,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.
- *
- */
-
-package org.apache.lenya.cms.cocoon.acting;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.cocoon.acting.ConfigurableServiceableAction;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.AccessControllerResolver;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Super class for access control actions.
- *
- * @version $Id$
- */
-public abstract class AccessControlAction extends ConfigurableServiceableAction {
-
- private AccessController accessController;
-
- /**
- * <p>
- * Invokes the access control functionality.
- * If no access controller was found for the requested URL, an empty map is returned.
- * </p>
- * <p>
- * This is a template method. Implement doAct() to add your functionality.
- * </p>
- * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
- */
- public Map act(
- Redirector redirector,
- SourceResolver sourceResolver,
- Map objectModel,
- String source,
- Parameters parameters)
- throws Exception {
-
- ServiceSelector selector = null;
- AccessControllerResolver resolver = null;
- this.accessController = null;
-
- Request request = ObjectModelHelper.getRequest(objectModel);
-
- Map result = null;
-
- try {
- selector =
- (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE + "Selector");
-
- getLogger().debug("Resolving AC resolver for type [" + AccessControllerResolver.DEFAULT_RESOLVER + "]");
- resolver =
- (AccessControllerResolver) selector.select(
- AccessControllerResolver.DEFAULT_RESOLVER);
- getLogger().debug("Resolved AC resolver [" + resolver + "]");
-
- String webappUrl = ServletHelper.getWebappURI(request);
- this.accessController = resolver.resolveAccessController(webappUrl);
-
- if (this.accessController == null) {
- result = Collections.EMPTY_MAP;
- } else {
- this.accessController.setupIdentity(request);
- result = doAct(redirector, sourceResolver, objectModel, source, parameters);
- }
-
- } finally {
- if (selector != null) {
- if (resolver != null) {
- selector.release(resolver);
- }
- this.manager.release(selector);
- }
- }
- return result;
- }
-
- /**
- * The actual act method.
- * @param redirector The <code>Redirector</code> in charge
- * @param resolver The <code>SourceResolver</code> in charge
- * @param objectModel The <code>Map</code> with object of the
- * calling environment which can be used
- * to select values this controller may need
- * (ie Request, Response).
- * @param source A source <code>String</code> to the Action
- * @param parameters The <code>Parameters</code> for this invocation
- * @return Map The returned <code>Map</code> object with
- * sitemap substitution values which can be used
- * in subsequent elements attributes like src=
- * using a xpath like expression: src="mydir/{myval}/foo"
- * If the return value is null the processing inside
- * the <map:act> element of the sitemap will
- * be skipped.
- * @exception Exception Indicates something is totally wrong
- */
- protected abstract Map doAct(
- Redirector redirector,
- SourceResolver resolver,
- Map objectModel,
- String source,
- Parameters parameters)
- throws Exception;
-
- /**
- * Returns the access controller.
- * @return An access controller.
- */
- public AccessController getAccessController() {
- return this.accessController;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthenticatorAction.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthenticatorAction.java
deleted file mode 100644
index 88c0b03..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthenticatorAction.java
+++ /dev/null
@@ -1,62 +0,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.
- *
- */
-
-/* $Id: DelegatingAuthenticatorAction.java 42616 2004-03-03 12:56:33Z gregor $ */
-
-package org.apache.lenya.cms.cocoon.acting;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-
-/**
- * Authenticator action that delegates the authentication to an access controller.
- */
-public class DelegatingAuthenticatorAction extends AccessControlAction {
-
- /**
- * @see org.apache.lenya.cms.cocoon.acting.AccessControlAction#doAct(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
- */
- protected Map doAct(
- Redirector redirector,
- SourceResolver resolver,
- Map objectModel,
- String source,
- Parameters parameters)
- throws Exception {
-
- getLogger().debug("Authenticating request");
-
- Request request = ObjectModelHelper.getRequest(objectModel);
- Map result = null;
- if (getAccessController().authenticate(request)) {
- getLogger().debug("Authentication successful.");
- result = Collections.EMPTY_MAP;
- }
- else {
- getLogger().debug("Authentication failed.");
- }
- return result;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthorizerAction.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthorizerAction.java
deleted file mode 100644
index 1005556..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthorizerAction.java
+++ /dev/null
@@ -1,110 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.acting;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.avalon.excalibur.pool.Poolable;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Session;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.util.Stack;
-
-/**
- * AuthorizerAction that delegates the authorizing to an AccessController.
- */
-public class DelegatingAuthorizerAction extends AccessControlAction implements Poolable {
-
- /**
- * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
- */
- public Map act(
- Redirector redirector,
- SourceResolver resolver,
- Map objectModel,
- String src,
- Parameters parameters)
- throws Exception {
-
- return super.act(redirector, resolver, objectModel, src, parameters);
- }
-
- /**
- * @see org.apache.lenya.cms.cocoon.acting.AccessControlAction#doAct(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
- */
- protected Map doAct(
- Redirector redirector,
- SourceResolver resolver,
- Map objectModel,
- String source,
- Parameters parameters)
- throws Exception {
-
- Request request = ObjectModelHelper.getRequest(objectModel);
-
- setHistory(request);
-
- boolean authorized = getAccessController().authorize(request);
-
- Map result = null;
- if (authorized) {
- result = Collections.EMPTY_MAP;
- }
-
- return result;
- }
-
- /**
- * <code>HISTORY</code> Name of the session attribute that holds the history
- */
- public static final String HISTORY =
- DelegatingAuthorizerAction.class.getPackage().getName() + ".History";
-
- /**
- * Adds the current URL to the history.
- * @param request The request.
- */
- protected void setHistory(Request request) {
- Session session = request.getSession(true);
-
- Stack history = (Stack) session.getAttribute(HISTORY);
-
- if (history == null) {
- history = new Stack(10);
- session.setAttribute(HISTORY, history);
- }
-
- String url = request.getRequestURI();
- String context = request.getContextPath();
- if (context == null) {
- context = "";
- }
- url = url.substring(context.length());
-
- history.push(url);
-
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/SslRedirectAction.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/SslRedirectAction.java
deleted file mode 100644
index ca45797..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/SslRedirectAction.java
+++ /dev/null
@@ -1,100 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.acting;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.cocoon.acting.ConfigurableServiceableAction;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.AccessControllerResolver;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.cms.linking.LinkRewriter;
-import org.apache.lenya.cms.linking.OutgoingLinkRewriter;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Returns a map if the current request needs a redirect to the <code>https://</code> protocol.
- * This is the case if the policy requires SSL protection and the current request is not secure. The
- * map contains the redirect URI as value for the key <em>redirectUri</em>. Otherwise,
- * <code>null</code> is returned.
- */
-public class SslRedirectAction extends ConfigurableServiceableAction {
-
- /**
- * The key to obtain the redirect URI from the returned map.
- */
- public static final String KEY_REDIRECT_URI = "redirectUri";
-
- public Map act(Redirector redirector, SourceResolver sourceResolver, Map objectModel,
- String source, Parameters parameters) throws Exception {
-
- ServiceSelector selector = null;
- AccessControllerResolver resolver = null;
- AccessController accessController = null;
-
- Request request = ObjectModelHelper.getRequest(objectModel);
-
- if (!request.isSecure()) {
- try {
- selector = (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE
- + "Selector");
-
- resolver = (AccessControllerResolver) selector
- .select(AccessControllerResolver.DEFAULT_RESOLVER);
-
- String url = ServletHelper.getWebappURI(request);
- accessController = resolver.resolveAccessController(url);
-
- if (accessController != null) {
- PolicyManager policyManager = accessController.getPolicyManager();
- Policy policy = policyManager.getPolicy(accessController.getAccreditableManager(),
- url);
- if (policy.isSSLProtected()) {
- Session session = RepositoryUtil.getSession(this.manager, request);
- LinkRewriter rewriter = new OutgoingLinkRewriter(this.manager, session, url,
- false, true, false);
- String sslUri = rewriter.rewrite(url);
- return Collections.singletonMap(KEY_REDIRECT_URI, sslUri);
- }
- }
-
- } finally {
- if (selector != null) {
- if (resolver != null) {
- if (accessController != null) {
- resolver.release(accessController);
- }
- selector.release(resolver);
- }
- this.manager.release(selector);
- }
- }
- }
- return null;
- }
-}
diff --git a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/components/modules/input/AccessControlModule.java b/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/components/modules/input/AccessControlModule.java
deleted file mode 100644
index b395350..0000000
--- a/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/components/modules/input/AccessControlModule.java
+++ /dev/null
@@ -1,340 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.cocoon.components.modules.input.AbstractInputModule;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Session;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.AccessControllerResolver;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.Machine;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.UserManager;
-import org.apache.lenya.cms.ac.PolicyUtil;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * <p>
- * Input module for access control attributes.
- * </p>
- * <p>
- * Attributes:
- * </p>
- * <ul>
- * <li><strong><code>user-id</code></strong> - the ID of the currently logged-in user</li>
- * <li><strong><code>user-name</code></strong> - the full name of the currently logged-in user</li>
- * <li><strong><code>user-name:{user-id}</code></strong> - the full name of a specific user</li>
- * <li><strong><code>user-email</code></strong> - the e-mail address of the currently logged-in user</li>
- * <li><strong><code>user-email:{user-id}</code></strong> - the e-mail address of a specific user</li>
- * <li><strong><code>ip-address</code></strong> - the IP address of the client machine</li>
- * <li><strong><code>role-ids</code></strong> - the role IDs which are granted to the current identity</li>
- * <li><strong><code>user-manager</code></strong> - the user manager object</li>
- * <li><strong><code>group-manager</code></strong> - the group manager object</li>
- * <li><strong><code>iprange-manager</code></strong> - the IP range manager object</li>
- * <li><strong><code>role-manager</code></strong> - the role manager object</li>
- * </ul>
- *
- */
-public class AccessControlModule extends AbstractInputModule implements Serviceable {
-
- /**
- * <code>USER_ID</code> The user id
- */
- public static final String USER_ID = "user-id";
- /**
- * <code>USER_NAME</code> The user name, optional: provide the user ID after a colon
- */
- public static final String USER_NAME = "user-name";
- /**
- * <code>USER_EMAIL</code> The user email, optional: provide the user ID after a colon
- */
- public static final String USER_EMAIL = "user-email";
- /**
- * <code>IP_ADDRESS</code> The IP address
- */
- public static final String IP_ADDRESS = "ip-address";
- /**
- * <code>ROLE_IDS</code> The role ids
- */
- public static final String ROLE_IDS = "role-ids";
- /**
- * <code>USER_MANAGER</code> The user manager
- */
- public static final String USER_MANAGER = "user-manager";
- /**
- * <code>GROUP_MANAGER</code> The group manager
- */
- public static final String GROUP_MANAGER = "group-manager";
- /**
- * <code>ROLE_MANAGER</code> The role manager
- */
- public static final String ROLE_MANAGER = "role-manager";
- /**
- * <code>IP_RANGE_MANAGER</code> The IP range manager
- */
- public static final String IP_RANGE_MANAGER = "iprange-manager";
- /**
- * Returns if the current page is SSL protected (true|false).
- */
- public static final String SSL = "ssl";
-
- /**
- * The names of the AccessControlModule parameters.
- */
- static final String[] PARAMETER_NAMES = { IP_ADDRESS, USER_ID, USER_NAME, USER_EMAIL, ROLE_IDS,
- USER_MANAGER, GROUP_MANAGER, ROLE_MANAGER, IP_RANGE_MANAGER, SSL };
-
- /**
- *
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object getAttribute(String attribute, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
-
- Request request = ObjectModelHelper.getRequest(objectModel);
- Session session = request.getSession();
- Object value = null;
-
- String[] parameters = attribute.split(":", 2);
- String name = parameters[0];
-
- if (!Arrays.asList(PARAMETER_NAMES).contains(name)) {
- throw new ConfigurationException("The attribute [" + name + "] is not supported!");
- }
-
- Identity identity = null;
-
- if (session != null) {
- identity = (Identity) session.getAttribute(Identity.class.getName());
- }
- User user = getUser(request, parameters, identity);
-
- if (user != null) {
- if (name.equals(USER_NAME)) {
- value = user.getName();
- } else if (name.equals(USER_EMAIL)) {
- value = user.getEmail();
- }
- }
-
- if (identity != null) {
- if (name.equals(USER_ID)) {
- User currentUser = identity.getUser();
- if (currentUser != null) {
- value = currentUser.getId();
- }
- } else if (name.equals(IP_ADDRESS)) {
- Machine machine = identity.getMachine();
- if (machine != null) {
- value = machine.getIp();
- }
- } else if (name.equals(ROLE_IDS)) {
- try {
- Role[] roles = PolicyUtil.getRoles(request);
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < roles.length; i++) {
- if (i > 0) {
- buf.append(",");
- }
- buf.append(roles[i].getId());
- }
- value = buf.toString();
- } catch (AccessControlException e) {
- throw new ConfigurationException("Obtaining value for attribute [" + name
- + "] failed: ", e);
- }
- }
- }
-
- if (name.equals(USER_MANAGER) || name.equals(GROUP_MANAGER) || name.equals(ROLE_MANAGER)
- || name.equals(IP_RANGE_MANAGER)) {
- value = getItemManager(request, name);
- }
-
- if (name.equals(SSL)) {
- ServiceSelector selector = null;
- AccessControllerResolver acResolver = null;
- AccessController accessController = null;
- try {
- selector = (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE
- + "Selector");
- acResolver
- = (AccessControllerResolver) selector.select(AccessControllerResolver.DEFAULT_RESOLVER);
-
- String url = ServletHelper.getWebappURI(request);
- accessController = acResolver.resolveAccessController(url);
- AccreditableManager accreditableManager = accessController.getAccreditableManager();
- PolicyManager policyManager = accessController.getPolicyManager();
-
- Policy policy = policyManager.getPolicy(accreditableManager, url);
- value = Boolean.toString(policy.isSSLProtected());
- }
- catch (Exception e) {
- throw new ConfigurationException("Resolving attribute [" + name + "] failed: ", e);
- }
- finally {
- if (selector != null) {
- if (acResolver != null) {
- if (accessController != null) {
- acResolver.release(accessController);
- }
- selector.release(acResolver);
- }
- this.manager.release(selector);
- }
- }
- }
-
- return value;
- }
-
- /**
- * Returns the user specified with parameter[1], falling back to the currently logged in user.
- * @param request The request.
- * @param parameters The parameters.
- * @param identity The logged in identity.
- * @return A user or <code>null</code> if no user is specified or logged in.
- * @throws ConfigurationException if an error occurs.
- */
- protected User getUser(Request request, String[] parameters, Identity identity)
- throws ConfigurationException {
- User user = null;
- if (parameters.length == 1) {
- if (identity != null) {
- user = identity.getUser();
- }
- } else {
- String userId = parameters[1];
- if (!userId.equals("")) {
- UserManager userManager = (UserManager) getItemManager(request, USER_MANAGER);
- user = userManager.getUser(userId);
- }
- }
- return user;
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration,
- * java.util.Map)
- */
- public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- return Arrays.asList(PARAMETER_NAMES).iterator();
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeValues(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration, java.util.Map)
- */
- public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- Object[] objects = { getAttribute(name, modeConf, objectModel) };
-
- return objects;
- }
-
- /**
- * Returns the item manager for a certain name.
- * @param request The request.
- * @param name The name of the manager ({@link #USER_MANAGER}, {@link #ROLE_MANAGER},
- * {@link #GROUP_MANAGER}, or {@link #IP_RANGE_MANAGER}
- * @return An item manager.
- * @throws ConfigurationException when something went wrong.
- */
- protected ItemManager getItemManager(Request request, String name)
- throws ConfigurationException {
- AccessController accessController = null;
- ServiceSelector selector = null;
- AccessControllerResolver resolver = null;
- ItemManager itemManager = null;
-
- try {
- selector = (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE
- + "Selector");
- resolver = (AccessControllerResolver) selector
- .select(AccessControllerResolver.DEFAULT_RESOLVER);
-
- String requestURI = request.getRequestURI();
- String context = request.getContextPath();
- if (context == null) {
- context = "";
- }
- String url = requestURI.substring(context.length());
- accessController = resolver.resolveAccessController(url);
-
- AccreditableManager accreditableManager = accessController.getAccreditableManager();
-
- if (name.equals(USER_MANAGER)) {
- itemManager = accreditableManager.getUserManager();
- } else if (name.equals(GROUP_MANAGER)) {
- itemManager = accreditableManager.getGroupManager();
- } else if (name.equals(ROLE_MANAGER)) {
- itemManager = accreditableManager.getRoleManager();
- } else if (name.equals(IP_RANGE_MANAGER)) {
- itemManager = accreditableManager.getIPRangeManager();
- }
-
- } catch (Exception e) {
- throw new ConfigurationException("Obtaining item manager failed: ", e);
- } finally {
- if (selector != null) {
- if (resolver != null) {
- if (accessController != null) {
- resolver.release(accessController);
- }
- selector.release(resolver);
- }
- this.manager.release(selector);
- }
- }
-
- return itemManager;
- }
-
- private ServiceManager manager;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager _manager) throws ServiceException {
- this.manager = _manager;
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/file/FileGroupTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/file/FileGroupTest.java
deleted file mode 100644
index b725c7e..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/file/FileGroupTest.java
+++ /dev/null
@@ -1,104 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.Groupable;
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.xml.sax.SAXException;
-
-/**
- * Test for file-based groups
- */
-public class FileGroupTest extends AbstractAccessControlTest {
-
- /**
- * <code>GROUP_ID</code> The group id
- */
- public static final String GROUP_ID = "testGroup";
-
- /**
- * Runs the test
- *
- * @throws AccessControlException if an AC error occurs
- * @throws ConfigurationException if an error with the configuration occurs
- * @throws SAXException if a parsing error occurs
- * @throws IOException if an IO error occurs
- */
- final public void testFileGroup() throws AccessControlException, ConfigurationException,
- SAXException, IOException {
-
- FileGroup group = getGroup();
- group.save();
-
- File groupFile = new File(getAccreditablesDirectory(), GROUP_ID + FileGroupManager.SUFFIX);
- assertNotNull(groupFile);
- assertTrue(groupFile.exists());
-
- Configuration config = null;
- config = new DefaultConfigurationBuilder().buildFromFile(groupFile);
- assertNotNull(config);
-
- FileGroup newGroup = null;
- newGroup = new FileGroup(getAccreditableManager().getGroupManager(), getLogger());
- newGroup.setConfigurationDirectory(getAccreditablesDirectory());
- newGroup.configure(config);
- assertNotNull(newGroup);
-
- assertTrue(newGroup.getId().equals(GROUP_ID));
-
- }
-
- /**
- * Test getGroup
- *
- * @return a <code>FileGroup</code>
- * @throws AccessControlException
- */
- protected FileGroup getGroup() throws AccessControlException {
- File configurationDirectory = getAccreditablesDirectory();
- getLogger().info("Configuration directory: " + configurationDirectory);
- FileGroup group = new FileGroup(getAccreditableManager().getGroupManager(), getLogger(),
- GROUP_ID);
- return group;
- }
-
- /**
- * Tests the removeAllMembers() method.
- * @throws AccessControlException
- */
- public void testRemoveAllMembers() throws AccessControlException {
- Group group = getGroup();
- Groupable members[] = group.getMembers();
- group.removeAllMembers();
- for (int i = 0; i < members.length; i++) {
- assertFalse(group.contains(members[i]));
- }
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/file/FileRoleTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/file/FileRoleTest.java
deleted file mode 100644
index 62a7f07..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/file/FileRoleTest.java
+++ /dev/null
@@ -1,92 +0,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.
- *
- */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-
-/**
- * File role test.
- *
- * @version $Id$
- */
-public class FileRoleTest extends AbstractAccessControlTest {
-
- /**
- * DOCUMENT ME!
- *
- * @throws AccessControlException DOCUMENT ME!
- */
- final public void testFileRole() throws AccessControlException {
- String name = "test";
- File configDir = getAccreditablesDirectory();
- FileRole role = new FileRole(getAccreditableManager().getRoleManager(), getLogger(), name);
- role.save();
-
- File path = null;
- path = FileRoleManager.instance(getAccreditableManager(), configDir, getLogger())
- .getConfigurationDirectory();
-
- File roleFile = new File(path, name + FileRoleManager.SUFFIX);
- assertNotNull(roleFile);
- assertTrue(roleFile.exists());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @throws AccessControlException DOCUMENT ME!
- */
- final public void testSave() throws AccessControlException {
- File configDir = getAccreditablesDirectory();
- String name = "test";
- FileRole role = new FileRole(getAccreditableManager().getRoleManager(), getLogger(), name);
- role.save();
-
- File path = null;
- path = FileRoleManager.instance(getAccreditableManager(), configDir, getLogger())
- .getConfigurationDirectory();
-
- File roleFile = new File(path, name + FileRoleManager.SUFFIX);
- assertNotNull(roleFile);
- assertTrue(roleFile.exists());
- }
-
- /**
- * DOCUMENT ME!
- * @throws AccessControlException
- */
- final public void testGetId() throws AccessControlException {
- String id = "test";
- FileRole role = new FileRole(getAccreditableManager().getRoleManager(), getLogger(), id);
- assertTrue(role.getId().equals(id));
- }
-
- /**
- * Test for boolean equals(Object)
- * @throws AccessControlException
- */
- final public void testEqualsObject() throws AccessControlException {
- String name = "test";
- FileRole role1 = new FileRole(getAccreditableManager().getRoleManager(), getLogger(), name);
- FileRole role2 = new FileRole(getAccreditableManager().getRoleManager(), getLogger(), name);
- assertEquals(role1, role2);
- }
-}
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/file/FileUserTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/file/FileUserTest.java
deleted file mode 100644
index 5f674c3..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/file/FileUserTest.java
+++ /dev/null
@@ -1,232 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.file;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.UserType;
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-
-/**
- * File user test.
- *
- * @version $Id$
- */
-public class FileUserTest extends AbstractAccessControlTest {
- private HashMap groups = new HashMap();
-
- /**
- * (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
- }
-
- /**
- * Get all Groups
- *
- * @return A map of the groups
- */
- final public Map getGroups() {
- return this.groups;
- }
-
- /**
- * Create and save a user
- *
- * @param userName The user name
- * @param fullName The full name
- * @param email The email
- * @param password The password
- *
- * @return a <code>FileUser</code>
- *
- * @throws AccessControlException if an error occurs
- */
- final public FileUser createAndSaveUser(String userName, String fullName, String email,
- String password) throws AccessControlException {
-
- String editorGroupName = "editorGroup";
- String adminGroupName = "adminGroup";
-
- FileGroup editorGroup = new FileGroup(getAccreditableManager().getGroupManager(),
- getLogger(), editorGroupName);
- ContainerUtil.enableLogging(editorGroup, getLogger());
- FileGroup adminGroup = new FileGroup(getAccreditableManager().getGroupManager(),
- getLogger(), adminGroupName);
- ContainerUtil.enableLogging(adminGroup, getLogger());
- this.groups.put(editorGroupName, editorGroup);
- this.groups.put(adminGroupName, adminGroup);
-
- FileUser user = new FileUser(getAccreditableManager().getUserManager(), getLogger(),
- userName, fullName, email, password);
- ContainerUtil.enableLogging(user, getLogger());
-
- editorGroup.add(user);
- adminGroup.add(user);
-
- editorGroup.save();
- adminGroup.save();
- user.save();
-
- FileUserManager _manager = getUserManager();
- _manager.add(user);
-
- return user;
- }
-
- /**
- * Returns the file user manager.
- * @return A file user manager.
- * @throws AccessControlException if an error occurs.
- */
- protected FileUserManager getUserManager() throws AccessControlException {
- UserType[] userTypes = { FileAccreditableManager.getDefaultUserType() };
- FileUserManager _manager = FileUserManager.instance(getAccreditableManager(),
- getAccreditablesDirectory(), userTypes, getLogger());
- return _manager;
- }
-
- /**
- * Load a user.
- *
- * @param userName the name of the user
- *
- * @return a <code>FileUser</code>
- *
- * @throws AccessControlException if an error occurs
- */
- final public FileUser loadUser(String userName) throws AccessControlException {
- FileUserManager _manager = getUserManager();
- return (FileUser) _manager.getUser(userName);
- }
-
- /**
- * Test save
- *
- * @throws AccessControlException if an error occurs
- */
- final public void testSave() throws AccessControlException {
- String userName = "aliceTest";
- createAndSaveUser(userName, "Alice Wonderland", "alice@wonderland.org", "secret");
-
- File configDir = getAccreditablesDirectory();
- File xmlFile = new File(configDir, userName + ".iml");
- assertTrue(xmlFile.exists());
- }
-
- /**
- * Test getEmail
- *
- * @throws AccessControlException if an error occurs
- */
- final public void testGetEmail() throws AccessControlException {
- String userID = "aliceTest";
- String email = "alice@wonderland.org";
- User user = createAndSaveUser(userID, "Alice Wonderland", email, "secret");
- assertTrue(user.getEmail().equals(email));
- user = loadUser(userID);
- assertTrue(user.getEmail().equals(email));
- }
-
- /**
- * Test getName
- *
- * @throws AccessControlException if an error occurs
- */
- final public void testGetName() throws AccessControlException {
- String userID = "aliceTest";
- String userName = "Alice Wonderland";
- FileUser user = createAndSaveUser(userID, userName, "alice@wonderland.org", "secret");
- assertTrue(user.getName().equals(userName));
- user = loadUser(userID);
- assertTrue(user.getName().equals(userName));
- }
-
- /**
- * Test getGroups
- *
- * @throws AccessControlException if an error occurs
- */
- final public void testGetGroups() throws AccessControlException {
- FileUser user = createAndSaveUser("aliceTest", "Alice Wonderland", "alice@wonderland.org",
- "secret");
-
- for (Iterator i = getGroups().values().iterator(); i.hasNext();) {
- Group group = (Group) i.next();
- assertTrue(group.contains(user));
- }
- }
-
- /**
- * Test getId
- *
- * @throws AccessControlException if an error occurs
- */
- final public void testGetId() throws AccessControlException {
- String id = "aliceTest";
- FileUser user = createAndSaveUser(id, "Alice Wonderland", "alice@wonderland.org", "secret");
- assertTrue(user.getId().equals(id));
- }
-
- /**
- * Test delete
- *
- * @throws AccessControlException if an error occurs
- */
- final public void testDelete() throws AccessControlException {
- String id = "albert";
- FileUser user = createAndSaveUser(id, "Albert Einstein", "albert@physics.org", "secret");
- FileUserManager _manager = getUserManager();
- assertNotNull(_manager);
-
- assertNotNull(_manager.getUser(id));
- user.delete();
- _manager.remove(user);
- assertNull(_manager.getUser(id));
- }
-
- /**
- * Test authenticate
- *
- * @throws AccessControlException if an error occurs
- */
- final public void testAuthenticate() throws AccessControlException {
- String password = "daisy";
- FileUser user = createAndSaveUser("mickey", "Mickey Mouse", "mickey@mouse.com", password);
- assertTrue(user.authenticate(password));
-
- FileUserManager _manager = getUserManager();
- assertNotNull(_manager);
-
- User lenya = _manager.getUser("lenya");
- assertNotNull(lenya);
- assertTrue(lenya.authenticate("levi"));
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/AccessControllerTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/AccessControllerTest.java
deleted file mode 100644
index 87f6636..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/AccessControllerTest.java
+++ /dev/null
@@ -1,35 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-/**
- * Access controller test
- */
-public class AccessControllerTest extends AbstractAccessControlTest {
-
- /**
- * The test.
- */
- public void testAccessController() {
- assertNotNull(getAccessController());
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/AccreditableManagerTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/AccreditableManagerTest.java
deleted file mode 100644
index e5ff1d4..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/AccreditableManagerTest.java
+++ /dev/null
@@ -1,55 +0,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.
-*/
-package org.apache.lenya.ac.impl;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccreditableManager;
-
-/**
- * Test class for the Accreditable Manager
- */
-public class AccreditableManagerTest extends AccessControllerTest {
-
- private AccreditableManager accreditableManager;
-
- protected static final String HINT = "file";
-
- /**
- * The JUnit setup method. Lookup the resolver role.
- *
- * @exception Exception Description of Exception
- * @since
- */
- public void setUp() throws Exception {
- super.setUp();
-
- this.accreditableManager = getAccessController().getAccreditableManager();
-
- assertNotNull("AccreditableManager is null", this.accreditableManager);
- }
-
- /**
- * The test.
- * @throws AccessControlException when something went wrong.
- */
- public void testAccreditableManager() throws AccessControlException {
- assertNotNull(this.accreditableManager.getUserManager());
- assertNotNull(this.accreditableManager.getGroupManager());
- assertNotNull(this.accreditableManager.getRoleManager());
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/GroupManagerTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/GroupManagerTest.java
deleted file mode 100644
index edf51b5..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/GroupManagerTest.java
+++ /dev/null
@@ -1,48 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import java.io.File;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.file.FileGroupManager;
-
-/**
- * Group manager test.
- *
- * @version $Id$
- */
-public class GroupManagerTest extends AbstractAccessControlTest {
-
- /**
- * The test
- * @throws AccessControlException if an error occurs
- */
- public final void testInstance() throws AccessControlException {
- FileGroupManager _manager = null;
- File configDir = getAccreditablesDirectory();
- _manager = FileGroupManager.instance(getAccreditableManager(), configDir, getLogger());
- assertNotNull(_manager);
-
- FileGroupManager anotherManager = null;
- anotherManager = FileGroupManager.instance(getAccreditableManager(), configDir, getLogger());
- assertNotNull(anotherManager);
- assertEquals(_manager, anotherManager);
- }
-}
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/IdentityTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/IdentityTest.java
deleted file mode 100644
index b49d7ae..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/IdentityTest.java
+++ /dev/null
@@ -1,73 +0,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.
-*/
-package org.apache.lenya.ac.impl;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.User;
-
-/**
- * Tests the identity
- */
-public class IdentityTest extends AbstractAccessControlTest {
-
- /**
- * <code>USER_ID</code> The user id to test
- */
- public static final String USER_ID = "lenya";
-
- /**
- * Tests the identity.
- *
- * @throws AccessControlException if an error occurs
- */
- public void testIdentity() throws AccessControlException {
- Identity identity = new Identity(getLogger());
- User user = getAccessController().getAccreditableManager().getUserManager().getUser(USER_ID);
- getLogger().info("Adding user to identity: [" + user + "]");
- identity.addIdentifiable(user);
-
- assertSame(user, identity.getUser());
- }
-
- /**
- * Test the {@link Identity#belongsTo(org.apache.lenya.ac.AccreditableManager)} method.
- * @throws Exception if an error occurs.
- */
- public void testBelongsTo() throws Exception {
- AccreditableManager testMgr = getAccessController(getSession(), "test").getAccreditableManager();
- AccreditableManager defaultMgr = getAccessController(getSession(), "default").getAccreditableManager();
-
- String userId = "lenya";
- User testUser = testMgr.getUserManager().getUser(userId);
- User defaultUser = defaultMgr.getUserManager().getUser(userId);
-
- Identity testIdentity = new Identity(getLogger());
- testIdentity.addIdentifiable(testUser);
-
- Identity defaultIdentity = new Identity(getLogger());
- defaultIdentity.addIdentifiable(defaultUser);
-
- assertTrue(testIdentity.belongsTo(testMgr));
- assertTrue(defaultIdentity.belongsTo(defaultMgr));
-
- assertTrue(testIdentity.belongsTo(defaultMgr));
- assertTrue(defaultIdentity.belongsTo(testMgr));
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/PolicyManagerTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/PolicyManagerTest.java
deleted file mode 100644
index 05abb31..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/PolicyManagerTest.java
+++ /dev/null
@@ -1,70 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.UserManager;
-import org.apache.lenya.cms.ac.PolicyUtil;
-
-/**
- * Test for the Policy Manager
- */
-public class PolicyManagerTest extends AbstractAccessControlTest {
-
- private static String[] URLS = { "/default/authoring/index.html" };
-
- /**
- * The test.
- * @throws AccessControlException when something went wrong.
- */
- public void testPolicyManager() throws AccessControlException {
-
- DefaultAccessController controller = getAccessController();
- PolicyManager policyManager = controller.getPolicyManager();
- assertNotNull(policyManager);
-
- for (int i = 0; i < URLS.length; i++) {
- Policy policy = policyManager.getPolicy(controller.getAccreditableManager(), URLS[i]);
- assertNotNull(policy);
-
- Role[] roles = policyManager.getGrantedRoles(controller.getAccreditableManager(), getIdentity(), URLS[i]);
- assertTrue(roles.length > 0);
-
- User[] users = PolicyUtil.getUsersWithRole(getManager(), URLS[i], "review", getLogger());
-
- UserManager userManager = controller.getAccreditableManager().getUserManager();
- User lenya = userManager.getUser("lenya");
- User alice = userManager.getUser("alice");
-
- List usersList = Arrays.asList(users);
- assertFalse(usersList.contains(lenya));
- assertTrue(usersList.contains(alice));
- }
- }
-
-}
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/PolicyTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/PolicyTest.java
deleted file mode 100644
index 3689a93..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/PolicyTest.java
+++ /dev/null
@@ -1,134 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.impl;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Credential;
-import org.apache.lenya.ac.InheritingPolicyManager;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-
-/**
- * Policy Test
- *
- */
-public class PolicyTest extends AbstractAccessControlTest {
- protected static final String URL = "/test/authoring/index.html";
-
- protected static final String SAVE_URL = "/test/authoring/tutorial.html";
-
- /**
- * A test.
- *
- * @throws AccessControlException when something went wrong.
- * @throws PublicationException
- */
- public void testLoadPolicy() throws AccessControlException, PublicationException {
- Publication pub = getPublication("test");
- String url = "/" + pub.getId() + URL;
- Policy policy = getPolicy(url);
-
- Role[] allRoles = getAccreditableManager().getRoleManager().getRoles();
-
- getLogger().info("Roles: ");
- for (int i = 0; i < allRoles.length; i++) {
- int result = policy.check(getIdentity(), allRoles[i]);
- if (result == Policy.RESULT_GRANTED) {
- getLogger().info(allRoles[i].getId() + ": granted");
- }
- else {
- getLogger().info(allRoles[i].getId() + ": denied");
- }
- }
- }
-
- /**
- * Returns the policy for a URL.
- *
- * @param url The URL.
- * @return The policy.
- * @throws AccessControlException when something went wrong.
- */
- protected Policy getPolicy(String url) throws AccessControlException {
- Policy policy = getPolicyManager().getPolicy(
- getAccessController().getAccreditableManager(), url);
-
- return policy;
- }
-
- /**
- * A test.
- *
- * @throws AccessControlException when something went wrong.
- */
- public void testSavePolicy() throws AccessControlException {
- InheritingPolicyManager policyManager = (InheritingPolicyManager) getPolicyManager();
- DefaultPolicy subtreePolicy = (DefaultPolicy) policyManager.buildSubtreePolicy(
- getAccessController().getAccreditableManager(), URL);
- DefaultPolicy newPolicy = new DefaultPolicy();
-
- Credential[] credentials = subtreePolicy.getCredentials();
-
- for (int i = 0; i < credentials.length; i++) {
- Role role = credentials[i].getRole();
- CredentialImpl credential = new CredentialImpl(credentials[i].getAccreditable(), role);
- credential.setMethod(credentials[i].getMethod());
- newPolicy.addCredential(credential);
- }
-
- assertEquals(subtreePolicy.getCredentials().length, newPolicy.getCredentials().length);
-
- policyManager.saveSubtreePolicy(SAVE_URL, newPolicy);
-
- newPolicy = (DefaultPolicy) policyManager.buildSubtreePolicy(getAccessController()
- .getAccreditableManager(), SAVE_URL);
- assertEquals(subtreePolicy.getCredentials().length, newPolicy.getCredentials().length);
-
- Credential[] newCredentials = newPolicy.getCredentials();
-
- for (int i = 0; i < credentials.length; i++) {
- Role role = credentials[i].getRole();
- CredentialImpl credential = new CredentialImpl(credentials[i].getAccreditable(), role);
- credential.setMethod(credential.getMethod());
- Credential newCredential = null;
-
- for (int k = 0; k < newCredentials.length; k++) {
- if (newCredentials[k].getAccreditable().equals(credential.getAccreditable())) {
- newCredential = newCredentials[k];
- }
- }
-
- getLogger().info("Accreditable: [" + credential.getAccreditable() + "]");
- assertNotNull(newCredential);
-
- Role oldRole = credential.getRole();
- Role newRole = newCredential.getRole();
- assertEquals(oldRole, newRole);
-
- /*
- * for (int j = 0; j < roles.length; j++) { assertEquals(roles[j],
- * newRoles[j]); getLogger().info(" Role: [" + roles[j] + "]"); }
- */
- }
- }
-}
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/RoleManagerTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/RoleManagerTest.java
deleted file mode 100644
index a7ac6c4..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/RoleManagerTest.java
+++ /dev/null
@@ -1,100 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import java.io.File;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.file.FileRole;
-import org.apache.lenya.ac.file.FileRoleManager;
-
-/**
- * Role manager test.
- *
- * @version $Id$
- */
-public class RoleManagerTest extends AbstractAccessControlTest {
-
- /**
- * Run the test
- * @throws AccessControlException if an error occurs
- */
- final public void testInstance() throws AccessControlException {
- File configDir = getAccreditablesDirectory();
- FileRoleManager _manager = FileRoleManager.instance(getAccreditableManager(), configDir, getLogger());
- assertNotNull(_manager);
-
- FileRoleManager anotherManager = FileRoleManager.instance(getAccreditableManager(), configDir, getLogger());
- assertNotNull(anotherManager);
- assertEquals(_manager, anotherManager);
- }
-
- /**
- * Test getRoles()
- */
- final public void testGetRoles() {
- // do nothing
- }
-
- /**
- * Test add(Role)
- * @throws AccessControlException if an error occurs
- */
- final public void testAddRole() throws AccessControlException {
- File configDir = getAccreditablesDirectory();
- String name = "test";
- FileRoleManager _manager = null;
- _manager = FileRoleManager.instance(getAccreditableManager(), configDir, getLogger());
- assertNotNull(_manager);
- Role role = new FileRole(getAccreditableManager().getRoleManager(), getLogger(), name);
- _manager.add(role);
-
- assertTrue(_manager.getRoles().length > 0);
- }
-
- /**
- * Test for void remove(Role)
- * @throws AccessControlException if an error occurs.
- */
- final public void testRemoveRole() throws AccessControlException {
- File configDir = getAccreditablesDirectory();
- String name = "test2";
- Role role = new FileRole(getAccreditableManager().getRoleManager(), getLogger(), name);
- FileRoleManager _manager = null;
-
- try {
- _manager = FileRoleManager.instance(getAccreditableManager(), configDir, getLogger());
- } catch (AccessControlException e) {
- e.printStackTrace();
- }
-
- assertNotNull(_manager);
-
- Role[] roles = _manager.getRoles();
- int roleCountBefore = roles.length;
-
- _manager.add(role);
- _manager.remove(role);
-
- roles = _manager.getRoles();
- int roleCountAfter = roles.length;
-
- assertEquals(roleCountBefore, roleCountAfter);
- }
-}
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/UserManagerTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/UserManagerTest.java
deleted file mode 100644
index 7b70c9f..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/ac/impl/UserManagerTest.java
+++ /dev/null
@@ -1,135 +0,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.
- *
- */
-
-package org.apache.lenya.ac.impl;
-
-import java.io.File;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.UserManager;
-import org.apache.lenya.ac.UserType;
-import org.apache.lenya.ac.file.FileAccreditableManager;
-import org.apache.lenya.ac.file.FileGroup;
-import org.apache.lenya.ac.file.FileGroupManager;
-import org.apache.lenya.ac.file.FileRole;
-import org.apache.lenya.ac.file.FileUser;
-import org.apache.lenya.ac.file.FileUserManager;
-
-/**
- * User manager test.
- *
- * @version $Id$
- */
-public class UserManagerTest extends AbstractAccessControlTest {
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
- }
-
- /**
- * Run the test
- * @throws AccessControlException if an error occurs
- */
- final public void testInstance() throws AccessControlException {
- UserManager _manager = getAccreditableManager().getUserManager();
- assertNotNull(_manager);
- }
-
- /**
- * Load the configuration for the test
- * @throws AccessControlException if an error occurs
- */
- final public void testLoadConfig() throws AccessControlException {
- FileAccreditableManager accreditableManager = (FileAccreditableManager) getAccreditableManager();
- File configDir = accreditableManager.getConfigurationDirectory();
-
- String userName = "aliceTest";
- String editorGroupId = "editorGroup";
- String adminGroupId = "adminGroup";
- String editorRoleId = "editorRole";
- String adminRoleId = "adminRole";
-
- FileRole editorRole = new FileRole(getAccreditableManager().getRoleManager(), getLogger(),
- editorRoleId);
- FileRole adminRole = new FileRole(getAccreditableManager().getRoleManager(), getLogger(),
- adminRoleId);
-
- User user = new FileUser(getAccreditableManager().getUserManager(), getLogger(), userName,
- "Alice in Wonderland", "alice@test.com", "secret");
-
- editorRole.save();
- adminRole.save();
-
- Group editorGroup = new FileGroup(getAccreditableManager().getGroupManager(), getLogger(),
- editorGroupId);
-
- // editorGroup.addRole(editorRole);
- editorGroup.add(user);
-
- FileGroup adminGroup = new FileGroup(getAccreditableManager().getGroupManager(),
- getLogger(), adminGroupId);
-
- // adminGroup.addRole(editorRole);
- // adminGroup.addRole(adminRole);
- editorGroup.save();
- adminGroup.save();
- adminGroup.add(user);
- user.save();
-
- FileGroupManager groupManager = null;
- UserManager userManager = getAccreditableManager().getUserManager();
- assertNotNull(userManager);
-
- groupManager = FileGroupManager.instance(getAccreditableManager(), configDir, getLogger());
- assertNotNull(groupManager);
-
- Group fetchedGroup = groupManager.getGroup(editorGroupId);
- assertTrue(editorGroup.equals(fetchedGroup));
-
- fetchedGroup = groupManager.getGroup(adminGroupId);
- assertTrue(adminGroup.equals(fetchedGroup));
- }
-
- /**
- * Test getUser()
- * @throws AccessControlException if an error occurs
- */
- final public void testGetUser() throws AccessControlException {
- FileAccreditableManager accrMgr = (FileAccreditableManager) getAccreditableManager();
- File configDir = accrMgr.getConfigurationDirectory();
- String userName = "aliceTest";
- FileUser user = new FileUser(getAccreditableManager().getUserManager(), getLogger(),
- userName, "Alice in Wonderland", "alice@wonderland.com", "secret");
- UserType[] userTypes = { FileAccreditableManager.getDefaultUserType() };
- FileUserManager _manager = FileUserManager.instance(getAccreditableManager(), configDir,
- userTypes, getLogger());
- assertNotNull(_manager);
- _manager.add(user);
-
- User otherUser = _manager.getUser(userName);
- assertEquals(user, otherUser);
- assertEquals(user.getDescription(), otherUser.getDescription());
- assertEquals(user.getEmail(), otherUser.getEmail());
- assertEquals(user.getEncryptedPassword(), ((AbstractUser) otherUser).getEncryptedPassword());
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/ac/java/test/org/apache/lenya/cms/ac/usecases/LoginTest.java b/trunk/src/modules-core/ac/java/test/org/apache/lenya/cms/ac/usecases/LoginTest.java
deleted file mode 100644
index 9fde0af..0000000
--- a/trunk/src/modules-core/ac/java/test/org/apache/lenya/cms/ac/usecases/LoginTest.java
+++ /dev/null
@@ -1,64 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.cocoon.environment.Session;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.usecase.AbstractUsecaseTest;
-
-/**
- * Login test.
- */
-public class LoginTest extends AbstractUsecaseTest {
-
- protected static final String USER_ID = "lenya";
- protected static final String PASSWORD = "levi";
-
- protected Map getRequestParameters() {
- return getParameters();
- }
-
- protected Map getParameters() {
- Map params = new HashMap();
- params.put(Login.USERNAME, USER_ID);
- params.put(Login.PASSWORD, PASSWORD);
- return params;
- }
-
- protected String getUsecaseName() {
- return "ac.login";
- }
-
- protected void checkPostconditions() {
- Session session = getRequest().getSession();
- Identity identity = (Identity) session.getAttribute(Identity.class.getName());
- User user = identity.getUser();
- assertNotNull(user);
- assertEquals(user.getId(), USER_ID);
- }
-
- protected void login() throws AccessControlException {
- getAccessController().setupIdentity(getRequest());
- }
-
-}
diff --git a/trunk/src/modules-core/acusecases/config/cocoon-xconf/usecase-ac-login.xconf b/trunk/src/modules-core/acusecases/config/cocoon-xconf/usecase-ac-login.xconf
deleted file mode 100644
index e1868fe..0000000
--- a/trunk/src/modules-core/acusecases/config/cocoon-xconf/usecase-ac-login.xconf
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'ac.login']">
-
- <component-instance name="ac.login" logger="lenya.ac" class="org.apache.lenya.cms.ac.usecases.Login">
- <view uri="modules/acusecases/usecases/login.jx"/>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/acusecases/config/cocoon-xconf/usecase-ac-logout.xconf b/trunk/src/modules-core/acusecases/config/cocoon-xconf/usecase-ac-logout.xconf
deleted file mode 100644
index f2bcf9f..0000000
--- a/trunk/src/modules-core/acusecases/config/cocoon-xconf/usecase-ac-logout.xconf
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'ac.logout']">
-
- <component-instance name="ac.logout" logger="lenya.ac" class="org.apache.lenya.cms.ac.usecases.Logout">
- <view uri="modules/acusecases/usecases/logout.jx"/>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/acusecases/config/module.xml b/trunk/src/modules-core/acusecases/config/module.xml
deleted file mode 100644
index 23ce84f..0000000
--- a/trunk/src/modules-core/acusecases/config/module.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.acusecases</id>
- <export package="org.apache.lenya.cms.ac.usecases"/>
- <depends module="org.apache.lenya.modules.usecase"/>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>Access control usecases</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>Access control usecases</description>
-</module>
diff --git a/trunk/src/modules-core/acusecases/java/src/org/apache/lenya/cms/ac/usecases/AccessControlUsecase.java b/trunk/src/modules-core/acusecases/java/src/org/apache/lenya/cms/ac/usecases/AccessControlUsecase.java
deleted file mode 100644
index 5e01416..0000000
--- a/trunk/src/modules-core/acusecases/java/src/org/apache/lenya/cms/ac/usecases/AccessControlUsecase.java
+++ /dev/null
@@ -1,151 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.AccessControllerResolver;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.GroupManager;
-import org.apache.lenya.ac.IPRangeManager;
-import org.apache.lenya.ac.RoleManager;
-import org.apache.lenya.ac.UserManager;
-import org.apache.lenya.cms.usecase.AbstractUsecase;
-
-/**
- * Super class for access-control related usecases.
- *
- * @version $Id: AccessControlUsecase.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class AccessControlUsecase extends AbstractUsecase {
-
- /**
- * Ctor.
- */
- public AccessControlUsecase() {
- super();
- }
-
- private UserManager userManager;
- private GroupManager groupManager;
- private IPRangeManager ipRangeManager;
- private RoleManager roleManager;
- private AccessController accessController;
-
- /**
- * Initializes the accreditable managers. FIXME: This method resolves the
- * AccessController, it has to be released after it is used!
- */
- protected void initializeAccessController() {
- super.doInitialize();
-
- if (getLogger().isDebugEnabled())
- getLogger().debug("initializeAccessController() called");
-
- this.accessController = null;
- ServiceSelector selector = null;
- AccessControllerResolver resolver = null;
-
- try {
- selector = (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE
- + "Selector");
- resolver = (AccessControllerResolver) selector
- .select(AccessControllerResolver.DEFAULT_RESOLVER);
-
- this.accessController = resolver.resolveAccessController(getSourceURL());
-
- if (this.accessController == null) {
- throw new RuntimeException("No access controller could be resolved for URL ["
- + getSourceURL() + "].");
- }
-
- AccreditableManager accreditableManager = this.accessController
- .getAccreditableManager();
-
- this.userManager = accreditableManager.getUserManager();
- this.groupManager = accreditableManager.getGroupManager();
- this.roleManager = accreditableManager.getRoleManager();
- this.ipRangeManager = accreditableManager.getIPRangeManager();
-
- } catch (Exception e) {
- throw new RuntimeException("Initialization failed: ", e);
- } finally {
- if (selector != null) {
- if (resolver != null) {
- selector.release(resolver);
- }
- this.manager.release(selector);
- }
- }
-
- }
-
- /**
- * @return Returns the groupManager.
- */
- protected GroupManager getGroupManager() {
- if (this.groupManager == null) {
- initializeAccessController();
- }
- return this.groupManager;
- }
-
- /**
- * @return Returns the ipRangeManager.
- */
- protected IPRangeManager getIpRangeManager() {
- if (this.ipRangeManager == null) {
- initializeAccessController();
- }
- return this.ipRangeManager;
- }
-
- /**
- * @return Returns the roleManager.
- */
- protected RoleManager getRoleManager() {
- if (this.roleManager == null) {
- initializeAccessController();
- }
- return this.roleManager;
- }
-
- /**
- * @return Returns the userManager.
- */
- protected UserManager getUserManager() {
- if (this.userManager == null) {
- if (getLogger().isDebugEnabled())
- getLogger()
- .debug(
- "getUserManager() accessed, is null, so calling initializeAccessController");
- initializeAccessController();
- }
- return this.userManager;
- }
-
- /**
- * @return Returns the accessController.
- */
- protected AccessController getAccessController() {
- if (this.accessController == null) {
- initializeAccessController();
- }
- return this.accessController;
- }
-}
diff --git a/trunk/src/modules-core/acusecases/java/src/org/apache/lenya/cms/ac/usecases/Login.java b/trunk/src/modules-core/acusecases/java/src/org/apache/lenya/cms/ac/usecases/Login.java
deleted file mode 100644
index c190373..0000000
--- a/trunk/src/modules-core/acusecases/java/src/org/apache/lenya/cms/ac/usecases/Login.java
+++ /dev/null
@@ -1,122 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.Map;
-
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.usecase.UsecaseException;
-
-/**
- * Usecase to login a user.
- *
- * @version $Id: Login.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class Login extends AccessControlUsecase {
-
- protected static final String HISTORY_SESSION_ATTRIBUTE = "org.apache.lenya.cms.cocoon.acting.History";
- protected static final String PASSWORD = "password";
- protected static final String USERNAME = "username";
- protected static final String REFERRER_QUERY_STRING = "referrerQueryString";
- protected static final String PUBLICATION = "publication";
- protected static final String CURRENT_USER = "currentUser";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- Publication publication;
-
- try {
- publication = PublicationUtil.getPublicationFromUrl(this.manager, getDocumentFactory(),
- getSourceURL());
- if (publication.exists()) {
- setParameter(PUBLICATION, publication);
- }
- Identity identity = this.getSession().getIdentity();
- if (identity != null && identity.getUser() != null) {
- setParameter(CURRENT_USER, this.getSession().getIdentity().getUser());
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Ctor.
- */
- public Login() {
- super();
- }
-
- /**
- * Validates the request parameters.
- * @throws UsecaseException if an error occurs.
- */
- void validate() throws UsecaseException {
-
- String userId = getParameterAsString(USERNAME);
- String password = getParameterAsString(PASSWORD);
-
- if (userId.length() == 0) {
- addErrorMessage("Please enter a user name.");
- }
- if (password.length() == 0) {
- addErrorMessage("Please enter a password.");
- }
-
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
-
- validate();
-
- if (!hasErrors()) {
- Map objectModel = ContextHelper.getObjectModel(getContext());
- Request request = ObjectModelHelper.getRequest(objectModel);
- request.getSession(true);
- if (getAccessController().authenticate(request)) {
- request.getSession(false).removeAttribute(HISTORY_SESSION_ATTRIBUTE);
- setDefaultTargetURL(request.getPathInfo());
- } else {
- addErrorMessage("Authentication failed");
- }
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#getExitQueryString()
- */
- protected String getExitQueryString() {
- String queryString = getParameterAsString(REFERRER_QUERY_STRING);
- if (queryString != null && !queryString.equals("")) {
- queryString = "?" + queryString;
- }
- return queryString;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/acusecases/java/src/org/apache/lenya/cms/ac/usecases/Logout.java b/trunk/src/modules-core/acusecases/java/src/org/apache/lenya/cms/ac/usecases/Logout.java
deleted file mode 100644
index b6fd987..0000000
--- a/trunk/src/modules-core/acusecases/java/src/org/apache/lenya/cms/ac/usecases/Logout.java
+++ /dev/null
@@ -1,68 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.Map;
-import java.util.Vector;
-
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Session;
-
-/**
- * Usecase to log a user out.
- *
- * @version $Id: Logout.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class Logout extends AccessControlUsecase {
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
- Map objectModel = ContextHelper.getObjectModel(getContext());
- Request request = ObjectModelHelper.getRequest(objectModel);
- Session session = request.getSession(false);
-
- if (session != null) {
- Vector history = (Vector) session
- .getAttribute(Login.HISTORY_SESSION_ATTRIBUTE);
- setParameter("history", history.toArray());
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
-
- Map objectModel = ContextHelper.getObjectModel(getContext());
- Request request = ObjectModelHelper.getRequest(objectModel);
- Session session = request.getSession(false);
-
- if (session != null) {
- session.removeAttribute(Identity.class.getName());
- RepositoryUtil.removeSession(manager, request);
- session.removeAttribute(Login.HISTORY_SESSION_ATTRIBUTE);
- }
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/acusecases/resources/i18n/cmsui.xml b/trunk/src/modules-core/acusecases/resources/i18n/cmsui.xml
deleted file mode 100644
index 678f3dd..0000000
--- a/trunk/src/modules-core/acusecases/resources/i18n/cmsui.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-
-<!-- $Id: cmsui.xml 446564 2006-09-15 10:13:16Z andreas $ -->
-
-<catalogue xml:lang="en" xmlns:xhtml="http://www.w3.org/1999/xhtml">
-
- <message key="Please enter a user name.">Please enter a user name.</message>
- <message key="Please enter a password.">Please enter a password.</message>
-
-</catalogue>
diff --git a/trunk/src/modules-core/acusecases/resources/i18n/cmsui_de.xml b/trunk/src/modules-core/acusecases/resources/i18n/cmsui_de.xml
deleted file mode 100644
index d2bfe3e..0000000
--- a/trunk/src/modules-core/acusecases/resources/i18n/cmsui_de.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?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.
--->
-
-<!-- $Id: cmsui_de.xml 446564 2006-09-15 10:13:16Z andreas $ -->
-
-<catalogue xml:lang="de" xmlns:xhtml="http://www.w3.org/1999/xhtml">
-
- <message key="Please enter a user name.">Bitte geben Sie einen Benutzernamen ein.</message>
- <message key="Please enter a password.">Bitte geben Sie ein Passwort ein.</message>
-
-</catalogue>
-
diff --git a/trunk/src/modules-core/acusecases/test/canoo/test.xml b/trunk/src/modules-core/acusecases/test/canoo/test.xml
deleted file mode 100644
index 28795ce..0000000
--- a/trunk/src/modules-core/acusecases/test/canoo/test.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?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 project SYSTEM "../../../../modules/development/test/canoo/lenya_webtest.dtd">
-
-<project name="AC usecases test" basedir="." default="main">
-
- <import file="../../../../modules/development/test/canoo/macros.xml"/>
-
- <target name="main">
- <webtest name="acusecases">
- &doConfig;
- <steps>
- <!-- login page -->
- <invoke url="index.html" />
- <verifyTitle text="Login to the Default Publication" />
-
- <!-- missing fields -->
- <setInputField name="username" value=""/>
- <setInputField name="password" value=""/>
- <clickButton name="submit"/>
- <verifyText text="Please enter"/>
-
- <!-- wrong login -->
- <setInputField name="username" value="foo"/>
- <setInputField name="password" value="bar"/>
- <clickButton name="submit"/>
- <verifyText text="Authentication failed"/>
-
- <!-- correct login -->
- <setInputField name="username" value="lenya"/>
- <setInputField name="password" value="levi"/>
- <clickButton name="submit"/>
- <verifyText text="Welcome to the Default Publication from the Lenya community!"/>
-
- <!-- logout -->
- <invoke url="index.html?lenya.usecase=ac.logout"/>
- <verifyTitle text="Logout from the Publication" />
- <clickButton name="submit"/>
- <verifyTitle text="Login to the Default Publication" />
-
- </steps>
- </webtest>
- </target>
-</project>
diff --git a/trunk/src/modules-core/acusecases/usecases/login.jx b/trunk/src/modules-core/acusecases/usecases/login.jx
deleted file mode 100644
index e09dcb0..0000000
--- a/trunk/src/modules-core/acusecases/usecases/login.jx
+++ /dev/null
@@ -1,117 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
-
- <jx:set var="pub" value="${usecase.getParameter('publication')}"/>
-
- <page:title>
- <jx:choose>
- <jx:when test="${usecase.getParameter('currentUser') != null}">
- <i18n:text>Access Denied</i18n:text>
- </jx:when>
- <jx:otherwise>
- <i18n:translate>
- <i18n:text i18n:key="login-to-pub"/>
- <i18n:param><jx:out value="${pub.getName()}"/></i18n:param>
- </i18n:translate>
- </jx:otherwise>
- </jx:choose>
- </page:title>
- <page:body>
- <jx:if test="${usecase.getParameter('currentUser') != null}">
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:text>Access Denied</i18n:text>
- </div>
- <div class="lenya-box-body">
- <i18n:translate>
- <i18n:text i18n:key="user-not-authorized"/>
- <i18n:param><jx:out value="${usecase.getParameter('currentUser').getId()}"/></i18n:param>
- <i18n:param><jx:out value="${request.getRequestURI()}"/></i18n:param>
- </i18n:translate>
- <br/>
- <br/>
- <i18n:text>have-another-account</i18n:text>
- </div>
- </div>
- </jx:if>
-
- <jx:choose>
- <jx:when test="${pub.getId().equals('default')}">
- <p>
- <strong> <i18n:text>NOTE</i18n:text>: </strong>
- <i18n:translate>
- <i18n:text i18n:key="try-user-lenya-alice" />
- <i18n:param>"lenya"</i18n:param>
- <i18n:param>"levi"</i18n:param>
- <i18n:param>"alice"</i18n:param>
- <i18n:param>"levi"</i18n:param>
- </i18n:translate>
- </p>
- </jx:when>
- <jx:when test="${pub.getId().equals('blog')}">
- <p>
- <strong> <i18n:text>NOTE</i18n:text>: </strong>
- <i18n:translate>
- <i18n:text i18n:key="try-user-lenya" />
- <i18n:param>"lenya"</i18n:param>
- <i18n:param>"levi"</i18n:param>
- </i18n:translate>
- </p>
- </jx:when>
- </jx:choose>
-
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:text>Login</i18n:text>
- </div>
-
- <div class="lenya-box-body">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- <form name="login" id="login" method="post" action="?lenya.continuation=${continuation.id}&lenya.usecase=${request.getParameter('lenya.usecase')}">
- <table class="lenya-table-noborder">
- <tr>
- <td><label for="name"><i18n:text>Username</i18n:text>: </label></td>
- <td>
- <input class="lenya-form-element" name="username" type="text" value="${usecase.getParameter('username')}"/>
- </td>
- </tr>
- <tr>
- <td><label for="password"> <i18n:text>Password</i18n:text>: </label></td>
- <td>
- <input class="lenya-form-element" name="password" type="password" />
- </td>
- </tr>
- <tr>
- <td />
- <td>
- <input i18n:attr="value" name="submit" type="submit" value="Login"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/acusecases/usecases/logout.jx b/trunk/src/modules-core/acusecases/usecases/logout.jx
deleted file mode 100644
index d7f5e50..0000000
--- a/trunk/src/modules-core/acusecases/usecases/logout.jx
+++ /dev/null
@@ -1,69 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
-
- <page:title>
- <i18n:translate>
- <i18n:text i18n:key="logout-from-pub"/>
- <i18n:param></i18n:param>
- </i18n:translate>
- </page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:text>Logout</i18n:text>
- </div>
-
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
-
- <div class="lenya-box-body">
- <form id="form-logout">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <table class="lenya-table-noborder">
- <tr>
- <td>
- <input i18n:attr="value" name="submit" type="submit" value="Logout" />
-  
- <input i18n:attr="value" name="cancel" type="submit" value="Cancel" />
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:text>Your History</i18n:text>
- </div>
- <div class="lenya-box-body">
- <ul>
- <jx:forEach var="url" items="${usecase.getParameter('history')}">
- <li><jx:out value="${url}"/></li>
- </jx:forEach>
- </ul>
- </div>
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/tabs.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/tabs.xconf
deleted file mode 100644
index 6836e05..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/tabs.xconf
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/gui-manager" unless="/cocoon/gui-manager/tab-group[@name = 'admin']">
- <tab-group name="admin">
- <tab name="users" label="Users" usecase="admin.users"/>
- <tab name="groups" label="Groups" usecase="admin.groups"/>
- <tab name="ipRanges" label="IP Ranges" usecase="admin.ipRanges"/>
- <tab name="usecases" label="Usecases" usecase="admin.usecases"/>
- <tab name="trash" label="Delete Trash" usecase="admin.emptyTrash"/>
- <tab name="serverStatus" label="Server Status" usecase="admin.serverStatus"/>
- <tab name="sessions" label="Sessions" usecase="admin.sessions"/>
- <tab name="siteOverview" label="Overview" usecase="admin.siteOverview"/>
- </tab-group>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-aboutLenya.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-aboutLenya.xconf
deleted file mode 100644
index 4b70e91..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-aboutLenya.xconf
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
-<xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.groups']">
-
- <component-instance name="admin.aboutLenya" logger="lenya.admin" class="org.apache.lenya.cms.usecase.DummyUsecase">
- <view uri="modules/administration/usecases/aboutLenya.jx" menu="true"/>
- </component-instance>
-
-</xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-addGroup.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-addGroup.xconf
deleted file mode 100644
index f2d0201..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-addGroup.xconf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.groups']">
-
- <component-instance name="admin.addGroup" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.AddGroup">
- <view uri="modules/administration/usecases/addGroup.jx" menu="true">
- <tab group="admin" name="groups"/>
- </view>
- <exit usecase="admin.group"/>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-addIPRange.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-addIPRange.xconf
deleted file mode 100644
index 0321d9a..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-addIPRange.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.addIPRange']">
- <component-instance name="admin.addIPRange" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.AddIPRange">
- <view uri="modules/administration/usecases/addIPRange.jx" menu="true">
- <tab group="admin" name="ipRanges"/>
- </view>
- <exit usecase="admin.ipRanges"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-addUser.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-addUser.xconf
deleted file mode 100644
index e68f44d..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-addUser.xconf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.addUser']">
-
- <component-instance name="admin.addUser" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.AddUser">
- <view uri="modules/administration/usecases/addUser.jx" menu="true">
- <tab group="admin" name="users"/>
- </view>
- <exit usecase="admin.user"/>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-changePassword.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-changePassword.xconf
deleted file mode 100644
index cf4de56..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-changePassword.xconf
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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.
--->
-
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.changePassword']">
-
- <component-instance name="admin.changePassword" logger="lenya.admin"
- class="org.apache.lenya.cms.ac.usecases.ChangePassword">
- <view uri="modules/administration/usecases/changePassword.jx">
- <parameter name="checkPassword" value="true"/>
- </view>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-changePasswordAdmin.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-changePasswordAdmin.xconf
deleted file mode 100644
index bcded3f..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-changePasswordAdmin.xconf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.changePasswordAdmin']">
-
- <component-instance name="admin.changePasswordAdmin" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.ChangePasswordAdmin">
- <view uri="modules/administration/usecases/changePasswordAdmin.jx" menu="true">
- <tab group="admin" name="users"/>
- <parameter name="checkPassword" value="false"/>
- </view>
- <exit usecase="admin.user"/>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-deleteGroup.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-deleteGroup.xconf
deleted file mode 100644
index 791091d..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-deleteGroup.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.deleteGroup']">
- <component-instance name="admin.deleteGroup" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.DeleteGroup">
- <view uri="modules/administration/usecases/deleteGroup.jx" menu="true">
- <tab group="admin" name="groups"/>
- </view>
- <exit usecase="admin.groups"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-deleteIPRange.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-deleteIPRange.xconf
deleted file mode 100644
index e249a6e..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-deleteIPRange.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.ipRangeGroups']">
- <component-instance name="admin.deleteIPRange" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.DeleteIPRange">
- <view uri="modules/administration/usecases/deleteIPRange.jx" menu="true">
- <tab group="admin" name="ipRanges"/>
- </view>
- <exit usecase="admin.ipRanges"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-deleteUser.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-deleteUser.xconf
deleted file mode 100644
index d2ff1d6..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-deleteUser.xconf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.deleteUser']">
-
- <component-instance name="admin.deleteUser" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.DeleteUser">
- <view uri="modules/administration/usecases/deleteUser.jx" menu="true">
- <tab group="admin" name="users"/>
- </view>
- <exit usecase="admin.users"/>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-emptyTrash.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-emptyTrash.xconf
deleted file mode 100644
index 8ad2358..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-emptyTrash.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.emptyTrash']">
- <component-instance name="admin.emptyTrash" logger="lenya.admin" class="org.apache.lenya.cms.site.usecases.EmptyTrash">
- <view uri="modules/administration/usecases/emptyTrash.jx" menu="true">
- <tab group="admin" name="trash"/>
- </view>
- <exit usecase="admin.emptyTrash"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-group.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-group.xconf
deleted file mode 100644
index f69e699..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-group.xconf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.group']">
-
- <component-instance name="admin.group" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.Group">
- <view uri="modules/administration/usecases/group.jx" menu="true">
- <tab group="admin" name="groups"/>
- </view>
- <exit usecase="admin.groups"/>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-groupMembers.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-groupMembers.xconf
deleted file mode 100644
index 8c009f1..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-groupMembers.xconf
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.groupMembers']">
-
- <component-instance name="admin.groupMembers" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.GroupMembers">
- <view uri="modules/administration/usecases/groupMembers.jx" menu="true">
- <tab group="admin" name="groups"/>
- </view>
- <exit usecase="admin.group">
- <parameter name="groupId"/>
- </exit>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-groupProfile.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-groupProfile.xconf
deleted file mode 100644
index efa3443..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-groupProfile.xconf
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.groupProfile']">
-
- <component-instance name="admin.groupProfile" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.GroupProfile">
- <view uri="modules/administration/usecases/groupProfile.jx" menu="true">
- <tab group="admin" name="groups"/>
- </view>
- <exit usecase="admin.group">
- <parameter name="groupId"/>
- </exit>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-groups.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-groups.xconf
deleted file mode 100644
index b9fd960..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-groups.xconf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.groups']">
-
- <component-instance name="admin.groups" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.Groups">
- <view uri="modules/administration/usecases/groups.jx" menu="true">
- <tab group="admin" name="groups"/>
- </view>
- <exit usecase="admin.groups"/>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRange.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRange.xconf
deleted file mode 100644
index a55adfd..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRange.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.ipRange']">
- <component-instance name="admin.ipRange" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.IPRange">
- <view uri="modules/administration/usecases/ipRange.jx" menu="true">
- <tab group="admin" name="ipRanges"/>
- </view>
- <exit usecase="admin.ipRanges"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRangeGroups.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRangeGroups.xconf
deleted file mode 100644
index 44d2bb4..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRangeGroups.xconf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.ipRangeGroups']">
- <component-instance name="admin.ipRangeGroups" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.IPRangeGroups">
- <view uri="modules/administration/usecases/ipRangeGroups.jx" menu="true">
- <tab group="admin" name="ipRanges"/>
- </view>
- <exit usecase="admin.ipRange">
- <parameter name="ipRangeId"/>
- </exit>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRangeProfile.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRangeProfile.xconf
deleted file mode 100644
index 06c123b..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRangeProfile.xconf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.ipRangeProfile']">
- <component-instance name="admin.ipRangeProfile" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.IPRangeProfile">
- <view uri="modules/administration/usecases/ipRangeProfile.jx" menu="true">
- <tab group="admin" name="ipRanges"/>
- </view>
- <exit usecase="admin.ipRange">
- <parameter name="ipRangeId"/>
- </exit>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRanges.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRanges.xconf
deleted file mode 100644
index 0d3e158..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-ipRanges.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.ipRanges']">
- <component-instance name="admin.ipRanges" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.IPRanges">
- <view uri="modules/administration/usecases/ipRanges.jx" menu="true">
- <tab group="admin" name="ipRanges"/>
- </view>
- <exit usecase="admin.ipRanges"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-serverStatus.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-serverStatus.xconf
deleted file mode 100644
index 4fa1f44..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-serverStatus.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.serverStatus']">
- <component-instance name="admin.serverStatus" logger="lenya.admin" class="org.apache.lenya.cms.usecase.DummyUsecase">
- <view uri="modules/administration/usecases/serverStatus.jx" menu="true">
- <tab group="admin" name="serverStatus"/>
- </view>
- <exit usecase="admin.serverStatus"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-sessions.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-sessions.xconf
deleted file mode 100644
index dc6f0ff..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-sessions.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.sessions']">
- <component-instance name="admin.sessions" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.SessionViewer">
- <view uri="modules/administration/usecases/sessions.jx" menu="true">
- <tab group="admin" name="sessions"/>
- </view>
- <exit usecase="admin.sessions"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-siteOverview.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-siteOverview.xconf
deleted file mode 100644
index 944dbd6..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-siteOverview.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.siteOverview']">
- <component-instance name="admin.siteOverview" logger="lenya.admin" class="org.apache.lenya.cms.site.usecases.SiteOverview">
- <view uri="modules/administration/usecases/siteOverview.jx" menu="true">
- <tab group="admin" name="siteOverview"/>
- </view>
- <exit usecase="admin.siteOverview"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-usecases.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-usecases.xconf
deleted file mode 100644
index 7db349b..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-usecases.xconf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.usecases']">
-
- <component-instance name="admin.usecases" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.Usecases">
- <view uri="modules/administration/usecases/usecases.jx" menu="true">
- <tab group="admin" name="usecases"/>
- </view>
- <exit usecase="admin.usecases"/>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-user.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-user.xconf
deleted file mode 100644
index 645ae77..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-user.xconf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.users']">
-
- <component-instance name="admin.user" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.User">
- <view uri="modules/administration/usecases/user.jx" menu="true">
- <tab group="admin" name="users"/>
- </view>
- <exit usecase="admin.users"/>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-userGroups.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-userGroups.xconf
deleted file mode 100644
index 5588984..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-userGroups.xconf
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.userGroups']">
-
- <component-instance name="admin.userGroups" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.UserGroups">
- <view uri="modules/administration/usecases/userGroups.jx" menu="true">
- <tab group="admin" name="users"/>
- </view>
- <exit usecase="admin.user">
- <parameter name="userId"/>
- </exit>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-userProfile.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-userProfile.xconf
deleted file mode 100644
index 400180a..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-userProfile.xconf
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.userProfile']">
-
- <component-instance name="admin.userProfile" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.UserProfile">
- <view uri="modules/administration/usecases/userProfile.jx" menu="true">
- <tab group="admin" name="users"/>
- </view>
- <exit usecase="admin.user">
- <parameter name="userId"/>
- </exit>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-users.xconf b/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-users.xconf
deleted file mode 100644
index 2dc46be..0000000
--- a/trunk/src/modules-core/administration/config/cocoon-xconf/usecase-admin-users.xconf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'admin.users']">
-
- <component-instance name="admin.users" logger="lenya.admin" class="org.apache.lenya.cms.ac.usecases.Users">
- <view uri="modules/administration/usecases/users.jx" menu="true">
- <tab group="admin" name="users"/>
- </view>
- <exit usecase="admin.users"/>
- </component-instance>
-
- </xconf>
diff --git a/trunk/src/modules-core/administration/config/module.xml b/trunk/src/modules-core/administration/config/module.xml
deleted file mode 100644
index aea67b7..0000000
--- a/trunk/src/modules-core/administration/config/module.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.administration</id>
- <depends module="org.apache.lenya.modules.usecase"/>
- <depends module="org.apache.lenya.modules.ac"/>
- <depends module="org.apache.lenya.modules.acusecases"/>
- <depends module="org.apache.lenya.modules.ldap"/>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>Administration</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>Administration usecases</description>
-</module>
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AbstractChangePassword.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AbstractChangePassword.java
deleted file mode 100644
index 75c74eb..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AbstractChangePassword.java
+++ /dev/null
@@ -1,71 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import org.apache.lenya.ac.User;
-
-
-/**
- * Usecase to change a user's password.
- */
-public abstract class AbstractChangePassword extends AccessControlUsecase {
-
- protected static final String NEW_PASSWORD = "newPassword";
- protected static final String CONFIRM_PASSWORD = "confirmPassword";
-
- protected abstract User getUser();
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- super.doCheckExecutionConditions();
- checkNewPassword(this);
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
- getUser().setPassword(getParameterAsString(NEW_PASSWORD));
- getUser().save();
- }
-
- /**
- * Checks a password and a confirmed password.
- * @param usecase The usecase.
- */
- protected static void checkNewPassword(AccessControlUsecase usecase) {
- String password = usecase.getParameterAsString(NEW_PASSWORD);
- String confirmPassword = usecase.getParameterAsString(CONFIRM_PASSWORD);
-
- if (!password.equals(confirmPassword)) {
- usecase.addErrorMessage("Password and confirmed password are not equal.");
- }
-
- if (password.length() < 6) {
- usecase.addErrorMessage("The password must be at least six characters long.");
- }
-
- if (!password.matches(".*\\d.*")) {
- usecase.addErrorMessage("The password must contain at least one number.");
- }
- }
-
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AccessControl.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AccessControl.java
deleted file mode 100644
index 3432742..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AccessControl.java
+++ /dev/null
@@ -1,461 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.apache.cocoon.ProcessingException;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.URLInformation;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.IPRange;
-import org.apache.lenya.ac.Item;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.Credential;
-import org.apache.lenya.ac.ModifiablePolicy;
-import org.apache.lenya.ac.InheritingPolicyManager;
-import org.apache.lenya.ac.World;
-
-/**
- * Usecase to display the AccessControl tab in the site area for a document.
- * This is a mix-in class that ideally would inherit both from
- * AccessControlUsecase and DocumentUsecase. FIXME i just took the appropriate
- * code from DocumentUsecase, maybe its possible to have a saner inheritance?
- *
- * @version $Id: AccessControl.java 408702 2006-05-22 16:03:49Z andreas $
- */
-
-public class AccessControl extends AccessControlUsecase {
-
- protected static final String AC_AREA = "acArea";
- protected static final String ADD = "add";
- protected static final String DELETE = "delete";
- protected static final String UP = "up";
- protected static final String DOWN = "down";
- protected static final String USER = "user";
- protected static final String GROUP = "group";
- protected static final String IPRANGE = "ipRange";
- protected static final String WORLD = "world";
- protected static final String ROLE = "role";
- protected static final String SUB_USER = "subuser";
- protected static final String SUB_GROUP = "subgroup";
- protected static final String SUB_IPRANGE = "subipRange";
-
- private static String[] types = { USER, GROUP, IPRANGE, SUB_USER, SUB_GROUP, SUB_IPRANGE, WORLD };
- private static String[] operations = { ADD, DELETE, DOWN, UP };
-
- protected static final String SSL = "ssl";
- protected static final String ANCESTOR_SSL = "ancestorSsl";
- protected static final String DOCUMENT = "document";
- protected static final String SUB_CREDENTIALS = "subCredentials";
- protected static final String PARENT_CREDENTIALS = "parentCredentials";
- private static final String METHOD = "method";
- private String COMPLETE_AREA = "private.completeArea";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- try {
- URLInformation info = new URLInformation(getSourceURL());
- setParameter(COMPLETE_AREA, info.getCompleteArea());
-
- DocumentFactory map = getDocumentFactory();
- if (map.isDocument(getSourceURL())) {
- Document sourceDocument = map.getFromURL(getSourceURL());
- setParameter(DOCUMENT, sourceDocument);
- }
-
- setParameter(SSL, Boolean.toString(isSSLProtected()));
- setParameter(ANCESTOR_SSL, Boolean.toString(isAncestorSSLProtected()));
-
- User[] users = getUserManager().getUsers();
- String[] userIds = new String[users.length];
- for (int i = 0; i < users.length; i++) {
- userIds[i] = users[i].getId();
- }
- Arrays.sort(userIds);
- setParameter("users", userIds);
-
- Group[] groups = getGroupManager().getGroups();
- String[] groupIds = new String[groups.length];
- for (int i = 0; i < groups.length; i++) {
- groupIds[i] = groups[i].getId();
- }
- Arrays.sort(groupIds);
- setParameter("groups", groupIds);
-
- IPRange[] ipRanges = getIpRangeManager().getIPRanges();
- String[] ipRangeIds = new String[ipRanges.length];
- for (int i = 0; i < ipRanges.length; i++) {
- ipRangeIds[i] = ipRanges[i].getId();
- }
- Arrays.sort(ipRangeIds);
- setParameter("ipRanges", ipRangeIds);
-
- Role[] roles = getRoleManager().getRoles();
- String visitorRole = "";
- Set roleIds = new TreeSet();
- for (int i = 0; i < roles.length; i++) {
- if (roles[i].isAssignable()) {
- roleIds.add(roles[i].getId());
- if (roles[i].getId().equals("visit")) {
- visitorRole = roles[i].getId();
- }
- }
- }
- setParameter("roles", roleIds.toArray(new String[roleIds.size()]));
- setParameter("visitorRole", visitorRole);
-
- setParameter(SUB_CREDENTIALS, getSubtreeCredentials());
- setParameter(PARENT_CREDENTIALS, getParentCredentials());
-
- } catch (final Exception e) {
- addErrorMessage("Could not read a value.");
- getLogger().error("Could not read value for AccessControl usecase. ", e);
- }
-
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
- */
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
- URLInformation info = new URLInformation(getSourceURL());
- String acArea = getParameterAsString(AC_AREA);
- if (!acArea.equals(Publication.LIVE_AREA) && !info.getArea().equals(acArea)) {
- addErrorMessage("This usecase can only be invoked in the configured area.");
- }
- }
-
- protected void doCheckExecutionConditions() throws Exception {
- super.doCheckExecutionConditions();
- for (int i = 0; i < types.length; i++) {
- for (int j = 0; j < operations.length; j++) {
- String type = types[i];
- String paramName = operations[j] + "Credential_" + type;
- if (getParameterAsString(paramName) != null) {
- String roleId = getParameterAsString(ROLE);
- String id = getParameterAsString(type);
- Accreditable item = getAccreditable(type, id);
- if (item == null) {
- addErrorMessage("no_such_accreditable", new String[] { type, id });
- } else {
- Role role = getRoleManager().getRole(roleId);
- if (role == null) {
- addErrorMessage("role_no_such_role", new String[] { roleId });
- }
- if (!role.isAssignable()) {
- addErrorMessage("cannot-assign-role", new String[] { roleId });
- }
- if (operations[j].equals(ADD)) {
- ModifiablePolicy policy = getPolicy();
- if (containsCredential(policy, item, role)) {
- addErrorMessage("credential-already-contained", new String[] {
- ((Item) item).getId(), role.getId() });
- }
- }
- }
- if (hasErrors()) {
- deleteParameter(paramName);
- }
- }
- }
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- public void doExecute() throws Exception {
- super.doExecute();
- if (getParameterAsString("change_ssl") != null) {
- String ssl = getBooleanCheckboxParameter("ssl");
- setSSLProtected(Boolean.valueOf(ssl).booleanValue());
- }
-
- for (int i = 0; i < types.length; i++) {
- for (int j = 0; j < operations.length; j++) {
- String type = types[i];
- String paramName = operations[j] + "Credential_" + type;
- if (getParameterAsString(paramName) != null) {
- String roleId = getParameterAsString(ROLE);
- String method = getParameterAsString(METHOD);
- String id = getParameterAsString(type);
- Accreditable item = getAccreditable(type, id);
- Role role = getRoleManager().getRole(roleId);
- manipulateCredential(item, role, operations[j], method);
- setParameter(SUB_CREDENTIALS, getSubtreeCredentials());
- deleteParameter(paramName);
- }
- }
- }
- }
-
- protected Accreditable getAccreditable(String type, String id) {
- Accreditable item = null;
- if (type.equals(USER)) {
- item = getUserManager().getUser(id);
- } else if (type.equals(GROUP)) {
- item = getGroupManager().getGroup(id);
- } else if (type.equals(IPRANGE)) {
- item = getIpRangeManager().getIPRange(id);
- } else if (type.equals(WORLD)) {
- item = World.getInstance();
- }
- return item;
- }
-
- /**
- * Returns if one of the ancestors of this URL is SSL protected.
- *
- * @return A boolean value.
- * @throws ProcessingException when something went wrong.
- */
- protected boolean isAncestorSSLProtected() throws ProcessingException {
- boolean ssl;
- try {
- String ancestorUrl = "";
- int lastSlashIndex = getPolicyURL().lastIndexOf("/");
- if (lastSlashIndex != -1) {
- ancestorUrl = getPolicyURL().substring(0, lastSlashIndex);
- }
-
- Policy policy = getPolicyManager().getPolicy(getAccreditableManager(), ancestorUrl);
- ssl = policy.isSSLProtected();
- } catch (AccessControlException e) {
- throw new ProcessingException("Resolving policy failed: ", e);
- }
- return ssl;
- }
-
- /**
- * Returns if one of the ancestors of this URL is SSL protected.
- *
- * @return A boolean value.
- * @throws ProcessingException when something went wrong.
- */
- protected boolean isSSLProtected() throws ProcessingException {
- boolean ssl;
- try {
- Policy policy = getPolicyManager().getPolicy(getAccreditableManager(), getPolicyURL());
- ssl = policy.isSSLProtected();
- } catch (AccessControlException e) {
- throw new ProcessingException("Resolving policy failed: ", e);
- }
- return ssl;
- }
-
- /**
- * Sets if this URL is SSL protected.
- *
- * @param ssl A boolean value.
- * @throws ProcessingException when something went wrong.
- */
- protected void setSSLProtected(boolean ssl) throws ProcessingException {
- try {
- ModifiablePolicy policy = getPolicy();
- policy.setSSL(ssl);
- getPolicyManager().saveSubtreePolicy(getPolicyURL(), policy);
- } catch (AccessControlException e) {
- throw new ProcessingException("Resolving policy failed: ", e);
- }
- }
-
- protected InheritingPolicyManager getPolicyManager() {
- return (InheritingPolicyManager) getAccessController().getPolicyManager();
- }
-
- protected AccreditableManager getAccreditableManager() {
- return getAccessController().getAccreditableManager();
- }
-
- /**
- * Changes a credential by adding or deleting an item for a role.
- *
- * @param accreditable The accreditable to add or delete.
- * @param role The role.
- * @param operation The operation, either {@link #ADD}or {@link #DELETE}.
- * @param method
- * @throws ProcessingException when something went wrong.
- */
- protected void manipulateCredential(Accreditable accreditable, Role role, String operation,
- String method) throws ProcessingException {
- try {
- ModifiablePolicy policy = getPolicy();
-
- if (operation.equals(ADD)) {
- policy.addRole(accreditable, role, method);
- } else if (operation.equals(DELETE)) {
- policy.removeRole(accreditable, role);
- } else if (operation.equals(UP)) {
- policy.moveRoleUp(accreditable, role);
- } else if (operation.equals(DOWN)) {
- policy.moveRoleDown(accreditable, role);
- }
- getPolicyManager().saveSubtreePolicy(getPolicyURL(), policy);
-
- } catch (Exception e) {
- throw new ProcessingException("Manipulating credential failed: ", e);
- }
- }
-
- protected ModifiablePolicy getPolicy() throws AccessControlException {
- return (ModifiablePolicy) getPolicyManager().buildSubtreePolicy(getAccreditableManager(),
- getPolicyURL());
- }
-
- protected boolean containsCredential(ModifiablePolicy policy, Accreditable accreditable,
- Role role) throws AccessControlException {
- Credential[] credentials = policy.getCredentials();
- boolean contains = false;
- int i = 0;
- while (!contains && i < credentials.length) {
- Accreditable credAccr = credentials[i].getAccreditable();
- Role credRole = credentials[i].getRole();
- contains = credAccr.equals(accreditable) && credRole.equals(role);
- i++;
- }
- return contains;
- }
-
- /**
- * Returns the credential wrappers for the request of this object model.
- *
- * @return An array of CredentialWrappers.
- * @throws ProcessingException when something went wrong.
- */
- public CredentialWrapper[] getSubtreeCredentials() throws ProcessingException {
- return getCredentials(true);
- }
-
- /**
- * Returns the credential wrappers for the parent URI of the URL belonging
- * to the request of this object model.
- *
- * @return An array of CredentialWrappers.
- * @throws ProcessingException when something went wrong.
- */
- public CredentialWrapper[] getParentCredentials() throws ProcessingException {
- return getCredentials(false);
- }
-
- /**
- * Returns the credentials of the policy of the selected URL.
- *
- * @return An array of CredentialWrappers.
- * @throws ProcessingException when something went wrong.
- */
- public CredentialWrapper[] getCredentials(boolean inherit) throws ProcessingException {
-
- List credentials = new ArrayList();
-
- ModifiablePolicy policies[] = getPolicies(inherit);
- List policyCredentials = new ArrayList();
- for (int i = 0; i < policies.length; i++) {
- Credential[] creds;
- try {
- creds = policies[i].getCredentials();
- for (int j = 0; j < creds.length; j++) {
- policyCredentials.add(creds[j]);
- }
- } catch (AccessControlException e) {
- throw new ProcessingException(
- "AccessControlException - receiving credential failed: ", e);
- }
- }
- for (Iterator i = policyCredentials.iterator(); i.hasNext();) {
- Credential credential = (Credential) i.next();
- Accreditable accreditable = credential.getAccreditable();
- Role role = credential.getRole();
- String method = credential.getMethod();
- credentials.add(new CredentialWrapper(accreditable, role, method));
- }
- return (CredentialWrapper[]) credentials.toArray(new CredentialWrapper[credentials.size()]);
- }
-
- /**
- * Returns the policies for a certain URL.
- *
- * @param inherit If true, all ancestor policies are returned. Otherwise,
- * only the URL policies are returned.
- * @return An array of DefaultPolicy objects.
- * @throws ProcessingException when something went wrong.
- */
- protected ModifiablePolicy[] getPolicies(boolean inherit) throws ProcessingException {
-
- ModifiablePolicy[] policies;
-
- try {
- if (inherit) {
- policies = new ModifiablePolicy[1];
- AccreditableManager policyManager = getAccreditableManager();
- policies[0] = (ModifiablePolicy) getPolicyManager().buildSubtreePolicy(
- policyManager, getPolicyURL());
- } else {
- String ancestorUrl = "";
-
- String currentUrl = getPolicyURL();
- if (currentUrl.endsWith("/")) {
- currentUrl = currentUrl.substring(0, currentUrl.length() - 1);
- }
-
- int lastSlashIndex = currentUrl.lastIndexOf("/");
- if (lastSlashIndex != -1) {
- ancestorUrl = currentUrl.substring(0, lastSlashIndex);
- }
- Policy[] pArray = getPolicyManager().getPolicies(getAccreditableManager(),
- ancestorUrl);
- policies = new ModifiablePolicy[pArray.length];
- for (int i = 0; i < pArray.length; i++) {
- policies[policies.length - 1 - i] = (ModifiablePolicy) pArray[i];
- }
- }
- } catch (AccessControlException e) {
- throw new ProcessingException(e);
- }
-
- return policies;
- }
-
- protected String getPolicyURL() {
- String infoUrl = getSourceURL();
- URLInformation info = new URLInformation(infoUrl);
-
- String area = getParameterAsString(AC_AREA);
- String url = "/" + info.getPublicationId() + "/" + area + info.getDocumentUrl();
- return url;
- }
-
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AddGroup.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AddGroup.java
deleted file mode 100644
index ea2b423..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AddGroup.java
+++ /dev/null
@@ -1,78 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.ItemUtil;
-import org.apache.lenya.cms.usecase.UsecaseException;
-
-/**
- * Usecase to add a group.
- *
- * @version $Id: AddGroup.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class AddGroup extends AccessControlUsecase {
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- validate();
- }
-
- /**
- * Validates the request parameters.
- * @throws UsecaseException if an error occurs.
- */
- void validate() throws UsecaseException {
-
- String groupId = getParameterAsString(GroupProfile.ID);
-
- Group existingGroup = getGroupManager().getGroup(groupId);
-
- if (existingGroup != null) {
- addErrorMessage("This group already exists.");
- }
-
- if (!ItemUtil.isValidId(groupId)) {
- addErrorMessage("This is not a valid group ID.");
- }
-
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- String id = getParameterAsString(GroupProfile.ID);
- String name = getParameterAsString(GroupProfile.NAME);
- String description = getParameterAsString(GroupProfile.DESCRIPTION);
-
- Group group = getGroupManager().add(id);
- group.setName(name);
- group.setDescription(description);
-
- group.save();
-
- setExitParameter(GroupProfile.ID, id);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AddIPRange.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AddIPRange.java
deleted file mode 100644
index 02c9650..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AddIPRange.java
+++ /dev/null
@@ -1,106 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.lenya.ac.IPRange;
-import org.apache.lenya.ac.ItemUtil;
-import org.apache.lenya.cms.ac.usecases.IPRangeProfile.Part;
-
-/**
- * Usecase to add an IP range.
- */
-public class AddIPRange extends AccessControlUsecase {
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- String id = getParameterAsString(IPRangeProfile.ID);
-
- IPRange existingIPRange = getIpRangeManager().getIPRange(id);
-
- if (existingIPRange != null) {
- addErrorMessage("This IP range already exists.");
- }
-
- if (!ItemUtil.isValidId(id)) {
- addErrorMessage("This is not a valid IP range ID.");
- }
-
- IPRangeProfile.validateAddresses(this);
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
-
- String id = getParameterAsString(IPRangeProfile.ID);
- String name = getParameterAsString(IPRangeProfile.NAME);
- String description = getParameterAsString(IPRangeProfile.DESCRIPTION);
-
- IPRange ipRange = getIpRangeManager().add(id);
- ContainerUtil.enableLogging(ipRange, getLogger());
-
- ipRange.setName(name);
- ipRange.setDescription(description);
-
- StringBuffer networkBuffer = new StringBuffer();
- StringBuffer subnetBuffer = new StringBuffer();
-
- for (int i = 0; i < 4; i++) {
- if (i > 0) {
- networkBuffer.append(".");
- subnetBuffer.append(".");
- }
- Part netPart = (Part) getParameter(IPRangeProfile.NETWORK_ADDRESS + "-" + i);
- networkBuffer.append(netPart.getValue());
- Part subPart = (Part) getParameter(IPRangeProfile.SUBNET_MASK + "-" + i);
- subnetBuffer.append(subPart.getValue());
- }
-
- InetAddress networkAddress = InetAddress.getByName(networkBuffer.toString());
- ipRange.setNetworkAddress(networkAddress.getAddress());
-
- InetAddress subnetMask = InetAddress.getByName(subnetBuffer.toString());
- ipRange.setSubnetMask(subnetMask.getAddress());
-
- ipRange.save();
-
- setExitParameter(IPRangeProfile.ID, id);
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
- List partNumbers = new ArrayList();
- for (byte i = 0; i < 4; i++) {
- setParameter(IPRangeProfile.NETWORK_ADDRESS + "-" + i, new Part(i));
- setParameter(IPRangeProfile.SUBNET_MASK + "-" + i, new Part(i));
- partNumbers.add(new Integer(i));
- }
- setParameter(IPRangeProfile.PART_NUMBERS, partNumbers);
- }
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AddUser.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AddUser.java
deleted file mode 100644
index 9c5bbd2..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/AddUser.java
+++ /dev/null
@@ -1,128 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.ItemUtil;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.UserManager;
-import org.apache.lenya.ac.file.FileUser;
-import org.apache.lenya.ac.file.FileUserManager;
-import org.apache.lenya.ac.ldap.LDAPUser;
-import org.apache.lenya.cms.usecase.UsecaseException;
-
-/**
- * Usecase to add a user.
- *
- * @version $Id: AddUser.java 407248 2006-05-17 13:20:01Z andreas $
- */
-public class AddUser extends AccessControlUsecase {
-
- protected static final String CLASS_NAME = "className";
- protected static final String LDAP_ID = "ldapId";
-
- /**
- * Validates the request parameters.
- * @throws UsecaseException if an error occurs.
- */
- void validate() throws UsecaseException {
-
- String userId = getParameterAsString(UserProfile.USER_ID).toLowerCase();
- String email = getParameterAsString(UserProfile.EMAIL);
- String className = getParameterAsString(CLASS_NAME);
- String ldapId = getParameterAsString(LDAP_ID);
-
- User existingUser = getUserManager().getUser(userId);
-
- if (existingUser != null) {
- addErrorMessage("This user already exists.");
- }
-
- if (!ItemUtil.isValidId(userId)) {
- addErrorMessage("This is not a valid user ID.");
- }
-
- if (!ItemUtil.isValidEmail(email)) {
- addErrorMessage("Please enter a valid e-mail address.");
- }
-
- if (className == null) {
- addErrorMessage("Internal error - the user class name has not been provided. " +
- "Please consult your system administrator.");
- }
-
- if (className.equals(LDAPUser.class.getName())) {
- LDAPUser ldapUser = new LDAPUser(getUserManager(), getLogger());
- ContainerUtil.enableLogging(ldapUser, getLogger());
-
- try {
- if (!ldapUser.existsUser(ldapId)) {
- addErrorMessage("ldap_no_such_user", new String[]{ldapId});
- }
- } catch (AccessControlException e) {
- throw new UsecaseException(e);
- }
- }
-
- else {
- ChangePassword.checkNewPassword(this);
- }
-
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- if (getLogger().isDebugEnabled())
- getLogger().debug("AddUser.doCheckExecutionConditions() called");
-
- validate();
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- UserManager userManager = (FileUserManager) getUserManager();
-
- String userId = getParameterAsString(UserProfile.USER_ID).toLowerCase();
- String fullName = getParameterAsString(UserProfile.FULL_NAME);
- String description = getParameterAsString(UserProfile.DESCRIPTION);
- String email = getParameterAsString(UserProfile.EMAIL);
- String className = getParameterAsString(CLASS_NAME);
-
- User user;
- if (className.equals(LDAPUser.class.getName())) {
- String ldapId = getParameterAsString(LDAP_ID);
- user = new LDAPUser(userManager, getLogger(), userId, email, ldapId, getLogger());
- } else {
- String password = getParameterAsString(AbstractChangePassword.NEW_PASSWORD);
- user = new FileUser(userManager, getLogger(), userId, fullName, email, "");
- user.setName(fullName);
- user.setPassword(password);
- }
- ContainerUtil.enableLogging(user, getLogger());
- user.setDescription(description);
- user.save();
- getUserManager().add(user);
-
- setExitParameter(UserProfile.USER_ID, userId);
- }
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/ChangePassword.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/ChangePassword.java
deleted file mode 100644
index 95cb6ac..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/ChangePassword.java
+++ /dev/null
@@ -1,54 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import org.apache.lenya.ac.User;
-
-/**
- * Usecase to change a user's password. The old password is checked.
- */
-public class ChangePassword extends AbstractChangePassword {
-
- protected static final String OLD_PASSWORD = "oldPassword";
-
- /**
- * @return Always returns the currently logged in user.
- */
- protected User getUser() {
- return getSession().getIdentity().getUser();
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- super.doCheckExecutionConditions();
- checkOldPassword();
- }
-
- /**
- * verifies that the user knows the current password before s/he is allowed to change it.
- */
- private void checkOldPassword() {
- String oldPassword = getParameterAsString(OLD_PASSWORD);
- boolean authenticated = getUser().authenticate(oldPassword);
- if (!authenticated) {
- addErrorMessage("The old password is not correct.");
- }
- }
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/ChangePasswordAdmin.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/ChangePasswordAdmin.java
deleted file mode 100644
index 78e7846..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/ChangePasswordAdmin.java
+++ /dev/null
@@ -1,57 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import org.apache.lenya.ac.User;
-
-/**
- * Usecase to change a user's password.
- */
-public class ChangePasswordAdmin extends AbstractChangePassword {
-
- private User user;
-
- protected User getUser() {
- if (this.user == null) {
- String userId = getParameterAsString(UserProfile.USER_ID);
- this.user = getUserManager().getUser(userId);
- }
- return this.user;
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- super.doCheckExecutionConditions();
- if (getUser() == null) {
- addErrorMessage("The " + UserProfile.USER_ID
- + " parameter has to be provided when executing this usecase.");
- return;
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
- setExitParameter(UserProfile.USER_ID, getParameterAsString(UserProfile.USER_ID));
- }
-
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/CredentialWrapper.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/CredentialWrapper.java
deleted file mode 100644
index cc07dbc..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/CredentialWrapper.java
+++ /dev/null
@@ -1,125 +0,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.
- *
- */
-
-package org.apache.lenya.cms.ac.usecases;
-
-import org.apache.lenya.ac.Accreditable;
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.IPRange;
-import org.apache.lenya.ac.Item;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.User;
-
-/**
- * Wrapper class for credentials.
- * @version $Id$
- */
-public class CredentialWrapper {
-
- /**
- * Returns the method of the Credential
- * @return A string that is either "deny" or "grant"
- */
- public String getMethod() {
- return method;
- }
- /**
- * Returns the accreditable ID.
- * @return A string.
- */
- public String getAccreditableId() {
- return this.accreditableId;
- }
-
- /**
- * Returns the accreditable name.
- * @return A string.
- */
- public String getAccreditableName() {
- return this.accreditableName;
- }
-
- /**
- * Returns the role ID.
- * @return A string.
- */
- public String getRoleId() {
- return this.roleId;
- }
-
- /**
- * Returns the role name.
- * @return A string.
- */
- public String getRoleName() {
- return this.roleName;
- }
-
- /**
- * Returns the accreditable type ({@link #USER}, {@link #GROUP}, or {@link #IPRANGE})
- * @return A string.
- */
- public String getType() {
- return this.type;
- }
-
- /**
- * Ctor.
- * @param accreditable The accreditable of the credential to wrap.
- * @param role The role of the credential to wrap.
- * @param method
- */
- public CredentialWrapper(Accreditable accreditable, Role role, String method) {
- if (accreditable instanceof Item) {
- Item item = (Item) accreditable;
- this.accreditableId = item.getId();
- this.accreditableName = item.getName();
-
- if (item instanceof User) {
- this.type = USER;
- }
- else if (item instanceof Group) {
- this.type = GROUP;
- }
- else if (item instanceof IPRange) {
- this.type = IPRANGE;
- }
- }
- else {
- this.accreditableId = "world";
- this.accreditableName = "the world";
- this.type = "world";
- }
- this.roleId = role.getId();
- this.roleName = role.getName();
- this.method = method;
-
- }
-
- protected static final String USER = "user";
- protected static final String GROUP = "group";
- protected static final String IPRANGE = "ipRange";
-
- private String type;
- private String accreditableId;
- private String accreditableName;
- private String roleId;
- private String roleName;
- private String method;
-
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteGroup.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteGroup.java
deleted file mode 100644
index 74662cf..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteGroup.java
+++ /dev/null
@@ -1,44 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import org.apache.lenya.ac.Group;
-
-/**
- * Usecase to delete a group.
- *
- * @version $Id: DeleteGroup.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class DeleteGroup extends AccessControlUsecase {
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- String groupId = getParameterAsString(GroupProfile.ID);
- Group group = getGroupManager().getGroup(groupId);
- if (group == null) {
- throw new RuntimeException("Group [" + groupId + "] not found.");
- }
-
- getGroupManager().remove(group);
- group.delete();
- }
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteIPRange.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteIPRange.java
deleted file mode 100644
index c95c3dd..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteIPRange.java
+++ /dev/null
@@ -1,42 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-/**
- * Delete an IP range.
- *
- * @version $Id: DeleteIPRange.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class DeleteIPRange extends AccessControlUsecase {
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- String id = getParameterAsString(IPRangeProfile.ID);
- org.apache.lenya.ac.IPRange ipRange = getIpRangeManager().getIPRange(id);
- if (ipRange == null) {
- throw new RuntimeException("IP range [" + id + "] not found.");
- }
-
- getIpRangeManager().remove(ipRange);
- ipRange.delete();
- }
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteUser.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteUser.java
deleted file mode 100644
index 875028e..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/DeleteUser.java
+++ /dev/null
@@ -1,44 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import org.apache.lenya.ac.User;
-
-/**
- * Usecase to delete a user.
- *
- * @version $Id: DeleteUser.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class DeleteUser extends AccessControlUsecase {
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- String userId = getParameterAsString(UserProfile.USER_ID);
- User user = getUserManager().getUser(userId);
- if (user == null) {
- throw new RuntimeException("User [" + userId + "] not found.");
- }
-
- getUserManager().remove(user);
- user.delete();
- }
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Group.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Group.java
deleted file mode 100644
index 86a329b..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Group.java
+++ /dev/null
@@ -1,46 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-/**
- * Display group information.
- *
- * @version $Id: Group.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class Group extends AccessControlUsecase {
-
- protected static final String GROUP_ID = "groupId";
- protected static final String GROUP = "group";
-
- /**
- * @see org.apache.lenya.cms.usecase.Usecase#setParameter(java.lang.String, java.lang.Object)
- */
- public void setParameter(String name, Object value) {
- super.setParameter(name, value);
-
- if (name.equals(GROUP_ID)) {
- String groupId = (String) value;
- org.apache.lenya.ac.Group group = getGroupManager().getGroup(groupId);
- if (group == null) {
- addErrorMessage("group_no_such_entry", new String[]{groupId});
- } else {
- setParameter(GROUP, group);
- }
- }
- }
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/GroupMembers.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/GroupMembers.java
deleted file mode 100644
index f72fe71..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/GroupMembers.java
+++ /dev/null
@@ -1,142 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.Groupable;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.usecase.UsecaseException;
-
-/**
- * Usecase to change the members of a group.
- *
- * @version $Id: GroupMembers.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class GroupMembers extends AccessControlUsecase {
-
- protected static final String GROUP_USERS = "groupUsers";
- protected static final String OTHER_USERS = "otherUsers";
- protected static final String ADD = "add";
- protected static final String REMOVE = "remove";
- protected static final String GROUP_USER = "groupUser";
- protected static final String OTHER_USER = "otherUser";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- Groupable[] members = getGroup().getMembers();
- List groupUsers = new ArrayList();
- for (int i = 0; i < members.length; i++) {
- if (members[i] instanceof User) {
- groupUsers.add(members[i]);
- }
- }
- setParameter(GROUP_USERS, groupUsers);
-
- User[] allUsers = getUserManager().getUsers();
-
- List otherUsers = new ArrayList();
- for (int i = 0; i < allUsers.length; i++) {
- if (!groupUsers.contains(allUsers[i])) {
- otherUsers.add(allUsers[i]);
- }
- }
- setParameter(OTHER_USERS, otherUsers);
-
- setExitParameter(GroupProfile.ID, getParameterAsString(GroupProfile.ID));
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- final Group group = getGroup();
- group.removeAllMembers();
-
- List groupUsers = (List) getParameter(GROUP_USERS);
- for (Iterator i = groupUsers.iterator(); i.hasNext();) {
- User user = (User) i.next();
- group.add(user);
- user.save();
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.Usecase#advance()
- */
- public void advance() throws UsecaseException {
- super.advance();
-
- String add = getParameterAsString(ADD);
- String remove = getParameterAsString(REMOVE);
- if (add != null || remove != null) {
-
- List groupUsers = (List) getParameter(GROUP_USERS);
- List otherUsers = (List) getParameter(OTHER_USERS);
-
- if (add != null) {
- String userId = getParameterAsString(OTHER_USER);
- if (userId != null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("add user [" + userId + "]");
- }
- User user = getUserManager().getUser(userId);
- groupUsers.add(user);
- otherUsers.remove(user);
- }
- }
-
- if (remove != null) {
- String userId = getParameterAsString(GROUP_USER);
- if (userId != null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("remove user [" + userId + "]");
- }
- User user = getUserManager().getUser(userId);
- otherUsers.add(user);
- groupUsers.remove(user);
- }
- }
-
- deleteParameter(ADD);
- deleteParameter(REMOVE);
- deleteParameter(GROUP_USER);
- deleteParameter(OTHER_USER);
- }
-
- }
-
- protected Group getGroup() {
- String groupId = getParameterAsString(GroupProfile.ID);
- Group group = getGroupManager().getGroup(groupId);
- if (group == null) {
- throw new RuntimeException("Group [" + groupId + "] not found.");
- }
- return group;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/GroupProfile.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/GroupProfile.java
deleted file mode 100644
index 8165dc5..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/GroupProfile.java
+++ /dev/null
@@ -1,64 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import org.apache.lenya.ac.Group;
-
-/**
- * Usecase to change the profile of a group.
- *
- * @version $Id: GroupProfile.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class GroupProfile extends AccessControlUsecase {
-
- protected static final String ID = "groupId";
- protected static final String NAME = "name";
- protected static final String DESCRIPTION = "description";
-
- private Group group;
-
- protected void doExecute() throws Exception {
- super.doExecute();
-
- String name = getParameterAsString(NAME);
- String description = getParameterAsString(DESCRIPTION);
-
- this.group.setName(name);
- this.group.setDescription(description);
-
- this.group.save();
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.Usecase#setParameter(java.lang.String, java.lang.Object)
- */
- public void setParameter(String name, Object value) {
- super.setParameter(name, value);
-
- if (name.equals(ID)) {
- String id = (String) value;
- this.group = getGroupManager().getGroup(id);
- if (this.group == null) {
- throw new RuntimeException("Group [" + id + "] not found.");
- }
-
- setParameter(DESCRIPTION, this.group.getDescription());
- setParameter(NAME, this.group.getName());
- }
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Groups.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Groups.java
deleted file mode 100644
index e58742e..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Groups.java
+++ /dev/null
@@ -1,48 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.lenya.ac.Group;
-
-/**
- * Manage groups.
- *
- * @version $Id: Groups.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class Groups extends AccessControlUsecase {
-
- protected static final String GROUPS = "groups";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- Group[] groups = getGroupManager().getGroups();
- List groupList = new ArrayList();
- groupList.addAll(Arrays.asList(groups));
- Collections.sort(groupList);
- setParameter(GROUPS, groupList);
- }
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRange.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRange.java
deleted file mode 100644
index 9fccc19..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRange.java
+++ /dev/null
@@ -1,46 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-/**
- * Show information about an IP range.
- *
- * @version $Id: IPRange.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class IPRange extends AccessControlUsecase {
-
- protected static final String IP_RANGE_ID = "ipRangeId";
- protected static final String IP_RANGE = "ipRange";
-
- /**
- * @see org.apache.lenya.cms.usecase.Usecase#setParameter(java.lang.String, java.lang.Object)
- */
- public void setParameter(String name, Object value) {
- super.setParameter(name, value);
-
- if (name.equals(IP_RANGE_ID)) {
- String ipRangeId = (String) value;
- org.apache.lenya.ac.IPRange ipRange = getIpRangeManager().getIPRange(ipRangeId);
- if (ipRange == null) {
- addErrorMessage("iprange_no_such_iprange", new String[] { ipRangeId });
- } else {
- setParameter(IP_RANGE, ipRange);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRangeGroups.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRangeGroups.java
deleted file mode 100644
index f4e7f28..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRangeGroups.java
+++ /dev/null
@@ -1,129 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.IPRange;
-import org.apache.lenya.cms.usecase.UsecaseException;
-
-/**
- * Usecase to edit a IP range's group affiliation.
- */
-public class IPRangeGroups extends AccessControlUsecase {
-
- protected static final String IP_RANGE_GROUPS = "ipRangeGroups";
- protected static final String OTHER_GROUPS = "otherGroups";
- protected static final String ADD = "add";
- protected static final String REMOVE = "remove";
- protected static final String IP_RANGE_GROUP = "ipRangeGroup";
- protected static final String OTHER_GROUP = "otherGroup";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- IPRange ipRange = getIpRange();
- ipRange.removeFromAllGroups();
-
- List ipRangeGroups = (List) getParameter(IP_RANGE_GROUPS);
- for (Iterator i = ipRangeGroups.iterator(); i.hasNext(); ) {
- Group group = (Group) i.next();
- group.add(ipRange);
- }
- ipRange.save();
- }
-
- protected IPRange getIpRange() {
- String ipRangeId = getParameterAsString(IPRangeProfile.ID);
- IPRange ipRange = getIpRangeManager().getIPRange(ipRangeId);
- if (ipRange == null) {
- throw new RuntimeException("IP range [" + ipRangeId + "] not found.");
- }
- return ipRange;
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.Usecase#advance()
- */
- public void advance() throws UsecaseException {
- super.advance();
-
- String add = getParameterAsString(ADD);
- String remove = getParameterAsString(REMOVE);
- if (add != null || remove != null) {
-
- List ipRangeGroups = (List) getParameter(IP_RANGE_GROUPS);
- List otherGroups = (List) getParameter(OTHER_GROUPS);
-
- if (add != null) {
- String groupId = getParameterAsString(OTHER_GROUP);
- if (groupId != null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("add group [" + groupId + "]");
- }
- Group group = getGroupManager().getGroup(groupId);
- ipRangeGroups.add(group);
- otherGroups.remove(group);
- }
- }
-
- if (remove != null) {
- String groupId = getParameterAsString(IP_RANGE_GROUP);
- if (groupId != null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("remove group [" + groupId + "]");
- }
- Group group = getGroupManager().getGroup(groupId);
- otherGroups.add(group);
- ipRangeGroups.remove(group);
- }
- }
-
- deleteParameter(ADD);
- deleteParameter(REMOVE);
- deleteParameter(IP_RANGE_GROUP);
- deleteParameter(OTHER_GROUP);
- }
-
- }
-
- protected void initParameters() {
- super.initParameters();
- Group[] ipRangeGroupArray = getIpRange().getGroups();
-
- List ipRangeGroups = new ArrayList(Arrays.asList(ipRangeGroupArray));
- setParameter(IP_RANGE_GROUPS, ipRangeGroups);
-
- Group[] allGroups = getGroupManager().getGroups();
- List otherGroups = new ArrayList();
- for (int i = 0; i < allGroups.length; i++) {
- if (!ipRangeGroups.contains(allGroups[i])) {
- otherGroups.add(allGroups[i]);
- }
- }
- setParameter(OTHER_GROUPS, otherGroups);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRangeProfile.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRangeProfile.java
deleted file mode 100644
index 6d1bce0..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRangeProfile.java
+++ /dev/null
@@ -1,213 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.lenya.ac.IPRange;
-import org.apache.lenya.cms.usecase.AbstractUsecase;
-
-/**
- * Usecase to change the profile of an IP range.
- */
-public class IPRangeProfile extends AccessControlUsecase {
-
- protected static final String ID = "ipRangeId";
- protected static final String NAME = "name";
- protected static final String DESCRIPTION = "description";
- protected static final String NETWORK_ADDRESS = "networkAddress";
- protected static final String SUBNET_MASK = "subnetMask";
- protected static final String PART_NUMBERS = "partNumbers";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- IPRangeProfile.validateAddresses(this);
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- String name = getParameterAsString(NAME);
- String description = getParameterAsString(DESCRIPTION);
-
- IPRange ipRange = getIPRange();
-
- ipRange.setName(name);
- ipRange.setDescription(description);
-
- StringBuffer networkBuffer = new StringBuffer();
- StringBuffer subnetBuffer = new StringBuffer();
-
- for (int i = 0; i < 4; i++) {
- if (i > 0) {
- networkBuffer.append(".");
- subnetBuffer.append(".");
- }
- Part netPart = (Part) getParameter(IPRangeProfile.NETWORK_ADDRESS + "-" + i);
- networkBuffer.append(netPart.getValue());
- Part subPart = (Part) getParameter(IPRangeProfile.SUBNET_MASK + "-" + i);
- subnetBuffer.append(subPart.getValue());
- }
-
- InetAddress networkAddress = InetAddress.getByName(networkBuffer.toString());
- ipRange.setNetworkAddress(networkAddress.getAddress());
-
- InetAddress subnetMask = InetAddress.getByName(subnetBuffer.toString());
- ipRange.setSubnetMask(subnetMask.getAddress());
-
- ipRange.save();
-
- }
-
- private IPRange ipRange;
-
- /**
- * @return The IP range.
- */
- protected IPRange getIPRange() {
- return this.ipRange;
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.Usecase#setParameter(java.lang.String,
- * java.lang.Object)
- */
- public void setParameter(String name, Object value) {
- super.setParameter(name, value);
-
- if (name.equals(ID)) {
- String id = (String) value;
- this.ipRange = getIpRangeManager().getIPRange(id);
- if (this.ipRange == null) {
- throw new RuntimeException("IP range [" + id + "] not found.");
- }
-
- setParameter(NAME, this.ipRange.getName());
- setParameter(DESCRIPTION, this.ipRange.getDescription());
-
- InetAddress networkAddress = this.ipRange.getNetworkAddress();
- InetAddress subnetMask = this.ipRange.getSubnetMask();
-
- List partNumbers = new ArrayList();
- for (byte i = 0; i < 4; i++) {
- String addrPart = Integer.toString(0xFF & networkAddress.getAddress()[i]);
- setParameter(NETWORK_ADDRESS + "-" + i, new Part(i, addrPart));
- String maskPart = Integer.toString(0xFF & subnetMask.getAddress()[i]);
- setParameter(SUBNET_MASK + "-" + i, new Part(i, maskPart));
- partNumbers.add(new Integer(i));
- }
- setParameter(IPRangeProfile.PART_NUMBERS, partNumbers);
-
- }
- }
-
- protected static void validateAddresses(AbstractUsecase usecase) {
- String[] names = { "network address", "subnet mask" };
- String[] params = { IPRangeProfile.NETWORK_ADDRESS, IPRangeProfile.SUBNET_MASK };
-
- for (byte type = 0; type < names.length; type++) {
- for (byte i = 0; i < 4; i++) {
- String paramName = params[type] + "-" + i;
- Part part = new Part(i);
- part.setValue(usecase.getParameterAsString(paramName));
- if (!part.isValid()) {
- String[] parameters = { Integer.toString(i + 1), names[type] };
- usecase.addErrorMessage("invalid-ip-address-part", parameters);
- }
- usecase.setParameter(paramName, part);
- }
- }
- }
-
- /**
- * IP address part holder.
- */
- public static class Part {
- private String value;
- private byte position;
-
- /**
- * Ctor.
- * @param _position The position.
- * @param _value The value.
- */
- public Part(byte _position, String _value) {
- this.value = _value;
- this.position = _position;
- }
-
- /**
- * Ctor.
- * @param _position The position.
- */
- public Part(byte _position) {
- this(_position, "0");
- }
-
- /**
- * Returns the position
- * @return The position
- */
- public byte getPosition() {
- return this.position;
- }
-
- /**
- * Returns the value
- * @return The value
- */
- public String getValue() {
- return this.value;
- }
-
- /**
- * @param _value The value.
- */
- public void setValue(String _value) {
- this.value = _value;
- }
-
- /**
- * Checks if the part is valid.
- * @return A boolean value.
- */
- public boolean isValid() {
-
- boolean valid = true;
- try {
- int i = Integer.parseInt(this.value);
- if (!(0 <= i && i <= 255)) {
- valid = false;
- }
- } catch (NumberFormatException e) {
- valid = false;
- }
-
- return valid;
- }
-
- }
-
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRanges.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRanges.java
deleted file mode 100644
index 99e9256..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/IPRanges.java
+++ /dev/null
@@ -1,48 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.lenya.ac.IPRange;
-
-/**
- * Manage IP ranges.
- *
- * @version $Id: IPRanges.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class IPRanges extends AccessControlUsecase {
-
- protected static final String IP_RANGES = "ipRanges";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- IPRange[] ipRanges = getIpRangeManager().getIPRanges();
- List ipRangeList = new ArrayList();
- ipRangeList.addAll(Arrays.asList(ipRanges));
- Collections.sort(ipRangeList);
- setParameter(IP_RANGES, ipRangeList);
- }
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/SessionViewer.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/SessionViewer.java
deleted file mode 100644
index a024321..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/SessionViewer.java
+++ /dev/null
@@ -1,105 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.ArrayList;
-import java.util.WeakHashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import javax.servlet.http.*;
-
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.ac.usecases.AccessControlUsecase;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.util.SessionListener;
-
-/**
- * SessionViewer usecase which gets all session objects from the SessionListener and extract the
- * necessary informations.
- *
- * @version $Id: SessionViewer.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class SessionViewer extends AccessControlUsecase {
-
- private static final String IDENTITY = Identity.class.getName();
-
- private static final String HISTORY = "org.apache.lenya.cms.cocoon.acting.History";
-
- protected static final String USERS = "users";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
- this.getSourceURL();
-
- SessionListener sessions = new SessionListener();
- WeakHashMap allSessions = sessions.getAllSessions();
- List userList = new ArrayList();
-
- Iterator userit = allSessions.entrySet().iterator();
- while (userit.hasNext()) {
- Map.Entry entry = (Map.Entry) userit.next();
- HttpSession nextsession = (HttpSession) entry.getValue();
-
- Identity identity = (Identity) nextsession.getAttribute(IDENTITY);
-
- if(identity == null) {
- continue;
- }
-
- User user = identity.getUser();
- if (user != null) {
- Vector history = (Vector) nextsession.getAttribute(HISTORY);
- String publicationID = getPublicationIDfromHistory(history);
- if (publicationID.equals(getPublicationIDfromURL())) {
- userList.add(identity.getUser());
- }
- }
- }
- setParameter(USERS, userList);
- }
-
- /**
- * Extract the publicationID from the history information stored in the session
- *
- * @param history The history stored in the session.. An entry looks like \/
- * <publication-id>/authoring/index.html
- * @return A publication ID.
- */
- private String getPublicationIDfromHistory(Vector history) {
-
- String firstElement = history.firstElement().toString();
- String publicationID = firstElement.substring(1, firstElement.indexOf("/", 1));
-
- return publicationID;
- }
-
- /**
- * @return The publicationID from an URL.
- */
- private String getPublicationIDfromURL() {
- URLInformation info = new URLInformation(getSourceURL());
- return info.getPublicationId();
- }
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Usecases.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Usecases.java
deleted file mode 100644
index b0293e7..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Usecases.java
+++ /dev/null
@@ -1,125 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.Arrays;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.lenya.ac.Authorizer;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.cms.ac.usecase.UsecaseAuthorizer;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.usecase.UsecaseResolver;
-
-/**
- * Edit usecase policies.
- */
-public class Usecases extends AccessControlUsecase {
-
- protected void initParameters() {
- super.initParameters();
-
- UsecaseResolver resolver = null;
- try {
- resolver = (UsecaseResolver) this.manager.lookup(UsecaseResolver.ROLE);
- String[] allUsecases = resolver.getUsecaseNames();
- SortedSet rootUsecases = new TreeSet();
- for (int i = 0; i < allUsecases.length; i++) {
- if (allUsecases[i].indexOf("/") == -1) {
- rootUsecases.add(allUsecases[i]);
- }
- }
-
- String[] usecases = (String[]) rootUsecases.toArray(new String[rootUsecases.size()]);
-
- setParameter("usecases", usecases);
-
- Role[] roles = getAccessController().getAccreditableManager().getRoleManager()
- .getRoles();
- String[] roleNames = new String[roles.length];
- for (int r = 0; r < roles.length; r++) {
- roleNames[r] = roles[r].getId();
- }
- Arrays.sort(roleNames);
- setParameter("roles", roleNames);
-
- Publication pub = getPublication();
- setParameter("publicationId", pub.getId());
- setParameter("templates", pub.getTemplateIds());
-
- for (int u = 0; u < usecases.length; u++) {
- for (int r = 0; r < roles.length; r++) {
- boolean value = getUsecaseAuthorizer().isPermitted(usecases[u], pub, roles[r]);
- setParameter(usecases[u] + ":" + roles[r], Boolean.valueOf(value));
- }
- }
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- }
-
- }
-
- protected Publication getPublication() throws PublicationException {
- String pubId = new URLInformation(getSourceURL()).getPublicationId();
- Publication pub = getDocumentFactory().getPublication(pubId);
- return pub;
- }
-
- protected void doExecute() throws Exception {
- super.doExecute();
-
- String[] usecases = (String[]) getParameter("usecases");
- String[] roleNames = (String[]) getParameter("roles");
-
- Publication pub = getPublication();
- for (int u = 0; u < usecases.length; u++) {
- for (int r = 0; r < roleNames.length; r++) {
- String key = usecases[u] + ":" + roleNames[r];
- String stringValue = getBooleanCheckboxParameter(key);
- boolean value = Boolean.valueOf(stringValue).booleanValue();
- Role role = getAccessController().getAccreditableManager().getRoleManager()
- .getRole(roleNames[r]);
- getUsecaseAuthorizer().setPermission(usecases[u], pub, role, value);
- }
- }
-
- }
-
- private UsecaseAuthorizer authorizer;
-
- protected UsecaseAuthorizer getUsecaseAuthorizer() {
- if (this.authorizer == null) {
- Authorizer[] authorizers = getAccessController().getAuthorizers();
- for (int i = 0; i < authorizers.length; i++) {
- if (authorizers[i] instanceof UsecaseAuthorizer) {
- this.authorizer = (UsecaseAuthorizer) authorizers[i];
- }
- }
- }
- return this.authorizer;
- }
-
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/User.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/User.java
deleted file mode 100644
index ad0929e..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/User.java
+++ /dev/null
@@ -1,46 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-/**
- * Display user information.
- *
- * @version $Id: User.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class User extends AccessControlUsecase {
-
- protected static final String USER_ID = "userId";
- protected static final String USER = "user";
-
- /**
- * @see org.apache.lenya.cms.usecase.Usecase#setParameter(java.lang.String, java.lang.Object)
- */
- public void setParameter(String name, Object value) {
- super.setParameter(name, value);
-
- if (name.equals(USER_ID)) {
- String userId = (String) value;
- org.apache.lenya.ac.User user = getUserManager().getUser(userId);
- if (user == null) {
- addErrorMessage("user_no_such_user", new String[]{userId});
- } else {
- setParameter(USER, user);
- }
- }
- }
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserGroups.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserGroups.java
deleted file mode 100644
index 6a342ac..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserGroups.java
+++ /dev/null
@@ -1,129 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.lenya.ac.Group;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.usecase.UsecaseException;
-
-/**
- * Usecase to edit a user's group affiliation.
- */
-public class UserGroups extends AccessControlUsecase {
-
- protected static final String USER_GROUPS = "userGroups";
- protected static final String OTHER_GROUPS = "otherGroups";
- protected static final String ADD = "add";
- protected static final String REMOVE = "remove";
- protected static final String USER_GROUP = "userGroup";
- protected static final String OTHER_GROUP = "otherGroup";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- User user = getUser();
- user.removeFromAllGroups();
-
- List userGroups = (List) getParameter(USER_GROUPS);
- for (Iterator i = userGroups.iterator(); i.hasNext();) {
- Group group = (Group) i.next();
- group.add(user);
- }
- user.save();
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.Usecase#advance()
- */
- public void advance() throws UsecaseException {
- super.advance();
-
- String add = getParameterAsString(ADD);
- String remove = getParameterAsString(REMOVE);
- if (add != null || remove != null) {
-
- List userGroups = (List) getParameter(USER_GROUPS);
- List otherGroups = (List) getParameter(OTHER_GROUPS);
-
- if (add != null) {
- String groupId = getParameterAsString(OTHER_GROUP);
- if (groupId != null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("add group [" + groupId + "]");
- }
- Group group = getGroupManager().getGroup(groupId);
- userGroups.add(group);
- otherGroups.remove(group);
- }
- }
-
- if (remove != null) {
- String groupId = getParameterAsString(USER_GROUP);
- if (groupId != null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("remove group [" + groupId + "]");
- }
- Group group = getGroupManager().getGroup(groupId);
- otherGroups.add(group);
- userGroups.remove(group);
- }
- }
-
- deleteParameter(ADD);
- deleteParameter(REMOVE);
- deleteParameter(USER_GROUP);
- deleteParameter(OTHER_GROUP);
- }
-
- }
-
- protected User getUser() {
- String userId = getParameterAsString(UserProfile.USER_ID);
- User user = getUserManager().getUser(userId);
- if (user == null) {
- throw new RuntimeException("User [" + userId + "] not found.");
- }
- return user;
- }
-
- protected void initParameters() {
- super.initParameters();
-
- Group[] userGroupArray = getUser().getGroups();
- List userGroups = new ArrayList(Arrays.asList(userGroupArray));
- setParameter(USER_GROUPS, userGroups);
-
- Group[] allGroups = getGroupManager().getGroups();
- List otherGroups = new ArrayList();
- for (int i = 0; i < allGroups.length; i++) {
- if (!userGroups.contains(allGroups[i])) {
- otherGroups.add(allGroups[i]);
- }
- }
- setParameter(OTHER_GROUPS, otherGroups);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserProfile.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserProfile.java
deleted file mode 100644
index f429d57..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/UserProfile.java
+++ /dev/null
@@ -1,105 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.ItemUtil;
-
-/**
- * Usecase to edit a user's profile.
- */
-public class UserProfile extends AccessControlUsecase {
-
- protected static final String USER_ID = "userId";
- protected static final String FULL_NAME = "fullName";
- protected static final String EMAIL = "email";
- protected static final String DESCRIPTION = "description";
- protected static final String MENU_LOCALE = "defaultMenuLocale";
- protected static final String DOCUMENT_LOCALE = "defaultDocumentLocale";
-
- /**
- * Ctor.
- */
- public UserProfile() {
- super();
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
-
- String email = getParameterAsString(UserProfile.EMAIL);
- if (!ItemUtil.isValidEmail(email)) {
- addErrorMessage("Please enter a valid e-mail address.");
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- String fullName = getParameterAsString(UserProfile.FULL_NAME);
- String description = getParameterAsString(UserProfile.DESCRIPTION);
- String email = getParameterAsString(UserProfile.EMAIL);
- String defaultMenuLocale = getParameterAsString(UserProfile.MENU_LOCALE);
- String defaultDocumentLocale = getParameterAsString(UserProfile.DOCUMENT_LOCALE);
-
- getUser().setEmail(email);
- getUser().setName(fullName);
- getUser().setDescription(description);
- getUser().setDefaultMenuLocale(defaultMenuLocale);
- getUser().setDefaultDocumentLocale(defaultDocumentLocale);
- getUser().save();
-
- }
-
- private User user;
-
- /**
- * Returns the currently edited user.
- * @return A user.
- */
- protected User getUser() {
- return this.user;
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.Usecase#setParameter(java.lang.String, java.lang.Object)
- */
- public void setParameter(String name, Object value) {
- super.setParameter(name, value);
-
- if (name.equals(USER_ID)) {
- String userId = (String) value;
- this.user = getUserManager().getUser(userId);
- if (this.user == null) {
- throw new RuntimeException("User [" + userId + "] not found.");
- }
-
- setParameter(EMAIL, this.user.getEmail());
- setParameter(DESCRIPTION, this.user.getDescription());
- setParameter(MENU_LOCALE, this.user.getDefaultMenuLocale());
- setParameter(DOCUMENT_LOCALE, this.user.getDefaultDocumentLocale());
- setParameter(FULL_NAME, this.user.getName());
- }
- }
-
-}
diff --git a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Users.java b/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Users.java
deleted file mode 100644
index 2861571..0000000
--- a/trunk/src/modules-core/administration/java/src/org/apache/lenya/cms/ac/usecases/Users.java
+++ /dev/null
@@ -1,67 +0,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.
- *
- */
-package org.apache.lenya.cms.ac.usecases;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Session;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.UserType;
-
-/**
- * Manage users.
- *
- * @version $Id: Users.java 407305 2006-05-17 16:21:49Z andreas $
- */
-public class Users extends AccessControlUsecase {
-
- protected static final String USERS = "users";
- protected static final String CURRENT_USER = "currentUser";
- protected static final String USER_TYPES = "userTypes";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- User[] users = getUserManager().getUsers();
- List userList = new ArrayList();
- userList.addAll(Arrays.asList(users));
- Collections.sort(userList);
- setParameter(USERS, userList);
-
- Request request = ContextHelper.getRequest(getContext());
- Session session = request.getSession(false);
- if (session != null) {
- Identity identity = (Identity) session.getAttribute(Identity.class.getName());
- if (identity != null) {
- setParameter(CURRENT_USER, identity.getUser());
- }
- }
-
- UserType[] types = getUserManager().getUserTypes();
- setParameter(USER_TYPES, Arrays.asList(types));
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/resources/i18n/cmsui.xml b/trunk/src/modules-core/administration/resources/i18n/cmsui.xml
deleted file mode 100644
index c119e0b..0000000
--- a/trunk/src/modules-core/administration/resources/i18n/cmsui.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?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.
--->
-
-<!-- $Id: cmsui.xml 446564 2006-09-15 10:13:16Z andreas $ -->
-
-<catalogue xml:lang="en" xmlns:xhtml="http://www.w3.org/1999/xhtml">
-
- <message key="Documents in trash">Documents in trash</message>
- <message key="The trash is empty.">The trash is empty.</message>
- <message key="Sessions">Sessions</message>
- <message key="Path">Path</message>
- <message key="Inbox">Inbox</message>
- <message key="usecase-policies-message">Here you can choose which usecases should be executable by which roles.</message>
- <message key="Server Status">Server Status</message>
- <message key="e-mail">E-Mail</message>
- <message key="No groups assigned">No groups assigned</message>
-
- <message key="Local User">Local User</message>
- <message key="add-user">Add {0}</message>
- <message key="This is not a valid user ID.">This is not a valid user ID.</message>
- <message key="Please enter a valid e-mail address.">Please enter a valid e-mail address.</message>
- <message key="Password and confirmed password are not equal.">Password and confirmed password are not equal.</message>
- <message key="This is not a valid group ID.">This is not a valid group ID.</message>
- <message key="Group Users">Group Users</message>
- <message key="All Users">All Users</message>
- <message key="This is not a valid IP range ID.">This is not a valid IP range ID.</message>
- <message key="invalid-ip-address-part">Part {0} of the {1} is not valid.</message>
- <message key="The old password is not correct.">The old password is not correct.</message>
- <message key="The password must be at least six characters long.">The password must be at least six characters long.</message>
- <message key="The password must contain at least one number.">The password must contain at least one number.</message>
- <message key="IP Range Groups">IP Range Groups</message>
-
- <message key="cannot-assign-role">The role <xhtml:q>{0}</xhtml:q> cannot be assigned.</message>
- <message key="credential-already-contained">
- The role <xhtml:q>{1}</xhtml:q> is already assigned to the object <xhtml:q>{0}</xhtml:q>.
- </message>
-
-</catalogue>
diff --git a/trunk/src/modules-core/administration/resources/i18n/cmsui_de.xml b/trunk/src/modules-core/administration/resources/i18n/cmsui_de.xml
deleted file mode 100644
index 11e962b..0000000
--- a/trunk/src/modules-core/administration/resources/i18n/cmsui_de.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?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.
--->
-
-<!-- $Id: cmsui_de.xml 446564 2006-09-15 10:13:16Z andreas $ -->
-
-<catalogue xml:lang="de" xmlns:xhtml="http://www.w3.org/1999/xhtml">
-
- <message key="Documents in trash">Dokumente im Papierkorb</message>
- <message key="The trash is empty.">Der Papierkorb ist leer.</message>
- <message key="Sessions">Sitzungen</message>
- <message key="Path">Pfad</message>
- <message key="Inbox">Posteingang</message>
- <message key="usecase-policies-message">Hier können Sie festlegen, welche Usecases durch welche Rollen ausgeführt werden dürfen.</message>
- <message key="Server Status">Server-Status</message>
- <message key="e-mail">E-Mail</message>
- <message key="No groups assigned">Keine Gruppen zugeordnet</message>
-
- <message key="Local User">Lokalen Benutzer</message>
- <message key="add-user">{0} hinzufügen</message>
- <message key="This is not a valid user ID.">Die Benutzer-ID ist ungültig.</message>
- <message key="Please enter a valid e-mail address.">Bitte geben Sie eine gültige E-Mail-Adresse ein.</message>
- <message key="Password and confirmed password are not equal.">Passwort und Passwortbestätigung stimmen nicht überein.</message>
- <message key="This is not a valid group ID.">Die Gruppen-ID ist ungültig.</message>
- <message key="Group Users">Gruppen-Benutzer</message>
- <message key="All Users">Alle Benutzer</message>
- <message key="This is not a valid IP range ID.">Die IP-Bereichs-ID ist ungültig.</message>
- <message key="invalid-ip-address-part">Abschnitt {0} des Feldes "{1}" ist ungültig.</message>
- <message key="The old password is not correct.">Das bestehende Passwort wurde nicht korrekt eingegeben.</message>
- <message key="The password must be at least six characters long.">Das Passwort muss mindestens 6 Zeichen lang sein.</message>
- <message key="The password must contain at least one number.">Das Passwort muss mindestens eine Ziffer enthalten.</message>
- <message key="IP Range Groups">Gruppen des<br/>IP-Bereichs</message>
-
- <message key="cannot-assign-role">Die Rolle <xhtml:q>{0}</xhtml:q> kann nicht zugeordnet werden.</message>
- <message key="credential-already-contained">
- Die Rolle <xhtml:q>{1}</xhtml:q> wurde dem Objekt <xhtml:q>{0}</xhtml:q> bereits zugeordnet.
- </message>
-
-</catalogue>
-
diff --git a/trunk/src/modules-core/administration/sitemap.xmap b/trunk/src/modules-core/administration/sitemap.xmap
deleted file mode 100644
index 7d8f2eb..0000000
--- a/trunk/src/modules-core/administration/sitemap.xmap
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
--->
-
-<!-- $Id: admin.xmap 160670 2005-04-09 09:12:12Z andreas $ -->
-
-<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
-
- <map:pipelines>
- <map:pipeline>
-
- <map:match pattern="status.xml">
- <map:generate src="status" type="status"/>
- <map:transform src="fallback://lenya/xslt/admin/status2html.xsl"/>
- <map:serialize type="xml"/>
- </map:match>
-
- </map:pipeline>
- </map:pipelines>
-
-</map:sitemap>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/test/canoo/test.xml b/trunk/src/modules-core/administration/test/canoo/test.xml
deleted file mode 100644
index 37fc4f6..0000000
--- a/trunk/src/modules-core/administration/test/canoo/test.xml
+++ /dev/null
@@ -1,142 +0,0 @@
-<?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 project SYSTEM "../../../../modules/development/test/canoo/lenya_webtest.dtd">
-
-<project name="administration" basedir="." default="main">
-
- <import file="../../../../modules/development/test/canoo/macros.xml"/>
-
- <target name="main" depends="admin.users, groupaffiliation"/>
-
- <target name="admin.users">
- <webtest name="admin.users">
- &doConfig;
- <steps>
- <doLogin username="lenya" password="levi"/>
-
- <!-- add user -->
- <invoke url="index.html?lenya.usecase=admin.users"/>
- <verifyText text="Add User:"/>
- <clickButton name="input-add_user"/>
- <verifyElementText type="h1" text="Add Local User"/>
- <setInputField name="userId" value="webTestUser"/>
- <setInputField name="fullName" value="WebTest User"/>
- <setInputField name="description" value="WebTest User description"/>
- <setInputField name="email" value="webTestUser@apache.org"/>
- <setInputField name="newPassword" value="webTest123"/>
- <setInputField name="confirmPassword" value="webTest123"/>
- <clickButton name="submit"/>
-
- <verifyText text="User Profile"/>
- <verifyText text="webTestUser@apache.org"/>
-
- <!-- back to users list -->
- <invoke url="index.html?lenya.usecase=admin.users"/>
-
- <!-- user IDs are automatically converted to lowercase -->
- <verifyXPath xpath="//a[normalize-space(.) = 'webtestuser']"/>
-
- <!-- delete user -->
- <clickButton xpath="//form[input[@value = 'webtestuser']]/input[@type = 'submit']"/>
- <verifyText text="Delete User"/>
- <verifyText text="webtestuser"/>
- <clickButton name="submit"/>
- <verifyText text="Add User:"/>
- <not>
- <verifyXPath xpath="//a[normalize-space(.) = 'webtestuser']"/>
- </not>
-
- <doLogout/>
- </steps>
- </webtest>
- </target>
-
- <macrodef name="checkGroup"
- description="check if item 'group' is in listbox 'list-in' and not in 'list-not'">
- <attribute name="group"/>
- <attribute name="list-in"/>
- <attribute name="list-not"/>
- <sequential>
- <verifyXPath xpath="//select[@name = '@{list-in}']/option[@value = '@{group}']"/>
- <not>
- <verifyXPath xpath="//select[@name = '@{list-not}']/option[@value = '@{group}']"/>
- </not>
- </sequential>
- </macrodef>
- <macrodef name="checkUserProfile"
- description="check if user profile looks right">
- <attribute name="admin"/>
- <sequential>
- <verifyText text="User Profile"/>
- <verifyText text="alice@lenya.org"/>
- <ifStep test="@{admin}" description="admin affiliation">
- <verifyText text="groupId=admin"/>
- </ifStep>
- <ifStep unless="@{admin}" description="no admin affiliation">
- <not><verifyText text="groupId=admin"/></not>
- </ifStep>
- </sequential>
- </macrodef>
-
- <target name="groupaffiliation">
- <webtest name="groupaffiliation">
- &doConfig;
- <steps>
- <doLogin username="lenya" password="levi"/>
-
- <!-- request user profile of user alice -->
- <invoke url="index.html?lenya.usecase=admin.user&userId=alice"/>
- <checkUserProfile admin="false"/>
-
- <!-- request group affiliation page -->
- <clickButton name="input-edit_group_affiliation"/>
- <verifyElementText type="h1" text="Group Affiliation"/>
- <checkGroup group="admin" list-in="otherGroup" list-not="userGroup"/>
-
- <!-- add user alice to group admin -->
- <clickElement xpath="//select[@name = 'otherGroup']/option[@value = 'admin']"/>
- <clickButton name="add"/>
- <verifyElementText type="h1" text="Group Affiliation"/>
- <checkGroup group="admin" list-in="userGroup" list-not="otherGroup"/>
-
- <!-- save and back to user profile -->
- <clickButton name="submit"/>
- <checkUserProfile admin="true"/>
-
- <!-- request group affiliation page -->
- <clickButton name="input-edit_group_affiliation"/>
- <verifyElementText type="h1" text="Group Affiliation"/>
- <checkGroup group="admin" list-in="userGroup" list-not="otherGroup"/>
-
- <!-- remove user alice from group admin -->
- <clickElement xpath="//select[@name = 'userGroup']/option[@value = 'admin']"/>
- <clickButton name="remove"/>
- <verifyElementText type="h1" text="Group Affiliation"/>
- <checkGroup group="admin" list-in="otherGroup" list-not="userGroup"/>
-
- <!-- save and back to user profile -->
- <clickButton name="submit"/>
- <checkUserProfile admin="false"/>
-
- <doLogout/>
- </steps>
- </webtest>
- </target>
-
-</project>
diff --git a/trunk/src/modules-core/administration/usecases/aboutLenya.jx b/trunk/src/modules-core/administration/usecases/aboutLenya.jx
deleted file mode 100644
index 5c0186f..0000000
--- a/trunk/src/modules-core/administration/usecases/aboutLenya.jx
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-<!-- $Id: addGroup.jx 496697 2007-01-16 14:12:36Z andreas $ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns:ci="http://apache.org/cocoon/include/1.0"
- >
-
- <ci:include src="context://lenya/content/about.xml" select="*/*"/>
-
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/addGroup.jx b/trunk/src/modules-core/administration/usecases/addGroup.jx
deleted file mode 100644
index cb1be65..0000000
--- a/trunk/src/modules-core/administration/usecases/addGroup.jx
+++ /dev/null
@@ -1,69 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Add Group</i18n:text></h1>
-
- <form id="form-add_group">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="groupId"><i18n:text>Group ID</i18n:text> *</label></td>
- <td><input type="text" name="groupId" class="lenya-form-element" value="${request.getParameter('groupId')}"/></td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="name"><i18n:text>Name</i18n:text></label></td>
- <td><input type="text" name="name" class="lenya-form-element" value="${request.getParameter('name')}"/></td>
- </tr>
- <tr>
- <td valign="top" class="lenya-entry-caption"><label for="description"><i18n:text>Description</i18n:text></label></td>
- <td>
- <!-- N.B.: do not put spaces or carriage returns inside the
- textarea element - these would be rendered -->
- <textarea name="description" class="lenya-form-element"><jx:out value="${request.getParameter('description')}"/></textarea>
- </td>
- </tr>
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Add"/>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/addIPRange.jx b/trunk/src/modules-core/administration/usecases/addIPRange.jx
deleted file mode 100644
index 606a3ef..0000000
--- a/trunk/src/modules-core/administration/usecases/addIPRange.jx
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
-
- <h1><i18n:text>Add IP Range</i18n:text></h1>
-
- <form id="form-add_ip_range">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>IP Range ID</i18n:text> *</td>
- <td><input type="text" name="ipRangeId" class="lenya-form-entry" value="${request.getParameter('ipRangeId')}"/></td>
- </tr>
-
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Name</i18n:text></td>
- <td><input type="text" name="name" class="lenya-form-entry" value="${request.getParameter('name')}"/></td>
- </tr>
- <tr>
- <td valign="top" class="lenya-entry-caption"><i18n:text>Description</i18n:text></td>
- <td>
- <textarea name="description" class="lenya-form-entry">
- <jx:out value="${request.getParameter('description')}"/>
- </textarea>
- </td>
- </tr>
-
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Network Address</i18n:text></td>
- <td>
- <jx:forEach var="part" items="${usecase.getParameter('partNumbers')}">
- <jx:choose>
- <jx:when test="${usecase.getParameter('networkAddress-' + part).isValid()}">
- <input type="text" name="networkAddress-${part}" size="3" maxlength="3"
- value="${usecase.getParameter('networkAddress-' + part).getValue()}"
- style="text-align: right"/>
- </jx:when>
- <jx:otherwise>
- <input type="text" name="networkAddress-${part}" size="3" maxlength="3"
- value="${usecase.getParameter('networkAddress-' + part).getValue()}"
- style="background-color: #FF9999; text-align: right;"/>
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Subnet Mask</i18n:text></td>
- <td>
- <jx:forEach var="part" items="${usecase.getParameter('partNumbers')}">
- <jx:choose>
- <jx:when test="${usecase.getParameter('subnetMask-' + part).isValid()}">
- <input type="text" name="subnetMask-${part}" size="3" maxlength="3"
- value="${usecase.getParameter('subnetMask-' + part).getValue()}"
- style="text-align: right"/>
- </jx:when>
- <jx:otherwise>
- <input type="text" name="subnetMask-${part}" size="3" maxlength="3"
- value="${usecase.getParameter('subnetMask-' + part).getValue()}"
- style="background-color: #FF9999; text-align: right;"/>
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Add"/>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/addUser.jx b/trunk/src/modules-core/administration/usecases/addUser.jx
deleted file mode 100644
index dc515ae..0000000
--- a/trunk/src/modules-core/administration/usecases/addUser.jx
+++ /dev/null
@@ -1,101 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
-
- <h1>
- <i18n:translate>
- <i18n:text>add-user</i18n:text>
- <i18n:param><i18n:text><jx:out value="${request.getParameter('userType')}"/></i18n:text></i18n:param>
- </i18n:translate>
- </h1>
-
- <form id="form-add_user" method="POST">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="userId"><i18n:text>User ID</i18n:text> *</label></td>
- <td><input type="text" name="userId" class="lenya-form-element" value="${request.getParameter('userId')}"/></td>
- </tr>
-
- <jx:if test="${request.getParameter('className') == 'org.apache.lenya.ac.ldap.LDAPUser'}">
- <tr>
- <td class="lenya-entry-caption"><label for="ldapId"><i18n:text>LDAP ID</i18n:text> *</label></td>
- <td><input type="text" name="ldapId" class="lenya-form-element" value="${request.getParameter('ldapId')}"/></td>
- </tr>
- </jx:if>
-
- <tr>
- <td class="lenya-entry-caption"><label for="fullName"><i18n:text>Name</i18n:text></label></td>
- <td><input type="text" name="fullName" class="lenya-form-element" value="${request.getParameter('fullName')}"/></td>
- </tr>
- <tr>
- <td valign="top" class="lenya-entry-caption"><label for="description"><i18n:text>Description</i18n:text></label></td>
- <td>
- <!-- N.B.: do not put spaces or carriage returns inside the
- textare element - these would be rendered -->
- <textarea name="description" class="lenya-form-element"><jx:out value="${request.getParameter('description')}"/></textarea>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="email"><i18n:text>E-Mail</i18n:text> *</label></td>
- <td><input type="text" name="email" class="lenya-form-element" value="${request.getParameter('email')}"/></td>
- </tr>
-
- <jx:if test="${request.getParameter('className') != 'org.apache.lenya.ac.ldap.LDAPUser'}">
- <tr>
- <td class="lenya-entry-caption"><label for="newPassword"><i18n:text>Password</i18n:text> *</label></td>
- <td><input type="password" name="newPassword" class="lenya-form-element" value="${request.getParameter('newPassword')}"/></td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="confirmPassword"><i18n:text>Confirm password</i18n:text> *</label></td>
- <td><input type="password" name="confirmPassword" class="lenya-form-element" value="${request.getParameter('confirmPassword')}"/></td>
- </tr>
- </jx:if>
-
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Add"/>
- <a href="?lenya.usecase=admin.users">
- <input type="button" name="cancel" value="Cancel" i18n:attr="value"/>
- </a>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/changePassword.jx b/trunk/src/modules-core/administration/usecases/changePassword.jx
deleted file mode 100644
index 6432b00..0000000
--- a/trunk/src/modules-core/administration/usecases/changePassword.jx
+++ /dev/null
@@ -1,40 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:title>
- <i18n:text>Change Password</i18n:text>
- </page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:text>Change Password</i18n:text>
- </div>
- <div class="lenya-box-body">
- <jx:import uri="fallback://lenya/modules/administration/usecases/passwordForm.jx"/>
- </div>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/changePasswordAdmin.jx b/trunk/src/modules-core/administration/usecases/changePasswordAdmin.jx
deleted file mode 100644
index 0d40ba5..0000000
--- a/trunk/src/modules-core/administration/usecases/changePasswordAdmin.jx
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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.
--->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
-
- <h1>
- <i18n:text>Change Password</i18n:text>
- </h1>
-
- <jx:import uri="fallback://lenya/modules/administration/usecases/passwordForm.jx"/>
-
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/deleteGroup.jx b/trunk/src/modules-core/administration/usecases/deleteGroup.jx
deleted file mode 100644
index dfea4c3..0000000
--- a/trunk/src/modules-core/administration/usecases/deleteGroup.jx
+++ /dev/null
@@ -1,62 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Delete Group</i18n:text></h1>
-
- <form id="form-delete_group">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td/>
- <td>
- <i18n:translate>
- <i18n:text i18n:key="delete-object?"/>
- <i18n:param><i18n:text>group</i18n:text> <q><jx:out value="${request.getParameter('groupId')}"/></q></i18n:param>
- </i18n:translate>
- </td>
- </tr>
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Yes"/>
- <input i18n:attr="value" type="submit" name="cancel" value="No"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/deleteUser.jx b/trunk/src/modules-core/administration/usecases/deleteUser.jx
deleted file mode 100644
index 192adbb..0000000
--- a/trunk/src/modules-core/administration/usecases/deleteUser.jx
+++ /dev/null
@@ -1,61 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Delete User</i18n:text></h1>
- <form id="form-delete_user">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td/>
- <td>
- <i18n:translate>
- <i18n:text i18n:key="delete-object?"/>
- <i18n:param><i18n:text>user</i18n:text> <q><jx:out value="${request.getParameter('userId')}"/></q></i18n:param>
- </i18n:translate>
- </td>
- </tr>
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Yes"/>
- <input i18n:attr="value" type="submit" name="cancel" value="No"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/emptyTrash.jx b/trunk/src/modules-core/administration/usecases/emptyTrash.jx
deleted file mode 100644
index 75e5f27..0000000
--- a/trunk/src/modules-core/administration/usecases/emptyTrash.jx
+++ /dev/null
@@ -1,73 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Delete Trash</i18n:text></h1>
-
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- <p>
- <jx:choose>
- <jx:when test="${usecase.getParameter('documents').isEmpty()}">
- <i18n:text>The trash is empty.</i18n:text>
- </jx:when>
- <jx:otherwise>
- <table class="lenya-table-list-noborder">
- <tr>
- <th colspan="2"><i18n:text>Documents in trash</i18n:text></th>
- </tr>
- <jx:forEach var="document" items="${usecase.getParameter('documents')}">
- <tr>
- <td>
- <jx:if test="${document.hasLink()}">
- <jx:out value="${document.getPath()}"/>
- </jx:if>
- </td>
- <td>
- <jx:out value="${document.getMetaData('http://purl.org/dc/elements/1.1/').getFirstValue('title')}"/>
- </td>
- </tr>
- </jx:forEach>
- </table>
- </jx:otherwise>
- </jx:choose>
- </p>
- <form id="form-delete_trash" style="margin-top: 20px">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <jx:choose>
- <jx:when test="${usecase.getParameter('documents').isEmpty()}">
- <input i18n:attr="value" name="submit" type="submit" value="Delete" disabled="disabled"/>
- </jx:when>
- <jx:otherwise>
- <input i18n:attr="value" name="submit" type="submit" value="Delete"/>
- </jx:otherwise>
- </jx:choose>
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/group.jx b/trunk/src/modules-core/administration/usecases/group.jx
deleted file mode 100644
index a38aced..0000000
--- a/trunk/src/modules-core/administration/usecases/group.jx
+++ /dev/null
@@ -1,99 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Group Profile</i18n:text></h1>
-
- <jx:set var="group" value="${usecase.getParameter('group')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Group ID</i18n:text>:</td>
- <td><jx:out value="${group.getId()}"/></td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Name</i18n:text>:</td>
- <td><jx:out value="${group.getName()}"/></td>
- </tr>
- <tr>
- <td valign="top" class="lenya-entry-caption"><i18n:text>Description</i18n:text>:</td>
- <td>
- <!-- N.B.: do not put spaces or carriage returns inside the
- textarea element - these would be rendered -->
- <jx:out value="${group.getDescription()}"/>
- </td>
- </tr>
- <tr>
- <td/>
- <td>
- <form id="form-edit_profile">
- <input type="hidden" name="lenya.usecase" value="admin.groupProfile"/>
- <input type="hidden" name="groupId" value="${group.getId()}"/>
- <input i18n:attr="value" type="submit" value="Edit Profile" name="input-edit_profile"/>
- </form>
- </td>
- </tr>
-
- <tr>
- <td valign="top" class="lenya-entry-caption"><i18n:text>Members</i18n:text>:</td>
- <td>
- <jx:set var="members" value="${group.getMembers()}"/>
- <jx:forEach var="member" items="${members}"><jx:if test="${member != members[0]}">, </jx:if>
- <a href="?lenya.usecase=admin.user&userId=${member.getId()}"><jx:out value="${member.getId()}"/></a></jx:forEach>
- </td>
- </tr>
- <tr>
- <td/>
- <td>
- <form id="form-edit_members">
- <input type="hidden" name="lenya.usecase" value="admin.groupMembers"/>
- <input type="hidden" name="groupId" value="${group.getId()}"/>
- <input i18n:attr="value" type="submit" value="Edit Members" name="input-edit_members"/>
- </form>
- </td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <form id="form-cancel">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/groupMembers.jx b/trunk/src/modules-core/administration/usecases/groupMembers.jx
deleted file mode 100644
index 3eb00b2..0000000
--- a/trunk/src/modules-core/administration/usecases/groupMembers.jx
+++ /dev/null
@@ -1,91 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Group Affiliation</i18n:text></h1>
-
- <form method="post" id="form-group_affiliation">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- </table>
-
- <table class="lenya-table-noborder-nopadding">
- <tr>
- <td>
- <strong>
- <i18n:text>Group Users</i18n:text>
- </strong>
- </td>
- <td/>
- <td>
- <strong>
- <i18n:text>All Users</i18n:text>
- </strong>
- </td>
- </tr>
- <tr>
- <td valign="middle">
- <select name="groupUser" size="15" class="lenya-form-element-narrow">
- <jx:forEach var="user" items="${usecase.getParameter('groupUsers')}">
- <option value="${user}"><jx:out value="${user}"/></option>
- </jx:forEach>
- </select>
- </td>
- <td valign="middle">
- <input name="add" type="submit" value="<"/>
- <br/>
- <input name="remove" type="submit" value=">"/>
- </td>
- <td valign="middle">
- <select name="otherUser" size="15" class="lenya-form-element-narrow">
- <jx:forEach var="otherUser" items="${usecase.getParameter('otherUsers')}">
- <option value="${otherUser}"><jx:out value="${otherUser}"/></option>
- </jx:forEach>
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="3" style="text-align: center">
- <br/>
- <input i18n:attr="value" type="submit" name="submit" value="Save"/>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
-
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/groupProfile.jx b/trunk/src/modules-core/administration/usecases/groupProfile.jx
deleted file mode 100644
index 03804f0..0000000
--- a/trunk/src/modules-core/administration/usecases/groupProfile.jx
+++ /dev/null
@@ -1,70 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Edit Group Profile</i18n:text></h1>
-
- <form id="form-edit_group_profile">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Group ID</i18n:text>:</td>
- <td><jx:out value="${usecase.getParameter('groupId')}"/></td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="name"><i18n:text>Name</i18n:text>:</label></td>
- <td><input type="text" name="name" class="lenya-form-element" value="${usecase.getParameter('name')}"/></td>
- </tr>
- <tr>
- <td valign="top" class="lenya-entry-caption"><label for="description"><i18n:text>Description</i18n:text>:</label></td>
- <td>
- <!-- N.B.: do not put spaces or carriage returns inside the
- textarea element - these would be rendered -->
- <textarea name="description" class="lenya-form-element"><jx:out value="${usecase.getParameter('description')}"/></textarea>
- </td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Save"/>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/groups.jx b/trunk/src/modules-core/administration/usecases/groups.jx
deleted file mode 100644
index bda1dc6..0000000
--- a/trunk/src/modules-core/administration/usecases/groups.jx
+++ /dev/null
@@ -1,81 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
-
- <h1><i18n:text>Groups</i18n:text></h1>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- </table>
-
- <div style="margin-bottom: 10px">
- <table class="lenya-table-noborder">
- <tr>
- <td style="padding: 0px">
- <form method="GET" id="form-add_group">
- <input type="hidden" name="lenya.usecase" value="admin.addGroup"/>
- <input i18n:attr="value" type="submit" value="Add Group" name="input-add_group"/>
- </form>
- </td>
- </tr>
- </table>
- </div>
-
- <table cellspacing="0" class="lenya-table-list-noborder">
- <tr>
- <th><i18n:text>Group ID</i18n:text></th>
- <th><i18n:text>Name</i18n:text></th>
- <th><i18n:text>Actions</i18n:text></th>
- </tr>
- <jx:forEach var="group" items="${usecase.getParameter('groups')}">
- <tr>
- <td style="vertical-align: middle">
- <a href="${request.pathInfo}?lenya.usecase=admin.group&groupId=${group.getId()}"><jx:out value="${group.getId()}"/></a>
- </td>
- <td style="vertical-align: middle">
- <jx:if test="${group.getName().equals('')}"><span style="color: #999999">--</span></jx:if>
- <jx:out value="${group.getName()}"/>
- </td>
- <td style="vertical-align: middle">
- <form method="GET" id="form-delete_group">
- <input type="hidden" name="lenya.usecase" value="admin.deleteGroup"/>
- <input name="groupId" type="hidden" value="${group.getId()}"/>
- <input i18n:attr="value" type="submit" value="Delete" name="input-delete_group"/>
- </form>
- </td>
- </tr>
- </jx:forEach>
- </table>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/ipRange.jx b/trunk/src/modules-core/administration/usecases/ipRange.jx
deleted file mode 100644
index 198502e..0000000
--- a/trunk/src/modules-core/administration/usecases/ipRange.jx
+++ /dev/null
@@ -1,113 +0,0 @@
-<?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.
--->
-<!-- $Id: user.jx 164231 2005-04-22 12:56:59Z jwkaltz $ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>IP Range Profile</i18n:text></h1>
-
- <jx:set var="ipRange" value="${usecase.getParameter('ipRange')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>IP Range ID</i18n:text>:</td>
- <td><jx:out value="${usecase.getParameter('ipRangeId')}"/></td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Name</i18n:text>:</td>
- <td><jx:out value="${ipRange.getName()}"/></td>
- </tr>
- <tr>
- <td valign="top" class="lenya-entry-caption"><i18n:text>Description</i18n:text>:</td>
- <td>
- <jx:out value="${ipRange.getDescription()}"/>
- </td>
- </tr>
- <tr>
- <td valign="top" class="lenya-entry-caption"><i18n:text>Network Address</i18n:text>:</td>
- <td>
- <jx:out value="${ipRange.getNetworkAddress().getHostAddress()}"/>
- </td>
- </tr>
- <tr>
- <td valign="top" class="lenya-entry-caption"><i18n:text>Subnet Mask</i18n:text>:</td>
- <td>
- <jx:out value="${ipRange.getSubnetMask().getHostAddress()}"/>
- </td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <form id="form-iprange_edit_profile">
- <input type="hidden" name="lenya.usecase" value="admin.ipRangeProfile"/>
- <input type="hidden" name="ipRangeId" value="${ipRange.getId()}"/>
- <input i18n:attr="value" type="submit" value="Edit Profile" name="input-iprange_edit_profile"/>
- </form>
- </td>
- </tr>
-
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Groups</i18n:text>:</td>
- <td>
- <jx:set var="groups" value="${ipRange.getGroups()}"/>
- <jx:if test="${groups.size() == 0}"><i18n:text>No groups assigned</i18n:text></jx:if>
- <jx:forEach var="group" items="${groups}">
- <a href="${usecase.getSourceURL()}?lenya.usecase=admin.group&groupId=${group.getId()}"><jx:out value="${group.getId()}"/></a>
- </jx:forEach>
- </td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <form id="form-iprange_edit_group_affiliation">
- <input type="hidden" name="lenya.usecase" value="admin.ipRangeGroups"/>
- <input type="hidden" name="ipRangeId" value="${ipRange.getId()}"/>
- <input i18n:attr="value" type="submit" value="Edit Group Affiliation" name="input-iprange_edit_group_affiliation"/>
- </form>
- </td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <form id="form-iprange_cancel">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/administration/usecases/ipRangeGroups.jx b/trunk/src/modules-core/administration/usecases/ipRangeGroups.jx
deleted file mode 100644
index b994e18..0000000
--- a/trunk/src/modules-core/administration/usecases/ipRangeGroups.jx
+++ /dev/null
@@ -1,90 +0,0 @@
-<?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.
--->
-<!-- $Id: userGroups.jx 164233 2005-04-22 13:01:45Z jwkaltz $ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Group Affiliation</i18n:text></h1>
- <form method="post" id="form-group_affiliation">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- </table>
-
- <table class="lenya-table-noborder-nopadding">
- <tr>
- <td>
- <strong>
- <i18n:text>IP Range Groups</i18n:text>
- </strong>
- </td>
- <td/>
- <td>
- <strong>
- <i18n:text>All Groups</i18n:text>
- </strong>
- </td>
- </tr>
- <tr>
- <td valign="middle">
- <select name="ipRangeGroup" size="15" class="lenya-form-element-narrow">
- <jx:forEach var="group" items="${usecase.getParameter('ipRangeGroups')}">
- <option value="${group}"><jx:out value="${group}"/></option>
- </jx:forEach>
- </select>
- </td>
- <td valign="middle">
- <input name="add" type="submit" value="<"/>
- <br/>
- <input name="remove" type="submit" value=">"/>
- </td>
- <td valign="middle">
- <select name="otherGroup" size="15" class="lenya-form-element-narrow">
- <jx:forEach var="otherGroup" items="${usecase.getParameter('otherGroups')}">
- <option value="${otherGroup}"><jx:out value="${otherGroup}"/></option>
- </jx:forEach>
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="3" style="text-align: center">
- <br/>
- <input i18n:attr="value" type="submit" name="submit" value="Save"/>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
-
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/ipRangeProfile.jx b/trunk/src/modules-core/administration/usecases/ipRangeProfile.jx
deleted file mode 100644
index c82e25b..0000000
--- a/trunk/src/modules-core/administration/usecases/ipRangeProfile.jx
+++ /dev/null
@@ -1,107 +0,0 @@
-<?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.
--->
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
-
- <h1><i18n:text>IP Range Profile</i18n:text></h1>
-
- <form id="form-iprange_profile">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>IP Range ID</i18n:text>:</td>
- <td><jx:out value="${usecase.getParameter('ipRangeId')}"/></td>
- </tr>
-
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Name</i18n:text>:</td>
- <td><input type="text" name="name" class="lenya-form-entry" value="${usecase.getParameter('name')}"/></td>
- </tr>
- <tr>
- <td valign="top" class="lenya-entry-caption"><i18n:text>Description</i18n:text>:</td>
- <td>
- <textarea name="description" class="lenya-form-entry"><jx:out value="${usecase.getParameter('description')}"/></textarea>
- </td>
- </tr>
-
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Network Address</i18n:text>:</td>
- <td>
- <jx:forEach var="part" items="${usecase.getParameter('partNumbers')}">
- <jx:choose>
- <jx:when test="${usecase.getParameter('networkAddress-' + part).isValid()}">
- <input type="text" name="networkAddress-${part}" size="3" maxlength="3"
- value="${usecase.getParameter('networkAddress-' + part).getValue()}"
- style="text-align: right"/>
- </jx:when>
- <jx:otherwise>
- <input type="text" name="networkAddress-${part}" size="3" maxlength="3"
- value="${usecase.getParameter('networkAddress-' + part).getValue()}"
- style="background-color: #FF9999; text-align: right;"/>
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Subnet Mask</i18n:text>:</td>
- <td>
- <jx:forEach var="part" items="${usecase.getParameter('partNumbers')}">
- <jx:choose>
- <jx:when test="${usecase.getParameter('subnetMask-' + part).isValid()}">
- <input type="text" name="subnetMask-${part}" size="3" maxlength="3"
- value="${usecase.getParameter('subnetMask-' + part).getValue()}"
- style="text-align: right"/>
- </jx:when>
- <jx:otherwise>
- <input type="text" name="subnetMask-${part}" size="3" maxlength="3"
- value="${usecase.getParameter('subnetMask-' + part).getValue()}"
- style="background-color: #FF9999; text-align: right;"/>
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Save"/>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/ipRanges.jx b/trunk/src/modules-core/administration/usecases/ipRanges.jx
deleted file mode 100644
index 09e83fa..0000000
--- a/trunk/src/modules-core/administration/usecases/ipRanges.jx
+++ /dev/null
@@ -1,82 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
-
- <h1><i18n:text>IP Ranges</i18n:text></h1>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- </table>
-
- <div style="margin-bottom: 10px">
- <form method="GET" id="form-add_iprange">
- <input type="hidden" name="lenya.usecase" value="admin.addIPRange"/>
- <input i18n:attr="value" type="submit" value="Add IP Range" name="input-add_iprange"/>
- </form>
- </div>
-
- <table cellspacing="0" class="lenya-table-list-noborder">
- <tr>
- <th><i18n:text>IP Range ID</i18n:text></th>
- <th><i18n:text>Name</i18n:text></th>
- <th><i18n:text>Groups</i18n:text></th>
- <th><i18n:text>Actions</i18n:text></th>
- </tr>
- <jx:forEach var="ipRange" items="${usecase.getParameter('ipRanges')}">
- <tr>
- <td style="vertical-align: middle">
- <a href="${usecase.getSourceURL()}?lenya.usecase=admin.ipRange&ipRangeId=${ipRange.getId()}"><jx:out value="${ipRange.getId()}"/></a>
- </td>
- <td style="vertical-align: middle">
- <jx:out value="${ipRange.getName()}"/>
- </td>
- <td style="vertical-align: middle">
- <jx:if test="${ipRange.getGroups().size() == 0}"><span style="color: #999999">--</span></jx:if>
- <jx:forEach var="group" items="${ipRange.getGroups()}">
- <a href="${usecase.getSourceURL()}?lenya.usecase=admin.groupProfile&groupId=${group.getId()}"><jx:out value="${group.getId()}"/></a>
- </jx:forEach>
- </td>
- <td style="vertical-align: middle">
- <form method="GET" id="form-delete_iprange">
- <input type="hidden" name="lenya.usecase" value="admin.deleteIPRange"/>
- <input name="ipRangeId" type="hidden" value="${ipRange.getId()}"/>
- <input i18n:attr="value" type="submit" value="Delete" name="input-delete_iprange"/>
- </form>
- </td>
- </tr>
- </jx:forEach>
- </table>
-
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/passwordForm.jx b/trunk/src/modules-core/administration/usecases/passwordForm.jx
deleted file mode 100644
index 76b3859..0000000
--- a/trunk/src/modules-core/administration/usecases/passwordForm.jx
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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.
--->
-
-<jx:template
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns="http://www.w3.org/1999/xhtml"
- name="">
-
- <form id="form-change_password">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <jx:set var="currentUserId" value="${usecase.getParameter('private.session').getIdentity().getUser().getId()}"/>
- <jx:set var="userId" value="${usecase.getParameter('userId', currentUserId)}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Username</i18n:text></td>
- <td><jx:out value="${userId}"/></td>
- </tr>
- <jx:if test="${usecase.getView().getParameter('checkPassword').equals('true')}">
- <tr>
- <td class="lenya-entry-caption"><label for="oldPassword"><i18n:text>Old Password</i18n:text> *</label></td>
- <td><input type="password" name="oldPassword" class="lenya-form-element" value="${usecase.getParameter('oldPassword')}"/></td>
- </tr>
- </jx:if>
- <tr>
- <td class="lenya-entry-caption"><label for="newPassword"><i18n:text>New Password</i18n:text> *</label></td>
- <td><input type="password" name="newPassword" class="lenya-form-element" value="${usecase.getParameter('newPassword')}"/></td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="confirmPassword"><i18n:text>Confirm Password</i18n:text> *</label></td>
- <td><input type="password" name="confirmPassword" class="lenya-form-element" value="${usecase.getParameter('confirmPassword')}"/></td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Save"/>
- <a href="?lenya.usecase=admin.user&userId=${userId}">
- <input type="button" name="cancel" value="Cancel" i18n:attr="value"/>
- </a>
- </td>
- </tr>
- </table>
- </form>
-</jx:template>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/serverStatus.jx b/trunk/src/modules-core/administration/usecases/serverStatus.jx
deleted file mode 100644
index 2308f2d..0000000
--- a/trunk/src/modules-core/administration/usecases/serverStatus.jx
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns:cinclude="http://apache.org/cocoon/include/1.0"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
-
- <h1><i18n:text>Server Status</i18n:text></h1>
-
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
-
- <cinclude:includexml>
- <cinclude:src>cocoon://modules/administration/status.xml</cinclude:src>
- </cinclude:includexml>
-
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/sessions.jx b/trunk/src/modules-core/administration/usecases/sessions.jx
deleted file mode 100644
index 000cdb5..0000000
--- a/trunk/src/modules-core/administration/usecases/sessions.jx
+++ /dev/null
@@ -1,64 +0,0 @@
-<?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.
--->
-<!-- $Id: -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
-
- <h1><i18n:text>Sessions</i18n:text></h1>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- </table>
-
- <table cellspacing="0" class="lenya-table-list-noborder">
- <tr>
- <th><i18n:text>User ID</i18n:text></th>
- <th><i18n:text>Full Name</i18n:text></th>
- <th><i18n:text>e-mail</i18n:text></th>
- </tr>
- <jx:forEach var="user" items="${usecase.getParameter('users')}">
- <tr>
- <td style="vertical-align: middle">
- <a href="${usecase.getSourceURL()}?lenya.usecase=admin.user&userId=${user.getId()}"><jx:out value="${user.getId()}"/></a>
- </td>
- <td style="vertical-align: middle">
- <jx:out value="${user.getName()}"/>
- </td>
- <td style="vertical-align: middle">
- <jx:out value="${user.getEmail()}"/>
- </td>
- </tr>
- </jx:forEach>
- </table>
-
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/administration/usecases/siteOverview.jx b/trunk/src/modules-core/administration/usecases/siteOverview.jx
deleted file mode 100644
index 3cafa48..0000000
--- a/trunk/src/modules-core/administration/usecases/siteOverview.jx
+++ /dev/null
@@ -1,113 +0,0 @@
-<?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.
--->
-<!-- $Id: emptyTrash.jx 164233 2005-04-22 13:01:45Z jwkaltz $ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Overview</i18n:text></h1>
-
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- <form id="form-overview">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <div class="lenya-box">
- <div class="lenya-box-title"><i18n:text>Filter</i18n:text></div>
- <div class="lenya-box-body">
- <table class="lenya-table-noborder">
- <jx:forEach var="filter" items="${usecase.getParameter('filters')}">
- <tr>
- <td class="lenya-entry-caption"><i18n:text><jx:out value="${filter}"/></i18n:text></td>
- <td>
- <select class="lenya-form-element" name="${filter}">
- <jx:forEach var="value" items="${usecase.getParameter(filter + 'Values')}">
- <jx:set var="selectedValue" value="${usecase.getParameter(filter)}"/>
- <jx:choose>
- <jx:when test="${value.equals(selectedValue)}">
- <option value="${value}" selected="selected"><i18n:text><jx:out value="${value}"/></i18n:text></option>
- </jx:when>
- <jx:otherwise>
- <option value="${value}"><i18n:text><jx:out value="${value}"/></i18n:text></option>
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </select>
- </td>
- </tr>
- </jx:forEach>
- <tr>
- <td></td>
- <td><input i18n:attr="value" type="submit" value="Update" name="input-submit"/></td>
- </tr>
- </table>
- </div>
- </div>
-
- <table class="lenya-table-list-noborder">
-
- <tr>
- <jx:forEach var="key" items="${usecase.getParameter('keys')}">
- <th style="white-space: nowrap"> <i18n:text><jx:out value="${key}"/></i18n:text>
- <a class="sortArrow" href="${request.pathInfo}?order=asc&sort=${key}&lenya.usecase=${usecase.getName()}&lenya.continuation=${continuation.id}">
- ▼
- </a>
- <a class="sortArrow" href="${request.pathInfo}?order=desc&sort=${key}&lenya.usecase=${usecase.getName()}&lenya.continuation=${continuation.id}">
- ▲
- </a>
- </th>
- </jx:forEach>
- </tr>
-
- <jx:forEach var="entry" items="${usecase.getParameter('documents')}">
- <tr>
- <jx:forEach var="key" items="${usecase.getParameter('keys')}">
- <td style="white-space: nowrap">
- <jx:choose>
- <jx:when test="${key.equals('keyPath')}">
- <a href="${entry.getValue('keyUrl')}">
- <i18n:text><jx:out value="${entry.getValue(key)}"/></i18n:text>
- </a>
- </jx:when>
- <jx:when test="${key.equals('keyCheckedOut') && !entry.getValue(key).equals('')}">
- <a href="${usecase.getSourceURL()}?lenya.usecase=admin.user&userId=${entry.getValue(key)}">
- <i18n:text><jx:out value="${entry.getValue(key)}"/></i18n:text>
- </a>
- </jx:when>
- <jx:otherwise>
- <i18n:text><jx:out value="${entry.getValue(key)}"/></i18n:text>
- </jx:otherwise>
- </jx:choose>
- </td>
- </jx:forEach>
- </tr>
- </jx:forEach>
-
- </table>
-
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/usecases.jx b/trunk/src/modules-core/administration/usecases/usecases.jx
deleted file mode 100644
index df7a4a5..0000000
--- a/trunk/src/modules-core/administration/usecases/usecases.jx
+++ /dev/null
@@ -1,92 +0,0 @@
-<?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.
--->
-<!-- $Id: user.jx 473861 2006-11-12 03:51:14Z gregor $ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Usecases</i18n:text></h1>
-
- <form method="post" id="form-usecases">
- <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <p><i18n:text>usecase-policies-message</i18n:text></p>
- <jx:if test="${usecase.getParameter('templates').size() > 0}">
- <p><strong>Note:</strong><br/>
- If you submit this form, all usecase permissions
- are stored for the publication "<jx:out value="${usecase.getParameter('publicationId')}"/>".
- If you want to change the inherited usecase permissions of a template publication, please go
- to the administration GUI of one of the templates
- (<jx:forEach var="template" items="${usecase.getParameter('templates')}">
- <a href="${'/' + template + '/authoring/index.html?lenya.usecase=admin.usecases'}"><jx:out value="${template}"/></a>
- </jx:forEach>).
- </p>
- </jx:if>
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- <table class="lenya-table-list-noborder">
- <jx:set var="i" value="0"/>
- <jx:forEach var="usecaseName" items="${usecase.getParameter('usecases')}">
- <jx:if test="${i % 10 == 0}">
- <tr>
- <td colspan="${1 + usecase.getParameter('roles').size()}" style="border-left: 0; border-right: 0;">
- <p>
- <input type="submit" name="submit" value="Submit" i18n:attr="value"/>
- </p>
- </td>
- </tr>
- <tr>
- <th><i18n:text>Usecase</i18n:text></th>
- <jx:forEach var="role" items="${usecase.getParameter('roles')}">
- <th><i18n:text><jx:out value="${role}"/></i18n:text></th>
- </jx:forEach>
- </tr>
- </jx:if>
- <jx:set var="i" value="${i + 1}"/>
- <tr>
- <td><jx:out value="${usecaseName}"/></td>
- <jx:forEach var="role" items="${usecase.getParameter('roles')}">
- <td>
- <jx:set var="name" value="${usecaseName + ':' + role}"/>
- <jx:set var="value" value="${usecase.getParameter(name)}"/>
- <jx:choose>
- <jx:when test="${value == java.lang.Boolean.TRUE}">
- <input name="${name}" type="checkbox" checked="checked"/>
- </jx:when>
- <jx:otherwise>
- <input name="${name}" type="checkbox"/>
- </jx:otherwise>
- </jx:choose>
- </td>
- </jx:forEach>
- </tr>
- </jx:forEach>
- </table>
- <p style="width: 50%">
- <input type="submit" name="submit" value="Submit" i18n:attr="value"/>
- </p>
- </form>
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/administration/usecases/user.jx b/trunk/src/modules-core/administration/usecases/user.jx
deleted file mode 100644
index 49a7d6f..0000000
--- a/trunk/src/modules-core/administration/usecases/user.jx
+++ /dev/null
@@ -1,155 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>User Profile</i18n:text></h1>
-
- <jx:choose>
- <jx:when test="${usecase.getParameter('user')}">
- <jx:set var="user" value="${usecase.getParameter('user')}"/>
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>User ID</i18n:text>:</td>
- <td><jx:out value="${usecase.getParameter('userId')}"/></td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Name</i18n:text>:</td>
- <td><jx:out value="${user.getName()}"/></td>
- </tr>
- <jx:if test="${user.getLdapId()}">
- <tr>
- <td class="lenya-entry-caption"><i18n:text>LDAP ID</i18n:text>:</td>
- <td><jx:out value="${user.getLdapId()}"/></td>
- </tr>
- </jx:if>
- <tr>
- <td valign="top" class="lenya-entry-caption"><i18n:text>Description</i18n:text>:</td>
- <td>
- <jx:out value="${user.getDescription()}"/>
- </td>
- </tr>
-
- <tr>
- <td class="lenya-entry-caption"><i18n:text>E-Mail</i18n:text>:</td>
- <td><jx:out value="${user.getEmail()}"/></td>
- </tr>
-
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Default Menu Locale</i18n:text>:</td>
- <td><jx:out value="${user.getDefaultMenuLocale()}"/></td>
- </tr>
-
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Default Document Locale</i18n:text>:</td>
- <td><jx:out value="${user.getDefaultDocumentLocale()}"/></td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <form id="form-edit_user_profile">
- <input type="hidden" name="lenya.usecase" value="admin.userProfile"/>
- <input type="hidden" name="userId" value="${user.getId()}"/>
- <input i18n:attr="value" type="submit" value="Edit Profile" name="input-edit_user_profile"/>
- </form>
- </td>
- </tr>
-
- <jx:if test="${user.canChangePassword() == 'true'}">
- <tr>
- <td/>
- <td>
- <form id="form-change_user_password">
- <input type="hidden" name="lenya.usecase" value="admin.changePasswordAdmin"/>
- <input type="hidden" name="userId" value="${user.getId()}"/>
- <input i18n:attr="value" type="submit" value="Change Password" name="input-change_user_password"/>
- </form>
- </td>
- </tr>
- </jx:if>
-
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Groups</i18n:text>:</td>
- <td>
- <jx:set var="groups" value="${user.getGroups()}"/>
- <jx:set var="groupIds" value="${java.util.TreeSet()}"/>
- <jx:forEach var="group" items="${groups}">
- <jx:set var="ignore" value="${groupIds.add(group.getId())}"/>
- </jx:forEach>
- <jx:choose>
- <jx:when test="${groupIds.size() == 0}">
- <i18n:text>No groups assigned</i18n:text>
- </jx:when>
- <jx:otherwise>
- <jx:forEach var="group" items="${groupIds}"><jx:if test="${group != groupIds.first()}">, </jx:if>
- <a href="${request.pathInfo}?lenya.usecase=admin.group&groupId=${group}"><jx:out value="${group}"/></a></jx:forEach>
- </jx:otherwise>
- </jx:choose>
- </td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <form id="form-edit_group_affiliation">
- <input type="hidden" name="lenya.usecase" value="admin.userGroups"/>
- <input type="hidden" name="userId" value="${user.getId()}"/>
- <input i18n:attr="value" type="submit" value="Edit Group Affiliation" name="input-edit_group_affiliation"/>
- </form>
- </td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <form id="form-user_profile_cancel">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </form>
- </td>
- </tr>
- </table>
- </jx:when>
- <jx:otherwise>
- <p>
- The parameter 'user' is missing. Please go back to the
- <a href="?lenya.usecase=admin.users">users overview page</a>
- and click on a user link.
- </p>
- </jx:otherwise>
- </jx:choose>
-
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/administration/usecases/userGroups.jx b/trunk/src/modules-core/administration/usecases/userGroups.jx
deleted file mode 100644
index c41c863..0000000
--- a/trunk/src/modules-core/administration/usecases/userGroups.jx
+++ /dev/null
@@ -1,90 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Group Affiliation</i18n:text></h1>
- <form method="post" id="form-user_group_affiliation">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- </table>
-
- <table class="lenya-table-noborder-nopadding">
- <tr>
- <td>
- <strong>
- <i18n:text>User Groups</i18n:text>
- </strong>
- </td>
- <td/>
- <td>
- <strong>
- <i18n:text>All Groups</i18n:text>
- </strong>
- </td>
- </tr>
- <tr>
- <td valign="middle">
- <select name="userGroup" size="15" class="lenya-form-element-narrow">
- <jx:forEach var="group" items="${usecase.getParameter('userGroups')}">
- <option value="${group}"><jx:out value="${group}"/></option>
- </jx:forEach>
- </select>
- </td>
- <td valign="middle">
- <input name="add" type="submit" value="<"/>
- <br/>
- <input name="remove" type="submit" value=">"/>
- </td>
- <td valign="middle">
- <select name="otherGroup" size="15" class="lenya-form-element-narrow">
- <jx:forEach var="otherGroup" items="${usecase.getParameter('otherGroups')}">
- <option value="${otherGroup}"><jx:out value="${otherGroup}"/></option>
- </jx:forEach>
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="3" style="text-align: center">
- <br/>
- <input i18n:attr="value" type="submit" name="submit" value="Save"/>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
-
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/administration/usecases/userProfile.jx b/trunk/src/modules-core/administration/usecases/userProfile.jx
deleted file mode 100644
index a1c7eca..0000000
--- a/trunk/src/modules-core/administration/usecases/userProfile.jx
+++ /dev/null
@@ -1,85 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
- <h1><i18n:text>Edit User Profile</i18n:text></h1>
-
- <form id="form-edit_user_profile">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>User ID</i18n:text>:</td>
- <td><jx:out value="${usecase.getParameter('userId')}"/></td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="name"><i18n:text>Name</i18n:text></label>:</td>
- <td><input type="text" name="fullName" class="lenya-form-element" value="${usecase.getParameter('fullName')}"/></td>
- </tr>
- <tr>
- <td valign="top" class="lenya-entry-caption"><label for="description"><i18n:text>Description</i18n:text>:</label></td>
- <td>
- <!-- N.B.: do not put spaces or carriage returns inside the
- textarea element - these would be rendered -->
- <textarea name="description" class="lenya-form-element"><jx:out value="${usecase.getParameter('description')}"/></textarea>
- </td>
- </tr>
-
- <tr>
- <td class="lenya-entry-caption"><label for="email"><i18n:text>E-Mail</i18n:text> *</label>:</td>
- <td><input type="text" name="email" class="lenya-form-element" value="${usecase.getParameter('email')}"/></td>
- </tr>
-
- <tr>
- <td class="lenya-entry-caption"><label for="defaultMenuLocale"><i18n:text>Default Menu Locale</i18n:text>:</label></td>
- <td><input type="text" name="defaultMenuLocale" class="lenya-form-element" value="${usecase.getParameter('defaultMenuLocale')}"/></td>
- </tr>
-
- <tr>
- <td class="lenya-entry-caption"><label for="defaultDocumentLocale"><i18n:text>Default Document Locale</i18n:text>:</label></td>
- <td><input type="text" name="defaultDocumentLocale" class="lenya-form-element" value="${usecase.getParameter('defaultDocumentLocale')}"/></td>
- </tr>
-
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Save"/>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/administration/usecases/users.jx b/trunk/src/modules-core/administration/usecases/users.jx
deleted file mode 100644
index bb239b6..0000000
--- a/trunk/src/modules-core/administration/usecases/users.jx
+++ /dev/null
@@ -1,103 +0,0 @@
-<?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.
--->
-<page:page
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- >
-
- <page:body>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab">
-
- <h1><i18n:text>Users</i18n:text></h1>
-
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- </table>
-
- <div style="margin-bottom: 10px;">
- <table class="lenya-table-noborder">
- <tr>
- <td style="padding: 0; margin: 0 10px 0 0;">
- <i18n:text>Add User</i18n:text>: 
- </td>
- <jx:forEach var="type" items="${usecase.getParameter('userTypes')}">
- <td style="padding: 0; margin: 0 10px 0 0;">
- <form method="GET" id="form-add_user">
- <input type="hidden" name="lenya.usecase" value="${type.getCreateUseCase()}"/>
- <input type="hidden" name="className" value="${type.getClassName()}"/>
- <input type="hidden" name="userType" value="${type.getKey()}"/>
- <input i18n:attr="value" type="submit" value="${type.getKey()}" name="input-add_user"/>
- </form>
- </td>
- </jx:forEach>
- </tr>
- </table>
- </div>
-
- <table cellspacing="0" class="lenya-table-list-noborder">
- <tr>
- <th><i18n:text>User ID</i18n:text></th>
- <th><i18n:text>Full Name</i18n:text></th>
- <th><i18n:text>Groups</i18n:text></th>
- <th><i18n:text>Actions</i18n:text></th>
- </tr>
- <jx:forEach var="user" items="${usecase.getParameter('users')}">
- <tr>
- <td style="vertical-align: middle">
- <a href="${usecase.getSourceURL()}?lenya.usecase=admin.user&userId=${user.getId()}"><jx:out value="${user.getId()}"/></a>
- </td>
- <td style="vertical-align: middle">
- <jx:out value="${user.getName()}"/>
- </td>
- <td>
- <jx:set var="groups" value="${user.getGroups()}"/>
- <jx:set var="groupIds" value="${java.util.TreeSet()}"/>
- <jx:forEach var="group" items="${groups}">
- <jx:set var="ignore" value="${groupIds.add(group.getId())}"/>
- </jx:forEach>
- <jx:forEach var="group" items="${groupIds}"><jx:if test="${group != groupIds.first()}">, </jx:if>
- <a href="${usecase.getSourceURL()}?lenya.usecase=admin.group&groupId=${group}"><jx:out value="${group}"/></a></jx:forEach>
- </td>
- <td style="vertical-align: middle">
- <form method="GET" id="form-delete_user">
- <input type="hidden" name="lenya.usecase" value="admin.deleteUser"/>
- <input name="userId" type="hidden" value="${user.getId()}"/>
- <jx:choose>
- <jx:when test="${user.equals(usecase.getParameter('currentUser'))}">
- <input i18n:attr="value" type="submit" value="Delete" disabled="disabled" name="input-delete_user"/>
- </jx:when>
- <jx:otherwise>
- <input i18n:attr="value" type="submit" value="Delete" name="input-delete_user"/>
- </jx:otherwise>
- </jx:choose>
- </form>
- </td>
- </tr>
- </jx:forEach>
- </table>
-
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/cache/config/cocoon-xconf/source-cache.xconf b/trunk/src/modules-core/cache/config/cocoon-xconf/source-cache.xconf
deleted file mode 100644
index effa205..0000000
--- a/trunk/src/modules-core/cache/config/cocoon-xconf/source-cache.xconf
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.ac.cache.SourceCache']">
- <component logger="lenya.ac.cache"
- class="org.apache.lenya.ac.cache.SourceCacheImpl"
- role="org.apache.lenya.ac.cache.SourceCache"/>
- </xconf>
diff --git a/trunk/src/modules-core/cache/config/module.xml b/trunk/src/modules-core/cache/config/module.xml
deleted file mode 100644
index 763b6a2..0000000
--- a/trunk/src/modules-core/cache/config/module.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.cache</id>
- <export package="org.apache.lenya.ac.cache"/>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>Source cache</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>Source cache</description>
-</module>
diff --git a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/BuildException.java b/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/BuildException.java
deleted file mode 100644
index 80413ac..0000000
--- a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/BuildException.java
+++ /dev/null
@@ -1,65 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.ac.cache;
-
-/**
- * Exception for problems when cacheable objects are built.
- */
-public class BuildException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Ctor.
- */
- public BuildException() {
- super();
- }
-
- /**
- * Ctor.
- * @param message The message.
- */
- public BuildException(String message) {
- super(message);
- }
-
- /**
- * Ctor.
- * @param message The message.
- * @param cause The cause.
- */
- public BuildException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Ctor.
- * @param cause The cause.
- */
- public BuildException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/CachedObject.java b/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/CachedObject.java
deleted file mode 100644
index 8dc28d4..0000000
--- a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/CachedObject.java
+++ /dev/null
@@ -1,58 +0,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.
- *
- */
-
-package org.apache.lenya.ac.cache;
-
-import org.apache.excalibur.source.SourceValidity;
-
-/**
- * Cached object.
- * @version $Id$
- */
-public class CachedObject {
-
- private SourceValidity validityObject;
- private Object value;
-
- /**
- * Returns the value.
- * @return An object.
- */
- public Object getValue() {
- return this.value;
- }
-
- /**
- * Returns the source validity.
- * @return A source validity.
- */
- public SourceValidity getValidityObject() {
- return this.validityObject;
- }
-
- /**
- * Ctor.
- * @param validity The source validity.
- * @param _value The value.
- */
- public CachedObject(SourceValidity validity, Object _value) {
- this.validityObject = validity;
- this.value = _value;
- }
-
-}
diff --git a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/CachingException.java b/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/CachingException.java
deleted file mode 100644
index 4857287..0000000
--- a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/CachingException.java
+++ /dev/null
@@ -1,64 +0,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.
- *
- */
-
-package org.apache.lenya.ac.cache;
-
-/**
- * Caching exception.
- * @version $Id$
- */
-public class CachingException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Ctor.
- */
- public CachingException() {
- super();
- }
-
- /**
- * Ctor.
- * @param message The message.
- */
- public CachingException(String message) {
- super(message);
- }
-
- /**
- * Ctor.
- * @param message The message.
- * @param cause The cause.
- */
- public CachingException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Ctor.
- * @param cause The cause.
- */
- public CachingException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/InputStreamBuilder.java b/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/InputStreamBuilder.java
deleted file mode 100644
index 30cffc5..0000000
--- a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/InputStreamBuilder.java
+++ /dev/null
@@ -1,37 +0,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.
- *
- */
-
-package org.apache.lenya.ac.cache;
-
-import java.io.InputStream;
-
-/**
- * Interface for objects capable of building objects from input streams.
- * @version $Id$
- */
-public interface InputStreamBuilder {
-
- /**
- * Builds an object from an input stream.
- * @param stream An input stream.
- * @return An object.
- * @throws BuildException when building the object failed.
- */
- Object build(InputStream stream) throws BuildException;
-
-}
diff --git a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCache.java b/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCache.java
deleted file mode 100644
index d465f49..0000000
--- a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCache.java
+++ /dev/null
@@ -1,44 +0,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.
- *
- */
-
-package org.apache.lenya.ac.cache;
-
-import org.apache.avalon.framework.component.Component;
-
-/**
- * Source cache component.
- * @version $Id$
- */
-public interface SourceCache extends Component {
-
- /**
- * Avalon role of the SourceCache interface.
- */
- String ROLE = SourceCache.class.getName();
-
- /**
- * Returns a cached object or builds a new object when the cached
- * object does not exist or is not up to date.
- * @param sourceUri The URI to build the source from.
- * @param builder The builder to create a new object if needed.
- * @return An object.
- * @throws CachingException when something went wrong.
- */
- Object get(String sourceUri, InputStreamBuilder builder) throws CachingException;
-
-}
diff --git a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCacheImpl.java b/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCacheImpl.java
deleted file mode 100644
index eb2c316..0000000
--- a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCacheImpl.java
+++ /dev/null
@@ -1,256 +0,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.
- *
- */
-
-package org.apache.lenya.ac.cache;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.SourceValidity;
-import org.apache.lenya.util.CacheMap;
-
-/**
- * Basic implementation of a source cache.
- * @version $Id$
- */
-public class SourceCacheImpl
- extends AbstractLogEnabled
- implements SourceCache, Serviceable, Disposable, ThreadSafe {
-
- /**
- * Returns the service manager.
- * @return A service manager.
- */
- public ServiceManager getManager() {
- return this.manager;
- }
-
- /**
- * Returns the source resolver.
- * @return A source resolver.
- */
- public SourceResolver getResolver() {
- return this.resolver;
- }
-
- /**
- * Ctor.
- */
- public SourceCacheImpl() {
- }
-
- protected static final int CAPACITY = 1000;
- private CacheMap cache;
-
- /**
- * Returns the cache.
- * @return A cache object.
- */
- protected CacheMap getCache() {
- if (this.cache == null) {
- this.cache = new CacheMap(CAPACITY, getLogger());
- }
- return this.cache;
- }
-
- /**
- * @see org.apache.lenya.ac.cache.SourceCache#get(java.lang.String, org.apache.lenya.ac.cache.InputStreamBuilder)
- */
- public synchronized Object get(String sourceUri, InputStreamBuilder builder) throws CachingException {
-
- String key = sourceUri;
- Object value = null;
-
- CachedObject cachedObject = (CachedObject) getCache().get(key);
- boolean usedCache = false;
- SourceValidity sourceValidity = null;
-
- try {
- if (cachedObject != null) {
- if (getLogger().isDebugEnabled()){
- getLogger().debug("Found cached object [" + cachedObject + "]");
- }
- SourceValidity cachedValidity = cachedObject.getValidityObject();
-
- int result = cachedValidity.isValid();
- boolean valid = false;
- if (result == 0) {
-
- // get source validity and compare
-
- sourceValidity = getSourceValidity(sourceUri);
-
- if (sourceValidity != null) {
- result = cachedValidity.isValid(sourceValidity);
- if (result == 0) {
- sourceValidity = null;
- } else {
- valid = (result == 1);
- }
- }
- } else {
- valid = (result > 0);
- }
-
- if (valid) {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug(
- "Using valid cached source for '" + sourceUri + "'.");
- }
- usedCache = true;
- value = cachedObject.getValue();
- } else {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug(
- "Cached content is invalid for '" + sourceUri + "'.");
- }
- // remove invalid cached object
- getCache().remove(key);
- }
-
- } else {
- getLogger().debug("Did not find cached object.");
- }
-
- if (!usedCache) {
- getLogger().debug("Did not use cache.");
- if (key != null) {
- if (sourceValidity == null) {
- sourceValidity = getSourceValidity(sourceUri);
- }
- if (sourceValidity != null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Source validity is not null.");
- }
- } else {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Source validity is null - not caching.");
- }
- key = null;
- }
- }
-
- value = buildObject(sourceUri, builder);
-
- // store the response
- if (key != null) {
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug(
- "Caching object ["
- + value
- + "] for further requests of ["
- + sourceUri
- + "].");
- }
- getCache().put(key, new CachedObject(sourceValidity, value));
- }
- }
- } catch (final SourceNotFoundException e1) {
- throw new CachingException(e1);
- } catch (final MalformedURLException e1) {
- throw new CachingException(e1);
- } catch (final IOException e1) {
- throw new CachingException(e1);
- } catch (final BuildException e1) {
- throw new CachingException(e1);
- }
-
- return value;
- }
-
- /**
- * Returns the input stream to read a source from.
- * @param sourceUri The URI of the source.
- * @param builder The input stream builder that should be used.
- * @return An object.
- * @throws MalformedURLException when an error occurs.
- * @throws IOException when an error occurs.
- * @throws SourceNotFoundException when an error occurs.
- * @throws BuildException if an error occurs.
- */
- protected synchronized Object buildObject(String sourceUri, InputStreamBuilder builder)
- throws MalformedURLException, IOException, SourceNotFoundException, BuildException {
- Object value = null;
- Source source = null;
- try {
- source = getResolver().resolveURI(sourceUri);
- if (source.exists()) {
- InputStream stream = source.getInputStream();
- value = builder.build(stream);
- }
- } finally {
- if (source != null) {
- getResolver().release(source);
- }
- }
- return value;
- }
-
- /**
- * Returns the validity of a source.
- * @param sourceUri The URI of the source.
- * @return A source validity object.
- * @throws MalformedURLException when an error occurs.
- * @throws IOException when an error occurs.
- */
- protected synchronized SourceValidity getSourceValidity(String sourceUri)
- throws MalformedURLException, IOException {
- SourceValidity sourceValidity;
- Source source = null;
- try {
- source = getResolver().resolveURI(sourceUri);
- sourceValidity = source.getValidity();
- } finally {
- if (source != null) {
- getResolver().release(source);
- }
- }
- return sourceValidity;
- }
-
- private ServiceManager manager;
- private SourceResolver resolver;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager _manager) throws ServiceException {
- this.manager = _manager;
- this.resolver = (SourceResolver) _manager.lookup(SourceResolver.ROLE);
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- if (getResolver() != null) {
- getManager().release(getResolver());
- }
- }
-
-}
diff --git a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/URLKeyUtil.java b/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/URLKeyUtil.java
deleted file mode 100644
index bdaa2a5..0000000
--- a/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/URLKeyUtil.java
+++ /dev/null
@@ -1,64 +0,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.
- *
- */
-
-package org.apache.lenya.ac.cache;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-
-/**
- * Utility class to generate String cache keys from webapp URLs.
- * @version $Id$
- */
-public final class URLKeyUtil {
-
- /**
- * Ctor.
- */
- private URLKeyUtil() {
- // do nothing
- }
-
- /**
- * Generates a cache key for a context and a webapp URL.
- * @param resolver The resolver of the context.
- * @param webappUrl The webapp Url.
- * @return A String.
- * @throws MalformedURLException when something went wrong.
- * @throws IOException when something went wrong.
- */
- public static String generateKey(SourceResolver resolver, String webappUrl)
- throws MalformedURLException, IOException {
- Source source = null;
- String key;
- try {
- source = resolver.resolveURI("context:///");
- key = source.getURI() + "_" + webappUrl;
- }
- finally {
- if (source != null) {
- resolver.release(source);
- }
- }
- return key;
- }
-
-}
diff --git a/trunk/src/modules-core/janitor/config/cocoon-xconf/content-janitor.xconf b/trunk/src/modules-core/janitor/config/cocoon-xconf/content-janitor.xconf
deleted file mode 100644
index f763f13..0000000
--- a/trunk/src/modules-core/janitor/config/cocoon-xconf/content-janitor.xconf
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-
-<xconf xpath="/cocoon"
- unless="/cocoon/component[@role = 'org.apache.lenya.cms.janitor.ContentJanitor']">
-
- <component logger="content-janitor"
- role="org.apache.lenya.cms.janitor.ContentJanitor"
- class="org.apache.lenya.cms.janitor.ContentJanitor"/>
-
-</xconf>
diff --git a/trunk/src/modules-core/janitor/config/module.xml b/trunk/src/modules-core/janitor/config/module.xml
deleted file mode 100644
index f89d84f..0000000
--- a/trunk/src/modules-core/janitor/config/module.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.janitor</id>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>Janitor Module</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>The janitor cleans up empty directories etc.</description>
-</module>
diff --git a/trunk/src/modules-core/janitor/java/src/org/apache/lenya/cms/janitor/ContentJanitor.java b/trunk/src/modules-core/janitor/java/src/org/apache/lenya/cms/janitor/ContentJanitor.java
deleted file mode 100644
index 10ffac4..0000000
--- a/trunk/src/modules-core/janitor/java/src/org/apache/lenya/cms/janitor/ContentJanitor.java
+++ /dev/null
@@ -1,66 +0,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.
- *
- */
-package org.apache.lenya.cms.janitor;
-
-import java.io.File;
-
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
-import org.apache.lenya.cms.cocoon.source.SourceUtil;
-import org.apache.lenya.cms.observation.AbstractRepositoryListener;
-import org.apache.lenya.cms.observation.DocumentEvent;
-import org.apache.lenya.cms.observation.RepositoryEvent;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * The content janitor cleans up empty directories after a document is removed.
- */
-public class ContentJanitor extends AbstractRepositoryListener {
-
- public void eventFired(RepositoryEvent repoEvent) {
-
- if (!(repoEvent instanceof DocumentEvent)) {
- return;
- }
- DocumentEvent event = (DocumentEvent) repoEvent;
-
- if (!event.getDescriptor().equals(DocumentEvent.REMOVED)) {
- return;
- }
-
- ContextUtility util = null;
- try {
- util = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
- Request request = util.getRequest();
- DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
- Publication pub = factory.getPublication(event.getPublicationId());
- File contentFile = pub.getContentDirectory(event.getArea());
- String contentUri = contentFile.toURI().toString();
- SourceUtil.deleteEmptyCollections(contentUri, this.manager);
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (util != null) {
- this.manager.release(util);
- }
- }
- }
-
-}
diff --git a/trunk/src/modules-core/ldap/config/module.xml b/trunk/src/modules-core/ldap/config/module.xml
deleted file mode 100644
index c23c655..0000000
--- a/trunk/src/modules-core/ldap/config/module.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.ldap</id>
- <export package="org.apache.lenya.ac.ldap"/>
- <depends module="org.apache.lenya.modules.ac"/>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>LDAP</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>LDAP user implementation. Also see src/pubs/default/config/ac/passwd/ldap.properties.sample</description>
-</module>
diff --git a/trunk/src/modules-core/ldap/java/src/org/apache/lenya/ac/ldap/LDAPUser.java b/trunk/src/modules-core/ldap/java/src/org/apache/lenya/ac/ldap/LDAPUser.java
deleted file mode 100644
index b8c6daa..0000000
--- a/trunk/src/modules-core/ldap/java/src/org/apache/lenya/ac/ldap/LDAPUser.java
+++ /dev/null
@@ -1,579 +0,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.
- *
- */
-
-package org.apache.lenya.ac.ldap;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Hashtable;
-import java.util.Properties;
-
-import javax.naming.AuthenticationException;
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.naming.ldap.InitialLdapContext;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfiguration;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.ItemManager;
-import org.apache.lenya.ac.file.FileUser;
-
-import com.sun.jndi.ldap.LdapCtxFactory;
-import com.sun.jndi.ldap.LdapURL;
-
-/**
- * LDAP user.
- * @version $Id$
- */
-public class LDAPUser extends FileUser {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private Properties defaultProperties = null;
-
- /**
- * <code>LDAP_ID</code> The LDAP id
- */
- public static final String LDAP_ID = "ldapid";
- private static String LDAP_PROPERTIES_FILE = "ldap.properties";
- private static String PROVIDER_URL_PROP = "provider-url";
- private static String MGR_DN_PROP = "mgr-dn";
- private static String MGR_PW_PROP = "mgr-pw";
- private static String KEY_STORE_PROP = "key-store";
- private static String SECURITY_PROTOCOL_PROP = "security-protocol";
- private static String SECURITY_AUTHENTICATION_PROP = "security-authentication";
- private static String USR_ATTR_PROP = "usr-attr";
- private static String USR_ATTR_DEFAULT = "uid";
- private static String USR_NAME_ATTR_PROP = "usr-name-attr";
- private static String USR_NAME_ATTR_DEFAULT = "gecos";
- private static String USR_BRANCH_PROP = "usr-branch";
- private static String USR_BRANCH_DEFAULT = "ou=People";
- private static String USR_AUTH_TYPE_PROP = "usr-authentication";
- private static String USR_AUTH_TYPE_DEFAULT = "simple";
- private static String BASE_DN_PROP = "base-dn";
- private static String DOMAIN_NAME_PROP = "domain-name";
- private static String HANDLE_REFERRALS_PROP = "handle-referrals";
- private static String HANDLE_REFERRALS_DEFAULT = "ignore";
-
- private String ldapId;
- private String ldapName;
-
- // deprecated: for backwards compatibility only !
- private static String PARTIAL_USER_DN_PROP = "partial-user-dn";
-
- /**
- * Creates a new LDAPUser object.
- * @param itemManager The item manager.
- * @param logger The logger.
- */
- public LDAPUser(ItemManager itemManager, Logger logger) {
- super(itemManager, logger);
- }
-
- /**
- * Create an LDAPUser
- * @param itemManager The item manager.
- * @param logger The logger.
- * @param id user id of LDAPUser
- * @param email of LDAPUser
- * @param _ldapId of LDAPUser
- * @param _logger The logger.
- * @throws ConfigurationException if the properties could not be read
- */
- public LDAPUser(ItemManager itemManager, Logger logger, String id, String email,
- String _ldapId, Logger _logger) throws ConfigurationException {
- super(itemManager, logger, id, null, email, null);
- this.ldapId = _ldapId;
- initialize();
- }
-
- /**
- * Create a new LDAPUser from a configuration
- * @param config the <code>Configuration</code> specifying the user
- * details
- * @throws ConfigurationException if the user could not be instantiated
- */
- public void configure(Configuration config) throws ConfigurationException {
- super.configure(config);
- this.ldapId = config.getChild(LDAP_ID).getValue();
-
- initialize();
- }
-
- /**
- * Checks if a user exists.
- * @param _ldapId The LDAP id.
- * @return A boolean value indicating whether the user is found in the
- * directory
- * @throws AccessControlException when an error occurs.
- */
- public boolean existsUser(String _ldapId) throws AccessControlException {
-
- if (getLogger().isDebugEnabled())
- getLogger().debug("existsUser() checking id " + _ldapId);
-
- boolean exists = false;
-
- try {
- readProperties();
- SearchResult entry = getDirectoryEntry(_ldapId);
-
- exists = (entry != null);
- } catch (final IOException e) {
- if (getLogger().isDebugEnabled())
- getLogger().debug("existsUser() for id " + _ldapId + " got exception: " + e);
- throw new AccessControlException("Exception during search: ", e);
- } catch (final NamingException e) {
- if (getLogger().isDebugEnabled())
- getLogger().debug("existsUser() for id " + _ldapId + " got exception: " + e);
- throw new AccessControlException("Exception during search: ", e);
- }
-
- return exists;
- }
-
- /**
- * Initializes this user. The current (already authenticated) ldapId is
- * queried in the directory, in order to retrieve additional information,
- * such as the user name. In current implementation, only the user name is
- * actually retrieved, but other attributes may be used in the future (such
- * as groups ?) TODO: should the code be changed to not throw an exception
- * when something goes wrong ? After all, it's only used to get additional
- * info for display? This is a design decision, I'm not sure what's best.
- * @throws ConfigurationException when something went wrong.
- */
- protected void initialize() throws ConfigurationException {
-
- try {
- if (getLogger().isDebugEnabled())
- getLogger().debug("initialize() getting entry ...");
-
- SearchResult entry = getDirectoryEntry(this.ldapId);
- if (entry != null) {
- StringBuffer name = new StringBuffer();
- /* users full name */
- String usrNameAttr = defaultProperties.getProperty(USR_NAME_ATTR_PROP,
- USR_NAME_ATTR_DEFAULT);
-
- if (getLogger().isDebugEnabled())
- getLogger().debug(
- "initialize() got entry, going to look for attribute " + usrNameAttr
- + " in entry, which is: " + entry);
-
- Attributes attributes = entry.getAttributes();
- if (attributes != null) {
- Attribute userName = attributes.get(usrNameAttr);
- if (userName != null) name.append((String) userName.get());
- }
-
- this.ldapName = name.toString();
- if (getLogger().isDebugEnabled())
- getLogger().debug("initialize() set name to " + this.ldapName);
- } else {
- this.ldapName = "";
- }
- } catch (final NamingException e1) {
- throw new ConfigurationException("Could not read properties", e1);
- } catch (final IOException e1) {
- throw new ConfigurationException("Could not read properties", e1);
- }
- }
-
- /**
- * @see org.apache.lenya.ac.file.FileUser#createConfiguration()
- */
- protected Configuration createConfiguration() {
- DefaultConfiguration config = (DefaultConfiguration) super.createConfiguration();
-
- // add ldap_id node
- DefaultConfiguration child = new DefaultConfiguration(LDAP_ID);
- child.setValue(this.ldapId);
- config.addChild(child);
-
- return config;
- }
-
- /**
- * Get the ldap id
- * @return the ldap id
- */
- public String getLdapId() {
- return this.ldapId;
- }
-
- /**
- * Set the ldap id
- * @param string the new ldap id
- */
- public void setLdapId(String string) {
- this.ldapId = string;
- }
-
- /**
- * Authenticate a user against the directory. The principal to be
- * authenticated is either constructed by use of the configured properties,
- * or by lookup of this ID in the directory. This principal then attempts to
- * authenticate against the directory with the provided password.
- * @see org.apache.lenya.ac.User#authenticate(java.lang.String)
- */
- public boolean authenticate(String password) {
-
- boolean authenticated = false;
- String principal = "";
- Context ctx = null;
-
- try {
- principal = getPrincipal();
-
- if (getLogger().isDebugEnabled())
- getLogger().debug("Authenticating with principal [" + principal + "]");
-
- ctx = bind(principal, password, defaultProperties.getProperty(USR_AUTH_TYPE_PROP,
- USR_AUTH_TYPE_DEFAULT));
- authenticated = true;
- close(ctx);
- if (getLogger().isDebugEnabled())
- getLogger().debug("Context closed.");
- } catch (IOException e) {
- getLogger().warn("authenticate handling IOException, check your setup: " + e);
- } catch (AuthenticationException e) {
- getLogger().info("authenticate failed for principal " + principal + ", exception " + e);
- } catch (NamingException e) {
- // log this failure
- if (getLogger().isInfoEnabled()) {
- getLogger().info("Bind for user " + principal + " to Ldap server failed: ", e);
- }
- }
-
- return authenticated;
-
- }
-
- /**
- * @see org.apache.lenya.ac.Item#getName()
- */
- public String getName() {
- return this.ldapName;
- }
-
- /**
- * LDAP Users fetch their name information from the LDAP server, so we don't
- * store it locally. Since we only have read access we basically can't set
- * the name, i.e. any request to change the name is ignored.
- * @param string is ignored
- */
- public void setName(String string) {
- // we do not have write access to LDAP, so we ignore
- // change request to the name.
- }
-
- /**
- * The LDAPUser doesn't store any passwords as they are handled by LDAP
- * @param plainTextPassword is ignored
- */
- public void setPassword(String plainTextPassword) {
- setEncryptedPassword(null);
- }
-
- /**
- * The LDAPUser doesn't store any passwords as they are handled by LDAP
- * @param encryptedPassword is ignored
- */
- protected void setEncryptedPassword(String encryptedPassword) {
- encryptedPassword = null;
- }
-
- /**
- * The LDAPUser doesn't change any passwords as they are handled by LDAP
- * @return always returns false
- */
- public boolean canChangePassword() {
- return false;
- }
-
- /**
- * Connect to the LDAP server
- * @param principal the principal string for the LDAP connection
- * @param credentials the credentials for the LDAP connection
- * @param authMethod the authentication method
- * @return a <code>DirContext</code>
- * @throws NamingException if there are problems establishing the Ldap
- * connection
- */
- private DirContext bind(String principal, String credentials, String authMethod)
- throws NamingException {
-
- if (getLogger().isInfoEnabled())
- getLogger().info("Binding principal: [" + principal + "]");
-
- Hashtable env = new Hashtable();
-
- System.setProperty("javax.net.ssl.trustStore", getConfigurationDirectory()
- .getAbsolutePath()
- + File.separator + defaultProperties.getProperty(KEY_STORE_PROP));
-
- env.put(Context.INITIAL_CONTEXT_FACTORY, LdapCtxFactory.class.getName());
-
- String prop = defaultProperties.getProperty(PROVIDER_URL_PROP);
- if (prop == null)
- throw new RuntimeException("LDAP configuration error: property " + PROVIDER_URL_PROP
- + " is not set in property file " + LDAP_PROPERTIES_FILE);
- env.put(Context.PROVIDER_URL, prop);
-
- prop = defaultProperties.getProperty(SECURITY_PROTOCOL_PROP);
- if (prop == null)
- throw new RuntimeException("LDAP configuration error: property "
- + SECURITY_PROTOCOL_PROP + " is not set in property file "
- + LDAP_PROPERTIES_FILE);
- env.put(Context.SECURITY_PROTOCOL, prop);
-
- env.put(Context.SECURITY_AUTHENTICATION, authMethod);
- if (authMethod != null && !authMethod.equals("none")) {
- env.put(Context.SECURITY_PRINCIPAL, principal);
- env.put(Context.SECURITY_CREDENTIALS, credentials);
- }
- env.put(Context.REFERRAL, defaultProperties.getProperty(HANDLE_REFERRALS_PROP, HANDLE_REFERRALS_DEFAULT));
-
- DirContext ctx = new InitialLdapContext(env, null);
-
- if (getLogger().isInfoEnabled())
- getLogger().info("Finished binding principal.");
-
- return ctx;
- }
-
- /**
- * Close the connection to the LDAP server
- * @param ctx the context that was returned from the bind
- * @throws NamingException if there is a problem communicating to the LDAP
- * server
- */
- private void close(Context ctx) throws NamingException {
- if (ctx != null)
- ctx.close();
- }
-
- /**
- * Read the properties
- * @throws IOException if the properties cannot be found.
- */
- private void readProperties() throws IOException {
- // create and load default properties
- File propertiesFile = new File(getConfigurationDirectory(), LDAP_PROPERTIES_FILE);
-
- if (defaultProperties == null) {
- defaultProperties = new Properties();
-
- FileInputStream in = null;
- try {
- in = new FileInputStream(propertiesFile);
- defaultProperties.load(in);
- } finally {
- if (in != null) {
- in.close();
- }
- }
- }
- }
-
- /**
- * Wrapping of the decision whether a recursive search is wanted or not.
- * Implementation: If the USR_BRANCH_PROP is present, this is the new style
- * of configuration (starting Lenya 1.2.2); if it has a value, then a
- * specific branch is wanted: no recursive search. If the property is
- * present, but has no value, search recursively.
- * @return Recursive search
- */
- private boolean isSubtreeSearch() {
- boolean recurse = false;
- String usrBranchProp = defaultProperties.getProperty(USR_BRANCH_PROP);
- if (usrBranchProp != null)
- if (usrBranchProp.trim().length() == 0)
- recurse = true;
-
- return recurse;
- }
-
- private SearchResult getDirectoryEntry(String userId) throws NamingException, IOException {
- DirContext context = null;
- String searchFilter = "";
- String objectName = "";
- boolean recursiveSearch;
- SearchResult result = null;
-
- try {
- readProperties();
-
- context = bind(defaultProperties.getProperty(MGR_DN_PROP), defaultProperties
- .getProperty(MGR_PW_PROP), defaultProperties
- .getProperty(SECURITY_AUTHENTICATION_PROP));
-
- // Get search information and user attribute from properties
- // provide defaults if not present (backward compatibility)
- String userAttribute = defaultProperties.getProperty(USR_ATTR_PROP, USR_ATTR_DEFAULT);
- searchFilter = "(" + userAttribute + "=" + userId + ")";
- SearchControls scope = new SearchControls();
-
- recursiveSearch = isSubtreeSearch();
- if (recursiveSearch) {
- scope.setSearchScope(SearchControls.SUBTREE_SCOPE);
- objectName = defaultProperties.getProperty(PROVIDER_URL_PROP);
- } else {
- scope.setSearchScope(SearchControls.ONELEVEL_SCOPE);
- objectName = defaultProperties.getProperty(USR_BRANCH_PROP, USR_BRANCH_DEFAULT);
- }
-
- if (getLogger().isDebugEnabled())
- getLogger().debug(
- "searching object " + objectName + " filtering with " + searchFilter
- + ", recursive search ? " + recursiveSearch);
-
- NamingEnumeration results = context.search(objectName, searchFilter, scope);
- if (results != null && results.hasMore())
- result = (SearchResult) results.next();
-
- // sanity check: if more than one entry is returned
- // for a user-id, then the directory is probably flawed,
- // so it would be nice to warn the administrator.
- //
- // This block is commented out for now, because of possible
- // side-effects, such as unexpected exceptions.
- // try {
- // if (results.hasMore()) {
- // getLogger().warn("Found more than one entry in the directory for
- // user " + userId + ". You probably should deactivate recursive
- // searches. The first entry was used as a work-around.");
- // }
- // }
- // catch (javax.naming.PartialResultException e) {
- // if (getLogger().isDebugEnabled())
- // getLogger().debug("Catching and ignoring PartialResultException,
- // as this means LDAP server does not support our sanity check");
- // }
-
- } catch (NamingException e) {
- if (getLogger().isDebugEnabled())
- getLogger().debug(
- "NamingException caught when searching on objectName = " + objectName
- + " and searchFilter=" + searchFilter
- + ", this exception will be propagated: " + e);
- throw e;
- } finally {
- try {
- if (context != null) {
- close(context);
- }
- } catch (NamingException e) {
- getLogger().warn("this should not happen: exception closing context " + e);
- }
- }
- return result;
- }
-
- /**
- * Encapsulation of the creation of a principal: we need to distinguish
- * three cases, in order to support different modes of using a directory.
- * The first is the use of a domain-name (requirement of MS Active
- * Directory): if this property is set, this is used to construct the
- * principal. The second case is where a user-id is somewhere in a domain,
- * but not in a specific branch: in this case, a subtree search is performed
- * to retrieve the complete path. The third case is where a specific branch
- * of the directory is to be used; this is the case where usr-branch is set
- * to a value. In this case, this branch is used to construct the principal.
- * @return The principal
- * @throws IOException
- * @throws NamingException
- */
- private String getPrincipal() throws IOException, NamingException {
-
- String principal;
-
- // 1. Check if domain-name is to be supported
- String domainProp = defaultProperties.getProperty(DOMAIN_NAME_PROP);
- if (domainProp != null && domainProp.trim().length() > 0) {
- principal = domainProp + "\\" + getLdapId();
- } else {
- if (isSubtreeSearch()) {
- // 2. Principal is constructed from directory entry
- SearchResult entry = getDirectoryEntry(getLdapId());
- principal = entry.getName();
- if (entry.isRelative()){
- if (principal.length() > 0)
- principal = principal + "," + defaultProperties.getProperty(BASE_DN_PROP);
- } else {
- // if the item is found following a referral an URL string is
- // returned which can not be used as principal
- LdapURL ldapurl = new LdapURL(principal);
- principal = ldapurl.getDN();
- }
- } else
- // 3. Principal is constructed from properties
- principal = constructPrincipal(getLdapId());
- }
-
- return principal;
- }
-
- /**
- * Construct the principal for a user, by using the given userId along with
- * the configured properties.
- * @param userId The user id
- * @return The principal
- */
- private String constructPrincipal(String userId) {
- StringBuffer principal = new StringBuffer();
- principal.append(defaultProperties.getProperty(USR_ATTR_PROP, USR_ATTR_DEFAULT))
- .append("=").append(userId).append(",");
-
- String baseDn = defaultProperties.getProperty(BASE_DN_PROP);
- if (baseDn != null && baseDn.length() > 0) {
- // USR_BRANCH_PROP may be empty, so only append when not-empty
- String usrBranch = defaultProperties.getProperty(USR_BRANCH_PROP);
- if (usrBranch != null) {
- if (usrBranch.trim().length() > 0)
- principal.append(usrBranch).append(",");
- } else
- principal.append(USR_BRANCH_DEFAULT).append(",");
-
- principal.append(defaultProperties.getProperty(BASE_DN_PROP));
- } else {
- // try for backwards compatibility of ldap properties
- getLogger().warn(
- "getPrincipal() read a deprecated format in ldap properties, please update");
- principal.append(defaultProperties.getProperty(PARTIAL_USER_DN_PROP));
- }
-
- if (getLogger().isDebugEnabled())
- getLogger().debug("getPrincipal() returning " + principal.toString());
-
- return principal.toString();
- }
-
-}
diff --git a/trunk/src/modules-core/ldap/java/test/org/apache/lenya/ac/ldap/AbstractLDAPUserTest.java b/trunk/src/modules-core/ldap/java/test/org/apache/lenya/ac/ldap/AbstractLDAPUserTest.java
deleted file mode 100644
index 79fa4fd..0000000
--- a/trunk/src/modules-core/ldap/java/test/org/apache/lenya/ac/ldap/AbstractLDAPUserTest.java
+++ /dev/null
@@ -1,175 +0,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.
- *
- */
-
-package org.apache.lenya.ac.ldap;
-
-import java.io.File;
-
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.ac.UserType;
-import org.apache.lenya.ac.file.FileAccreditableManager;
-import org.apache.lenya.ac.file.FileGroup;
-import org.apache.lenya.ac.file.FileRole;
-import org.apache.lenya.ac.file.FileUserManager;
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.ac.ldap.LDAPUser;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-
-/**
- * LDAP user test. The name "Abstract..." is used to prevent it from being
- * executed.
- *
- * @version $Id$
- */
-public class AbstractLDAPUserTest extends AbstractAccessControlTest {
-
- /**
- * get a publication
- *
- * @return a <code>Publication</code>
- *
- * @throws PublicationException if an error occurs
- */
- final public Publication getPublication() throws PublicationException {
- return getPublication("test");
- }
-
- /**
- * Create and save an ldap user
- *
- * @param userName name of the user
- * @param email of the user
- * @param ldapId ldap id of the user
- * @throws AccessControlException if the creating or the saving fails
- * @throws ConfigurationException if the creating or the saving fails
- */
- final public void createAndSaveUser(String userName, String email, String ldapId)
- throws AccessControlException, ConfigurationException {
- String editorGroupName = "editorGroup";
- String adminGroupName = "adminGroup";
- String editorRoleName = "editorRole";
- String adminRoleName = "adminRole";
-
- FileRole editorRole = new FileRole(getAccreditableManager().getRoleManager(), getLogger());
- editorRole.setName(editorRoleName);
-
- FileRole adminRole = new FileRole(getAccreditableManager().getRoleManager(), getLogger());
- adminRole.setName(adminRoleName);
-
- FileGroup editorGroup = new FileGroup(getAccreditableManager().getGroupManager(),
- getLogger(), editorGroupName);
- FileGroup adminGroup = new FileGroup(getAccreditableManager().getGroupManager(),
- getLogger(), adminGroupName);
-
- LDAPUser user = new LDAPUser(getAccreditableManager().getUserManager(), getLogger(),
- userName, email, ldapId, getLogger());
-
- editorRole.save();
- adminRole.save();
-
- /*
- * editorGroup.addRole(editorRole); user.addGroup(editorGroup);
- * adminGroup.addRole(editorRole); adminGroup.addRole(adminRole);
- */
- editorGroup.save();
- adminGroup.save();
-
- adminGroup.add(user);
- user.save();
- }
-
- /**
- * Test loading an LDAPUser
- *
- * @param userName the name of the user
- * @return an <code>LDAPUser</code>
- * @throws AccessControlException of the loading fails
- */
- final public LDAPUser loadUser(String userName) throws AccessControlException {
- UserType[] userTypes = { FileAccreditableManager.getDefaultUserType() };
- FileUserManager _manager = FileUserManager.instance(getAccreditableManager(),
- getAccreditablesDirectory(), userTypes, getLogger());
-
- return (LDAPUser) _manager.getUser(userName);
- }
-
- /**
- * Test the ldap id getter
- *
- * @throws AccessControlException if the test fails
- * @throws ConfigurationException if the creating or the saving fails
- */
- final public void testGetLdapId() throws ConfigurationException, AccessControlException {
- String userName = "felix";
- String ldapId = "m400032";
- createAndSaveUser(userName, "felix@wyona.com", ldapId);
-
- LDAPUser user = null;
- user = loadUser(userName);
- assertNotNull(user);
- assertEquals(ldapId, user.getLdapId());
- }
-
- /**
- * Test settinf the ldap id
- *
- * @throws AccessControlException if the test fails
- * @throws ConfigurationException if the creating or the saving fails
- */
- final public void testSetLdapId() throws ConfigurationException, AccessControlException {
- String userName = "felix";
- String newLdapId = "foo";
- createAndSaveUser(userName, "felix@wyona.com", "bar");
-
- LDAPUser user = null;
- user = loadUser(userName);
- assertNotNull(user);
- user.setLdapId(newLdapId);
- user.save();
- user = null;
- user = loadUser(userName);
- assertNotNull(user);
- assertEquals(newLdapId, user.getLdapId());
- }
-
- /**
- * Test save
- *
- * @throws AccessControlException if the test fails
- * @throws ConfigurationException if the creating or the saving fails
- */
- final public void testSave() throws ConfigurationException, AccessControlException {
- String userName = "felix";
- createAndSaveUser(userName, "felix@wyona.com", "m400032");
-
- User user = null;
- user = loadUser(userName);
- assertNotNull(user);
- }
-
- /**
- * Test the deletion of a ldap user
- *
- */
- final public void testDelete() {
- // TODO Implement delete().
- }
-}
diff --git a/trunk/src/modules-core/linking/config/cocoon-xconf/globalproxies.xconf b/trunk/src/modules-core/linking/config/cocoon-xconf/globalproxies.xconf
deleted file mode 100644
index 959af32..0000000
--- a/trunk/src/modules-core/linking/config/cocoon-xconf/globalproxies.xconf
+++ /dev/null
@@ -1,40 +0,0 @@
-<?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.
--->
-
-<!-- $Id:$ -->
-
-<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.cms.linking.GlobalProxies']">
-
- <!-- Lenya can rewrite the links to cater to special proxy setups.
- Make sure to update the proxy configuration in publication.xml as well.
- For information about these settings, read
- http://lenya.apache.org/docu/docs/2_0_x/tutorials/proxy.html
-
- The example setting below describes a test setup that corresponds to the example
- in src/pubs/default/config/publication.xml.
- -->
- <component logger="lenya.proxy"
- role="org.apache.lenya.cms.linking.GlobalProxies"
- class="org.apache.lenya.cms.linking.impl.GlobalProxiesImpl">
-<!--
- <proxy ssl="false" url="http://www.example.com/lenya"/>
- <proxy ssl="true" url="https://www.example.com/lenya"/>
--->
- </component>
-
-</xconf>
diff --git a/trunk/src/modules-core/linking/config/cocoon-xconf/linkingmodule.xconf b/trunk/src/modules-core/linking/config/cocoon-xconf/linkingmodule.xconf
deleted file mode 100644
index 4ebf745..0000000
--- a/trunk/src/modules-core/linking/config/cocoon-xconf/linkingmodule.xconf
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-
-<!-- $Id: doctypes.xconf 164635 2005-04-25 20:01:43Z tschlabach $ -->
-
-<xconf xpath="/cocoon/input-modules" unless="/cocoon/input-modules/component-instance[@name = 'link']">
-
- <component-instance logger="core.modules.input.link" name="link"
- class="org.apache.lenya.cms.cocoon.components.modules.input.LinkingModule"/>
-
-</xconf>
diff --git a/trunk/src/modules-core/linking/config/cocoon-xconf/linkmanager.xconf b/trunk/src/modules-core/linking/config/cocoon-xconf/linkmanager.xconf
deleted file mode 100644
index 7bcda0f..0000000
--- a/trunk/src/modules-core/linking/config/cocoon-xconf/linkmanager.xconf
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-
-<!-- $Id:$ -->
-
-<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.cms.linking.LinkManager']">
-
- <component logger="" role="org.apache.lenya.cms.linking.LinkManager"
- class="org.apache.lenya.cms.linking.ContentLinkManager"/>
-
-</xconf>
diff --git a/trunk/src/modules-core/linking/config/cocoon-xconf/linkresolver.xconf b/trunk/src/modules-core/linking/config/cocoon-xconf/linkresolver.xconf
deleted file mode 100644
index 63069c0..0000000
--- a/trunk/src/modules-core/linking/config/cocoon-xconf/linkresolver.xconf
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-
-<!-- $Id:$ -->
-
-<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.cms.linking.LinkResolver']">
-
- <component logger="" role="org.apache.lenya.cms.linking.LinkResolver"
- class="org.apache.lenya.cms.linking.LinkResolverImpl"/>
-
-</xconf>
diff --git a/trunk/src/modules-core/linking/config/cocoon-xconf/proxy-url.xconf b/trunk/src/modules-core/linking/config/cocoon-xconf/proxy-url.xconf
deleted file mode 100644
index 7e260f3..0000000
--- a/trunk/src/modules-core/linking/config/cocoon-xconf/proxy-url.xconf
+++ /dev/null
@@ -1,27 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/input-modules" unless="/cocoon/input-modules/component-instance[@name = 'proxy']">
- <component-instance name="proxy" logger="sitemap.modules.input.proxy"
- class="org.apache.lenya.cms.cocoon.components.modules.input.ProxyModule"/>
- </xconf>
diff --git a/trunk/src/modules-core/linking/config/cocoon-xconf/sourcefactory.xconf b/trunk/src/modules-core/linking/config/cocoon-xconf/sourcefactory.xconf
deleted file mode 100644
index a56677d..0000000
--- a/trunk/src/modules-core/linking/config/cocoon-xconf/sourcefactory.xconf
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-
-<!-- $Id:$ -->
-
-<xconf xpath="/cocoon/source-factories" unless="/cocoon/source-factories/component-instance[@name = 'lenya-document']">
-
- <component-instance logger="" name="lenya-document"
- class="org.apache.lenya.cms.cocoon.source.DocumentSourceFactory"/>
-
-</xconf>
diff --git a/trunk/src/modules-core/linking/config/module.xml b/trunk/src/modules-core/linking/config/module.xml
deleted file mode 100644
index 6296c89..0000000
--- a/trunk/src/modules-core/linking/config/module.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.linking</id>
- <export package="org.apache.lenya.cms.linking"/>
- <export package="org.apache.lenya.cms.cocoon.transformation"/>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>Linking</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>Components to handle internal links.</description>
-</module>
diff --git a/trunk/src/modules-core/linking/config/sitemap/transformers.xmap b/trunk/src/modules-core/linking/config/sitemap/transformers.xmap
deleted file mode 100644
index 7db0697..0000000
--- a/trunk/src/modules-core/linking/config/sitemap/transformers.xmap
+++ /dev/null
@@ -1,63 +0,0 @@
-<?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.
--->
-
-<xmap xpath="/sitemap/components/transformers"
- unless="/sitemap/components/transformers/transformer[@name = 'uuid2url']"
- xmlns:map="http://apache.org/cocoon/sitemap/1.0">
-
- <map:transformer name="uuid2url" logger="lenya.sitemap.transformer.uuid2url"
- src="org.apache.lenya.cms.cocoon.transformation.UuidToUrlTransformer">
- <transform namespace="http://www.w3.org/1999/xhtml" element="a" attribute="href"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="object" attribute="data"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="img" attribute="src"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="link" attribute="href"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="form" attribute="action"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="script" attribute="src"/>
- </map:transformer>
-
- <map:transformer name="url2uuid" logger="lenya.sitemap.transformer.url2uuid"
- src="org.apache.lenya.cms.cocoon.transformation.UrlToUuidTransformer">
- <transform namespace="http://www.w3.org/1999/xhtml" element="a" attribute="href"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="object" attribute="data"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="img" attribute="src"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="link" attribute="href"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="form" attribute="action"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="script" attribute="src"/>
- </map:transformer>
-
- <map:transformer name="proxy" logger="lenya.sitemap.transformer.proxy"
- src="org.apache.lenya.cms.cocoon.transformation.ProxyTransformer">
- <transform namespace="http://www.w3.org/1999/xhtml" element="a" attribute="href"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="object" attribute="data"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="img" attribute="src"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="link" attribute="href"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="form" attribute="action"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="script" attribute="src"/>
- </map:transformer>
-
- <map:transformer name="incoming-proxy" logger="lenya.sitemap.transformer.incoming-proxy"
- src="org.apache.lenya.cms.cocoon.transformation.IncomingProxyTransformer">
- <transform namespace="http://www.w3.org/1999/xhtml" element="a" attribute="href"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="object" attribute="data"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="img" attribute="src"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="link" attribute="href"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="form" attribute="action"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="script" attribute="src"/>
- </map:transformer>
-
-</xmap>
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/components/modules/input/LinkingModule.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/components/modules/input/LinkingModule.java
deleted file mode 100644
index 374844a..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/components/modules/input/LinkingModule.java
+++ /dev/null
@@ -1,59 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.cocoon.components.modules.input.AbstractInputModule;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-
-/**
- * <p>The linking module is a utility to add parameters to link URLs,
- * depending on request parameters. Supported attributes:</p>
- * <ul>
- * <li><code>rev</code> - inserts the parameter <code>,rev=...</code>
- * if a request parameter <code>lenya.revision</code> is present.</li>
- * </ul>
- */
-public class LinkingModule extends AbstractInputModule {
-
- protected static final String ATTRIBUTE_REVISION = "rev";
- protected static final String REQUEST_PARAM_REVISION = "lenya.revision";
-
- public Object getAttribute(String name, Configuration modeConf, Map objectModel) throws ConfigurationException {
-
- if (name.equals(ATTRIBUTE_REVISION)) {
- Request request = ObjectModelHelper.getRequest(objectModel);
- String revision = request.getParameter(REQUEST_PARAM_REVISION);
- if (revision != null) {
- return ",rev=" + revision;
- }
- else {
- return "";
- }
- }
- else {
- throw new ConfigurationException("The attribute [" + name + "] is not supported.");
- }
- }
-
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/components/modules/input/ProxyModule.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/components/modules/input/ProxyModule.java
deleted file mode 100644
index 308a839..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/components/modules/input/ProxyModule.java
+++ /dev/null
@@ -1,151 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-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.components.modules.input.AbstractInputModule;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.lenya.cms.linking.LinkRewriter;
-import org.apache.lenya.cms.linking.OutgoingLinkRewriter;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-
-/**
- * <p>
- * Input module for getting the base URL which may be prepended to internal URLs
- * to construct links. The functionality corresponds to the
- * {@link org.apache.lenya.cms.cocoon.transformation.ProxyTransformer} with one
- * exception: If the <em>webappUrl</em> parameter is an empty string, the root
- * proxy URL (or the context prefix, resp.) is returned.
- * </p>
- * <p>
- * Usage: <code>{proxy:{webappUrl}}</code>
- * </p>
- * <p>
- * The module can be configured to use absolute or relative URLs in the same way
- * as the {@link org.apache.lenya.cms.cocoon.transformation.ProxyTransformer}.
- * </p>
- */
-public class ProxyModule extends AbstractInputModule implements Serviceable {
-
- protected static final String ATTRIBUTE_TYPE = "type";
- protected static final String URL_TYPE_ABSOLUTE = "absolute";
- protected static final String URL_TYPE_RELATIVE = "relative";
- protected static final String PARAMETER_URLS = "urls";
-
- private ServiceManager manager;
- private boolean relativeUrls;
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration,
- * java.util.Map)
- */
- public Object getAttribute(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
-
- final String webappUrl = name;
- Request request = ObjectModelHelper.getRequest(objectModel);
-
- String value = null;
- try {
- if (webappUrl.equals("")) {
- value = rewrite(request, "/");
- if (value.endsWith("/")) {
- value = value.substring(0, value.length() - 1);
- }
- } else {
- value = rewrite(request, webappUrl);
- }
- } catch (ConfigurationException e) {
- throw e;
- } catch (Exception e) {
- throw new ConfigurationException("Obtaining value for [" + name + "] failed: ", e);
- }
- return value;
- }
-
- protected String rewrite(Request request, String url) throws RepositoryException,
- ConfigurationException {
- Session session = RepositoryUtil.getSession(this.manager, request);
- LinkRewriter rewriter = new OutgoingLinkRewriter(this.manager, session, request
- .getRequestURI(), request.isSecure(), false, this.relativeUrls);
- if (!rewriter.matches(url)) {
- throw new ConfigurationException("The URL [" + url + "] can't be rewritten!");
- }
- return rewriter.rewrite(url);
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration,
- * java.util.Map)
- */
- public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- return Collections.EMPTY_SET.iterator();
- }
-
- /**
- * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeValues(java.lang.String,
- * org.apache.avalon.framework.configuration.Configuration,
- * java.util.Map)
- */
- public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- Object[] objects = { getAttribute(name, modeConf, objectModel) };
- return objects;
- }
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
- public void configure(Configuration conf) throws ConfigurationException {
- super.configure(conf);
- Configuration urlConfig = conf.getChild(PARAMETER_URLS, false);
- if (urlConfig != null) {
- String value = urlConfig.getAttribute(ATTRIBUTE_TYPE);
- setUrlType(value);
- }
- }
-
- protected void setUrlType(String value) throws ConfigurationException {
- if (value.equals(URL_TYPE_RELATIVE)) {
- this.relativeUrls = true;
- } else if (value.equals(URL_TYPE_ABSOLUTE)) {
- this.relativeUrls = false;
- } else {
- throw new ConfigurationException("Invalid URL type [" + value
- + "], must be relative or absolute.");
- }
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/source/DocumentSourceFactory.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/source/DocumentSourceFactory.java
deleted file mode 100644
index dea910e..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/source/DocumentSourceFactory.java
+++ /dev/null
@@ -1,201 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.source;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-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.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceException;
-import org.apache.excalibur.source.SourceFactory;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.cms.linking.Link;
-import org.apache.lenya.cms.linking.LinkResolver;
-import org.apache.lenya.cms.linking.LinkTarget;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.util.Query;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * <p>
- * This source factory allows to access documents using the link syntax of the
- * {@link org.apache.lenya.cms.linking.LinkResolver}.
- * </p>
- * <p>
- * Additional optional parameters, separated using <code>...?f=foo&b=bar</code>:
- * </p>
- * <ul>
- * <li><strong>format</strong> - the resource type format</li>
- * <li><strong>session</strong> - the session.
- * To use the session of the current usecase, specify <code>session=usecase</code></li>
- * </ul>
- */
-public class DocumentSourceFactory extends AbstractLogEnabled implements SourceFactory, ThreadSafe,
- Contextualizable, Serviceable, Configurable {
-
- /**
- * The URI scheme.
- */
- public static final String SCHEME = "lenya-document";
-
- private Context context;
- private ServiceManager manager;
-
- /**
- * Used for resolving the object model.
- *
- * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
- */
- public void contextualize(Context context) throws ContextException {
- this.context = context;
- }
-
- private SourceResolver sourceResolver;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
- /**
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration configuration) throws ConfigurationException {
- }
-
- /**
- * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String,
- * java.util.Map)
- */
- public Source getSource(String location, Map parameters) throws MalformedURLException,
- IOException, SourceException {
-
- Map objectModel = ContextHelper.getObjectModel(this.context);
- Request request = ObjectModelHelper.getRequest(objectModel);
-
- String[] uriAndQuery = location.split("\\?");
-
- String linkUri = uriAndQuery[0];
- String queryString = null;
- if (uriAndQuery.length > 1) {
- queryString = uriAndQuery[1];
- }
-
- LinkResolver resolver = null;
- try {
- if (this.sourceResolver == null) {
- this.sourceResolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
- }
-
- resolver = (LinkResolver) this.manager.lookup(LinkResolver.ROLE);
- DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
- String webappUrl = ServletHelper.getWebappURI(request);
- LinkTarget target;
- if (factory.isDocument(webappUrl)) {
- Document currentDoc = factory.getFromURL(webappUrl);
- target = resolver.resolve(currentDoc, linkUri);
- }
- else {
- Link link = new Link(linkUri);
- contextualize(link, webappUrl);
- target = resolver.resolve(factory, link.getUri());
- }
-
- Document doc = target.getDocument();
-
- if (target.isRevisionSpecified()) {
- if (queryString == null) {
- queryString = "";
- }
- queryString += "rev=" + target.getRevisionNumber();
- }
-
- String format = null;
- if (queryString != null) {
- Query query = new Query(queryString);
- format = query.getValue("format");
- }
- if (format != null) {
- return getFormatSource(doc, format);
- } else {
- String lenyaURL = doc.getSourceURI();
- if (queryString != null) {
- lenyaURL += "?" + queryString;
- }
- return this.sourceResolver.resolveURI(lenyaURL);
- }
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- }
-
- /**
- * If the link doesn't contain context information (publication ID, area), provide it.
- * @param link The link.
- * @param webappUrl The web application URL to extract the context information from..
- */
- protected void contextualize(Link link, String webappUrl) {
- URLInformation url = new URLInformation(webappUrl);
- if (link.getPubId() == null) {
- link.setPubId(url.getPublicationId());
- }
- if (link.getArea() == null) {
- link.setArea(url.getArea());
- }
- }
-
- protected Source getFormatSource(Document doc, String format) throws DocumentException,
- ServiceException, IOException {
- String formatBaseUri = doc.getResourceType().getFormatURI(format);
- String formatUri = formatBaseUri + "/" + doc.getPublication().getId() + "/" + doc.getArea()
- + "/" + doc.getUUID() + "/" + doc.getLanguage();
-
- return this.sourceResolver.resolveURI(formatUri);
- }
-
- /**
- * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
- */
- public void release(Source source) {
- this.sourceResolver.release(source);
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/AbstractLinkTransformer.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/AbstractLinkTransformer.java
deleted file mode 100644
index 5f1215e..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/AbstractLinkTransformer.java
+++ /dev/null
@@ -1,273 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.transformation;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.cocoon.transformation.AbstractSAXTransformer;
-import org.apache.lenya.cms.linking.LinkRewriter;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- * <p>
- * This transformer processes all links which are configured using
- * <code><transform/></code> elements:
- * </p>
- * <code><pre>
- * <map:transformer ... >
- * <transform namespace="http://www.w3.org/1999/xhtml" element="a" attribute="href"/>
- * <transform namespace="..." ... />
- * </map:transformer>
- * </pre></code>
- */
-public abstract class AbstractLinkTransformer extends AbstractSAXTransformer {
-
- /**
- * Set of supported local names for quick pre-checks.
- */
- private Set localNames = new HashSet();
-
- public void configure(Configuration config) throws ConfigurationException {
- super.configure(config);
- Configuration[] transformConfigs = config.getChildren("transform");
- for (int i = 0; i < transformConfigs.length; i++) {
- String namespace = transformConfigs[i].getAttribute("namespace");
- String element = transformConfigs[i].getAttribute("element");
- String attribute = transformConfigs[i].getAttribute("attribute");
- AttributeConfiguration attrConfig = new AttributeConfiguration(namespace, element,
- attribute);
- String key = getCacheKey(namespace, element);
- Set configs = (Set) this.namespaceLocalname2configSet.get(key);
- if (configs == null) {
- configs = new HashSet();
- this.localNames.add(element);
- this.namespaceLocalname2configSet.put(key, configs);
- }
- configs.add(attrConfig);
- }
- }
-
- /**
- * Declaration of an attribute which should be transformed.
- */
- public static class AttributeConfiguration {
-
- protected final String element;
- protected final String namespace;
- protected final String attribute;
-
- /**
- * @param namespace The namespace of the element.
- * @param element The local name of the element.
- * @param attribute The name of the attribute to transform.
- */
- public AttributeConfiguration(String namespace, String element, String attribute) {
- this.namespace = namespace;
- this.element = element;
- this.attribute = attribute;
- }
-
- /**
- * @param uri The namespace URI.
- * @param name The local name.
- * @param attrs The attributes.
- * @return If this configuration matches the parameters.
- */
- public boolean matches(String uri, String name, Attributes attrs) {
- return this.namespace.equals(uri) && this.element.equals(name)
- && attrs.getValue(this.attribute) != null;
- }
-
- }
-
- /**
- * @param namespace The namespace URI.
- * @param localName The local name.
- * @param attrs The attributes.
- * @return A set of {@link AttributeConfiguration} objects.
- */
- protected Set getMatchingConfigurations(String namespace,
- String localName, Attributes attrs) {
-
- // pre-check for performance reasons
- if (!existsMatchingConfiguration(namespace, localName)) {
- return Collections.EMPTY_SET;
- }
-
- String key = getCacheKey(namespace, localName);
-
- // don't initialize yet for performance reasons
- Set configs = null;
- Set allConfigs = (Set) this.namespaceLocalname2configSet.get(key);
- for (Iterator i = allConfigs.iterator(); i.hasNext(); ) {
- AttributeConfiguration config = (AttributeConfiguration) i.next();
- if (config.matches(namespace, localName, attrs)) {
- if (configs == null) {
- configs = new HashSet();
- }
- configs.add(config);
- }
- }
- if (configs == null) {
- configs = Collections.EMPTY_SET;
- }
- return configs;
- }
-
- /**
- * Cache to improve performance.
- */
- private Map namespaceLocalname2configSet = new HashMap();
-
- protected boolean existsMatchingConfiguration(String namespace, String localName) {
- // quick pre-check
- if (!this.localNames.contains(localName)) {
- return false;
- }
-
- // more expensive check
- String key = getCacheKey(namespace, localName);
- return this.namespaceLocalname2configSet.containsKey(key);
- }
-
- protected String getCacheKey(String namespace, String localName) {
- return namespace + " " + localName;
- }
-
- protected String indent = "";
- protected boolean ignoreLinkElement = false;
-
- /**
- * @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 name, String qname, Attributes attrs)
- throws SAXException {
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- this.indent + "<" + qname + "> (ignoreAElement = " + this.ignoreLinkElement
- + ")");
- this.indent += " ";
- }
-
- AttributesImpl newAttrs = null;
-
- Set configs = getMatchingConfigurations(uri, name, attrs);
-
- if (!configs.isEmpty()) {
-
- this.ignoreLinkElement = false;
-
- for (Iterator i = configs.iterator(); i.hasNext(); ) {
- AttributeConfiguration config = (AttributeConfiguration) i.next();
- String linkUrl = attrs.getValue(config.attribute);
- try {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(this.indent + "link URL: [" + linkUrl + "]");
- }
- newAttrs = new AttributesImpl(attrs);
- handleLink(linkUrl, config, newAttrs);
- } catch (final Exception e) {
- getLogger().error("startElement failed: ", e);
- throw new SAXException(e);
- }
- }
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(this.indent + "ignoreAElement: " + this.ignoreLinkElement);
- }
-
- if (!(!configs.isEmpty() && this.ignoreLinkElement)) {
- if (newAttrs != null) {
- attrs = newAttrs;
- }
- super.startElement(uri, name, qname, attrs);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(this.indent + "<" + qname + "> sent");
- }
- }
- }
-
- /**
- * Handle a link in the source SAX stream.
- * @param linkUrl The link URL.
- * @param config The attribute configuration which matched the link.
- * @param newAttrs The new attributes which will be added to the result
- * element.
- * @throws Exception if an error occurs.
- */
- protected void handleLink(String linkUrl, AttributeConfiguration config, AttributesImpl newAttrs)
- throws Exception {
- if (getLinkRewriter().matches(linkUrl)) {
- setAttribute(newAttrs, config.attribute, getLinkRewriter().rewrite(linkUrl));
- }
- }
-
- /**
- * @see org.xml.sax.ContentHandler#endElement(java.lang.String,
- * java.lang.String, java.lang.String)
- */
- public void endElement(String uri, String name, String qname) throws SAXException {
- if (getLogger().isDebugEnabled()) {
- this.indent = this.indent.substring(2);
- getLogger().debug(this.indent + "</" + qname + ">");
- }
- if (existsMatchingConfiguration(uri, name) && this.ignoreLinkElement) {
- this.ignoreLinkElement = false;
- } else {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(this.indent + "</" + qname + "> sent");
- }
- super.endElement(uri, name, qname);
- }
- }
-
- /**
- * Sets the value of a certain attribute.
- *
- * @param attr The attributes.
- * @param name The attribute name.
- * @param value The value.
- * @throws IllegalArgumentException if the href attribute is not contained
- * in this attributes.
- */
- protected void setAttribute(AttributesImpl attr, String name, String value) {
- int position = attr.getIndex(name);
- if (position == -1) {
- throw new IllegalArgumentException("The attribute [" + name + "] is not available!");
- }
- attr.setValue(position, value);
- }
-
- /**
- * @return The link rewriter used by this transformer.
- */
- protected abstract LinkRewriter getLinkRewriter();
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/IncomingProxyTransformer.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/IncomingProxyTransformer.java
deleted file mode 100644
index c154771..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/IncomingProxyTransformer.java
+++ /dev/null
@@ -1,65 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.transformation;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.cms.linking.IncomingLinkRewriter;
-import org.apache.lenya.cms.linking.LinkRewriter;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.ServletHelper;
-import org.xml.sax.SAXException;
-
-/**
- * Converts links in proxy syntax to web application links.
- * @see IncomingLinkRewriter
- */
-public class IncomingProxyTransformer extends AbstractLinkTransformer {
-
- private LinkRewriter rewriter;
-
- public void setup(SourceResolver _resolver, Map _objectModel, String _source,
- Parameters _parameters) throws ProcessingException, SAXException, IOException {
- super.setup(_resolver, _objectModel, _source, _parameters);
- Request request = ObjectModelHelper.getRequest(_objectModel);
-
- try {
- Session session = RepositoryUtil.getSession(this.manager, request);
- DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
- URLInformation info = new URLInformation(ServletHelper.getWebappURI(request));
- String pubId = info.getPublicationId();
- this.rewriter = new IncomingLinkRewriter(factory.getPublication(pubId));
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- protected LinkRewriter getLinkRewriter() {
- return this.rewriter;
- }
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/ProxyTransformer.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/ProxyTransformer.java
deleted file mode 100644
index 5772933..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/ProxyTransformer.java
+++ /dev/null
@@ -1,109 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.transformation;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.cms.linking.LinkRewriter;
-import org.apache.lenya.cms.linking.OutgoingLinkRewriter;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.xml.sax.SAXException;
-
-/**
- * <p>
- * Proxy transformer.
- * </p>
- * <p>
- * The resulting URLs can either be absolute (default) or relative. You can
- * either configure this when declaring the transformer:
- * </p>
- * <code><pre>
- * <map:transformer ... >
- * <urls type="relative"/>
- * ...
- * </map:transformer>
- * </pre></code>
- * <p>
- * or pass a parameter:
- * </p>
- * <code><pre>
- * <map:parameter name="urls" value="relative"/>
- * </pre></code>
- * @see OutgoingLinkRewriter
- */
-public class ProxyTransformer extends AbstractLinkTransformer {
-
- protected static final String ATTRIBUTE_TYPE = "type";
- protected static final String URL_TYPE_ABSOLUTE = "absolute";
- protected static final String URL_TYPE_RELATIVE = "relative";
- protected static final String PARAMETER_URLS = "urls";
-
- private boolean relativeUrls = false;
- private LinkRewriter rewriter;
-
- public void setup(SourceResolver _resolver, Map _objectModel, String _source,
- Parameters _parameters) throws ProcessingException, SAXException, IOException {
- super.setup(_resolver, _objectModel, _source, _parameters);
- Request _request = ObjectModelHelper.getRequest(_objectModel);
-
- try {
- if (_parameters.isParameter(PARAMETER_URLS)) {
- setUrlType(_parameters.getParameter(PARAMETER_URLS));
- }
- Session session = RepositoryUtil.getSession(this.manager, _request);
- this.rewriter = new OutgoingLinkRewriter(this.manager, session, _request
- .getRequestURI(), request.isSecure(), false, this.relativeUrls);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public void configure(Configuration config) throws ConfigurationException {
- super.configure(config);
- Configuration urlConfig = config.getChild(PARAMETER_URLS, false);
- if (urlConfig != null) {
- String value = urlConfig.getAttribute(ATTRIBUTE_TYPE);
- setUrlType(value);
- }
- }
-
- protected void setUrlType(String value) throws ConfigurationException {
- if (value.equals(URL_TYPE_RELATIVE)) {
- this.relativeUrls = true;
- } else if (value.equals(URL_TYPE_ABSOLUTE)) {
- this.relativeUrls = false;
- } else {
- throw new ConfigurationException("Invalid URL type [" + value
- + "], must be relative or absolute.");
- }
- }
-
- protected LinkRewriter getLinkRewriter() {
- return this.rewriter;
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UrlToUuidTransformer.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UrlToUuidTransformer.java
deleted file mode 100644
index 9ae9dc3..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UrlToUuidTransformer.java
+++ /dev/null
@@ -1,84 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.transformation;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.cms.linking.LinkResolver;
-import org.apache.lenya.cms.linking.LinkRewriter;
-import org.apache.lenya.cms.linking.UrlToUuidRewriter;
-import org.apache.lenya.cms.publication.Area;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.ServletHelper;
-import org.xml.sax.SAXException;
-
-/**
- * <p>
- * URL to UUID transformer.
- * </p>
- *
- * <p>
- * This transformer is applied to an XHMTL document. It processes all URL-based
- * links to links following the {@link LinkResolver} syntax.
- * </p>
- *
- * $Id: LinkRewritingTransformer.java,v 1.7 2004/03/16 11:12:16 gregor
- */
-public class UrlToUuidTransformer extends AbstractLinkTransformer {
-
- private LinkRewriter rewriter;
-
- /**
- * @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(org.apache.cocoon.environment.SourceResolver,
- * java.util.Map, java.lang.String,
- * org.apache.avalon.framework.parameters.Parameters)
- */
- public void setup(SourceResolver _resolver, Map _objectModel, String _source,
- Parameters _parameters) throws ProcessingException, SAXException, IOException {
- super.setup(_resolver, _objectModel, _source, _parameters);
-
- Request _request = ObjectModelHelper.getRequest(_objectModel);
- try {
- Session session = RepositoryUtil.getSession(this.manager, _request);
- DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
- String url = ServletHelper.getWebappURI(_request);
- URLInformation info = new URLInformation(url);
- Publication pub = factory.getPublication(info.getPublicationId());
- Area area = pub.getArea(info.getArea());
- this.rewriter = new UrlToUuidRewriter(area);
- } catch (final Exception e1) {
- throw new ProcessingException(e1);
- }
- }
-
- protected LinkRewriter getLinkRewriter() {
- return this.rewriter;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java
deleted file mode 100644
index df416ee..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java
+++ /dev/null
@@ -1,313 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.transformation;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.cms.linking.Link;
-import org.apache.lenya.cms.linking.LinkResolver;
-import org.apache.lenya.cms.linking.LinkRewriter;
-import org.apache.lenya.cms.linking.LinkTarget;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.Query;
-import org.apache.lenya.util.ServletHelper;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- * <p>
- * UUID to URL transformer.
- * </p>
- *
- * <p>
- * This transformer is applied to an XHMTL document. It processes all links following the
- * {@link LinkResolver} syntax which are configured using <code><transform/></code> elements
- * (see below).
- * </p>
- * <p>
- * These links are resolved using the following rules:
- * </p>
- * <ul>
- * <li>The current area (obtained from the page envelope) is used.</li>
- * <li>A URL prefix is added depending on the proxy configuration of the publication.</li>
- * <li>If the target document does not exist and is in the authoring area, the href attribute is
- * removed and a class="brokenlink" attribute is added to the <code><a/></code> element.</li>
- * <li>If the target document does not exist and is in the live area, the <code><a/></code>
- * element is removed to disable the link.</li>
- * </ul>
- *
- * <p>
- * You can add the query parameter <code>uuid2url.extension</code> to <code>lenya-document:</code>
- * URLs to set a specific link extension.
- * </p>
- * <p>
- * The resulting URLs are absolute web application URLs (without the servlet context path).
- * </p>
- *
- * $Id: LinkRewritingTransformer.java,v 1.7 2004/03/16 11:12:16 gregor
- */
-public class UuidToUrlTransformer extends AbstractLinkTransformer implements Disposable {
-
- protected static final String BROKEN_ATTRIB = "class";
- protected static final String BROKEN_VALUE = "brokenlink";
- protected static final String EXTENSION_PARAM = "uuid2url.extension";
-
- private String currentUrl;
-
- private DocumentFactory factory;
- private LinkResolver linkResolver;
- private Document currentDoc;
-
- /**
- * @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(org.apache.cocoon.environment.SourceResolver,
- * java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
- */
- public void setup(SourceResolver _resolver, Map _objectModel, String _source,
- Parameters _parameters) throws ProcessingException, SAXException, IOException {
- super.setup(_resolver, _objectModel, _source, _parameters);
-
- Request _request = ObjectModelHelper.getRequest(_objectModel);
-
- try {
- Session session = RepositoryUtil.getSession(this.manager, _request);
- this.factory = DocumentUtil.createDocumentFactory(this.manager, session);
- this.currentUrl = ServletHelper.getWebappURI(_request);
- if (this.factory.isDocument(this.currentUrl)) {
- this.currentDoc = this.factory.getFromURL(this.currentUrl);
- }
- this.linkResolver = (LinkResolver) this.manager.lookup(LinkResolver.ROLE);
- } catch (final Exception e) {
- throw new ProcessingException(e);
- }
- }
-
- protected void handleLink(String linkUrl, AttributeConfiguration config, AttributesImpl newAttrs)
- throws Exception {
-
- URLInformation info = new URLInformation(this.currentUrl);
- if (linkUrl.startsWith("lenya-document:")) {
-
- String anchor = null;
- String url = null;
-
- int anchorIndex = linkUrl.indexOf("#");
- if (anchorIndex > -1) {
- url = linkUrl.substring(0, anchorIndex);
- anchor = linkUrl.substring(anchorIndex + 1);
- } else {
- url = linkUrl;
- }
-
- StringTokenizer tokenizer = new StringTokenizer(url, "?");
- String linkUri = tokenizer.nextToken();
- String queryString = null;
- String requiredExtension = null;
- if (tokenizer.hasMoreTokens()) {
- queryString = tokenizer.nextToken();
- Query query = new Query(queryString);
- requiredExtension = query.getValue(EXTENSION_PARAM);
- query.removeValue(EXTENSION_PARAM);
- queryString = query.toString();
- }
-
- LinkTarget target;
- if (this.currentDoc != null) {
- target = this.linkResolver.resolve(this.currentDoc, linkUri);
- } else {
- Link link = getAbsoluteLink(info, linkUri);
- target = this.linkResolver.resolve(this.factory, link.getUri());
- }
-
- if (target.exists() && target.getDocument().hasLink()) {
- Document targetDocument = target.getDocument();
- String extension = getExtension(targetDocument, requiredExtension);
- rewriteLink(newAttrs, config.attribute, targetDocument, anchor, queryString,
- extension);
- } else if (info.getArea().equals(Publication.AUTHORING_AREA)) {
- markBrokenLink(newAttrs, config.attribute, linkUrl);
- } else {
- this.ignoreLinkElement = true;
- }
- } else {
- /*
- * This is legacy code. It rewrites links to non-document images (in resources/shared).
- * These images shouldn't be referenced in documents since this violates the separation
- * between content and layout.
- */
- String prefix = "/" + info.getPublicationId() + "/";
- if (linkUrl.startsWith(prefix)) {
- String pubUrl = linkUrl.substring(prefix.length());
- StringTokenizer tokenizer = new StringTokenizer(pubUrl, "/");
- String area = tokenizer.nextToken();
-
- // don't rewrite /{pub}/modules/...
- if (area.equals(Publication.AUTHORING_AREA)) {
- String areaUrl = pubUrl.substring(area.length());
- String newUrl = prefix + area + areaUrl;
- setAttribute(newAttrs, config.attribute, newUrl);
- }
- }
- }
- }
-
- /**
- * The link is constructed from the linkUri string. If it lacks the area or publication ID
- * information, these are obtained from the current URL information.
- * @param info The current URL information.
- * @param linkUri The link URI to use.
- * @return A link.
- * @throws MalformedURLException if the linkUri parameter is malformed.
- */
- protected Link getAbsoluteLink(URLInformation info, String linkUri)
- throws MalformedURLException {
- Link link = new Link(linkUri);
- if (link.getPubId() == null) {
- link.setPubId(info.getPublicationId());
- }
- if (link.getArea() == null) {
- link.setArea(info.getArea());
- }
- return link;
- }
-
- /**
- * Get the extension of a document. Caution: resolving the extension is expensive!
- * @param targetDocument The document.
- * @param requiredExtension The required extension.
- * @return The required extension or, if it is null, the document's default extension.
- */
- protected String getExtension(Document targetDocument, String requiredExtension) {
- String extension = requiredExtension != null ? requiredExtension : targetDocument
- .getExtension();
- if (extension.length() > 0) {
- extension = "." + extension;
- }
- return extension;
- }
-
- /**
- * Marks a <code><a/></code> element as broken and removes href attribute.
- *
- * @param newAttrs The new attributes.
- * @param attrName The attribute name.
- * @param brokenUrl The broken link URI.
- * @throws AccessControlException when something went wrong.
- */
- protected void markBrokenLink(AttributesImpl newAttrs, String attrName, String brokenUrl)
- throws AccessControlException {
- if (newAttrs.getIndex(BROKEN_ATTRIB) > -1)
- newAttrs.removeAttribute(newAttrs.getIndex(BROKEN_ATTRIB));
- if (newAttrs.getIndex("title") > -1)
- newAttrs.removeAttribute(newAttrs.getIndex("title"));
- if (newAttrs.getIndex(attrName) > -1)
- newAttrs.setAttribute(newAttrs.getIndex(attrName), "", attrName, attrName, "CDATA", "");
- String warning = "Broken Link: " + brokenUrl;
- newAttrs.addAttribute("", "title", "title", "CDATA", warning);
- newAttrs.addAttribute("", BROKEN_ATTRIB, BROKEN_ATTRIB, "CDATA", BROKEN_VALUE);
- }
-
- /**
- * Rewrites a link.
- *
- * @param newAttrs The new attributes.
- * @param attributeName The name of the attribute to rewrite.
- * @param targetDocument The target document.
- * @param anchor The anchor (the string after the # character in the URL).
- * @param queryString The query string without question mark.
- * @param extension The extension to use.
- * @throws AccessControlException when something went wrong.
- */
- protected void rewriteLink(AttributesImpl newAttrs, String attributeName,
- Document targetDocument, String anchor, String queryString, String extension)
- throws AccessControlException {
-
- String webappUrl = targetDocument.getCanonicalWebappURL();
-
- int lastDotIndex = webappUrl.lastIndexOf(".");
- if (lastDotIndex > -1) {
- webappUrl = webappUrl.substring(0, lastDotIndex) + extension;
- }
-
- if (anchor != null) {
- webappUrl += "#" + anchor;
- }
-
- if (queryString != null && queryString.length() > 0) {
- webappUrl += "?" + queryString;
- }
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(this.indent + "Rewriting URL to: [" + webappUrl + "]");
- }
-
- setAttribute(newAttrs, attributeName, webappUrl);
- }
-
- /**
- * Sets the value of the href attribute.
- *
- * @param attr The attributes.
- * @param name The attribute name.
- * @param value The value.
- * @throws IllegalArgumentException if the href attribute is not contained in this attributes.
- */
- protected void setAttribute(AttributesImpl attr, String name, String value) {
- int position = attr.getIndex(name);
- if (position == -1) {
- throw new IllegalArgumentException("The href attribute is not available!");
- }
- attr.setValue(position, value);
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- if (this.linkResolver != null) {
- this.manager.release(this.linkResolver);
- }
- }
-
- /**
- * @see org.apache.avalon.excalibur.pool.Recyclable#recycle()
- */
- public void recycle() {
- this.ignoreLinkElement = false;
- this.currentUrl = null;
- }
-
- protected LinkRewriter getLinkRewriter() {
- return null;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/ContentLinkManager.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/ContentLinkManager.java
deleted file mode 100644
index 05bf3c4..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/ContentLinkManager.java
+++ /dev/null
@@ -1,114 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.xml.DocumentHelper;
-import org.apache.xpath.XPathAPI;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
-import org.w3c.dom.traversal.NodeIterator;
-
-/**
- * Basic link manager implementation which searches for links by parsing the
- * document content. For better performance use an implementation which is based
- * on meta data or a centralized link registry.
- */
-public class ContentLinkManager extends AbstractLogEnabled implements LinkManager, Serviceable {
-
- protected ServiceManager manager;
-
- public Link[] getLinksFrom(Document source) {
-
- Set links = new HashSet();
-
- try {
- String[] xPaths = source.getResourceType().getLinkAttributeXPaths();
- if (xPaths.length > 0) {
- org.w3c.dom.Document xml = DocumentHelper.readDocument(source.getInputStream());
-
- if (xml == null) {
- throw new RuntimeException("The document [" + source
- + "] doesn't contain any XML content.");
- }
-
- for (int i = 0; i < xPaths.length; i++) {
- NodeIterator iter = XPathAPI.selectNodeIterator(xml, xPaths[i]);
- Node node;
- while ((node = iter.nextNode()) != null) {
- Attr attr = (Attr) node;
- String uri = attr.getValue();
- if (isLinkUri(uri)) {
- links.add(new Link(uri));
- }
- }
- }
- }
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- return (Link[]) links.toArray(new Link[links.size()]);
- }
-
- protected boolean isLinkUri(String uri) {
- return uri.startsWith(LinkResolver.SCHEME + ":");
- }
-
- public Document[] getReferencingDocuments(Document target) {
-
- Document[] allDocs = target.area().getDocuments();
- Set docs = new HashSet();
-
- LinkResolver resolver = null;
- try {
- resolver = (LinkResolver) this.manager.lookup(LinkResolver.ROLE);
- for (int d = 0; d < allDocs.length; d++) {
-
- Link[] links = getLinksFrom(allDocs[d]);
- for (int l = 0; l < links.length; l++) {
- LinkTarget linkTarget = resolver.resolve(allDocs[d], links[l].getUri());
- if (linkTarget.exists() && linkTarget.getDocument().equals(target)) {
- docs.add(allDocs[d]);
- }
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- }
- return (Document[]) docs.toArray(new Document[docs.size()]);
- }
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/GlobalProxies.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/GlobalProxies.java
deleted file mode 100644
index 743fcf4..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/GlobalProxies.java
+++ /dev/null
@@ -1,38 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import org.apache.lenya.cms.publication.Proxy;
-
-/**
- * Service to manage the web-application-wide proxy settings.
- */
-public interface GlobalProxies {
-
- /**
- * The service role.
- */
- String ROLE = GlobalProxies.class.getName();
-
- /**
- * @param ssl If SSL is used.
- * @return A proxy.
- */
- Proxy getProxy(boolean ssl);
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/IncomingLinkRewriter.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/IncomingLinkRewriter.java
deleted file mode 100644
index 0da6eb6..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/IncomingLinkRewriter.java
+++ /dev/null
@@ -1,81 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import org.apache.lenya.cms.publication.Proxy;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * <p>
- * Converts browser-based links to web application links by using the
- * publication's proxy settings.
- * </p>
- * <p>
- * Objects of this class are not thread-safe.
- * </p>
- */
-public class IncomingLinkRewriter implements LinkRewriter {
-
- private Publication pub;
-
- /**
- * @param pub The current publication.
- */
- public IncomingLinkRewriter(Publication pub) {
- this.pub = pub;
- }
-
- public boolean matches(String url) {
- return getMatchingProxyConfiguration(url) != null;
- }
-
- protected ProxyConfiguration getMatchingProxyConfiguration(String url) {
- ProxyConfiguration config = null;
- String[] areas = this.pub.getAreaNames();
- Boolean[] sslValues = { Boolean.FALSE, Boolean.TRUE };
- for (int a = 0; a < areas.length; a++) {
- for (int s = 0; s < sslValues.length; s++) {
- Proxy proxy = this.pub.getProxy(areas[a], sslValues[s].booleanValue());
- if (config == null && url.startsWith(proxy.getUrl())) {
- config = new ProxyConfiguration(areas[a], sslValues[s].booleanValue());
- }
- }
- }
- return config;
- }
-
- public String rewrite(String url) {
- ProxyConfiguration config = getMatchingProxyConfiguration(url);
- if (config == null) {
- throw new RuntimeException("No matching proxy config for URL [" + url + "]");
- }
- Proxy proxy = this.pub.getProxy(config.area, config.ssl);
- String suffix = url.substring(proxy.getUrl().length());
- return "/" + this.pub.getId() + "/" + config.area + suffix;
- }
-
- protected static class ProxyConfiguration {
- protected String area;
- protected boolean ssl;
- protected ProxyConfiguration(String area, boolean ssl) {
- this.area = area;
- this.ssl = ssl;
- }
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/Link.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/Link.java
deleted file mode 100644
index c0ba9f9..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/Link.java
+++ /dev/null
@@ -1,182 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import java.net.MalformedURLException;
-import java.util.StringTokenizer;
-
-import org.apache.lenya.util.Query;
-
-/**
- * A link to a document.
- */
-public class Link {
-
- protected static final String PAIR_DELIMITER = ",";
- protected static final String KEY_VALUE_DELIMITER = "=";
-
- private String uuid;
- private String language;
- private String revision;
- private String area;
- private String pubId;
-
- /**
- * Ctor.
- */
- public Link() {
- }
-
- /**
- * Ctor.
- * @param linkUri The link URI.
- * @throws MalformedURLException if the URI doesn't represent a link.
- */
- public Link(String linkUri) throws MalformedURLException {
-
- if (!linkUri.startsWith(LinkResolver.SCHEME + ":")) {
- throw new MalformedURLException("The string [" + linkUri + "] is not a valid link URI!");
- }
-
- StringTokenizer schemeAndPath = new StringTokenizer(linkUri, ":");
- schemeAndPath.nextToken();
- String path = schemeAndPath.nextToken();
-
- if (path.indexOf(PAIR_DELIMITER) > -1) {
- int firstDelimiterIndex = path.indexOf(PAIR_DELIMITER);
- this.uuid = path.substring(0, firstDelimiterIndex);
- String pathQueryString = path.substring(firstDelimiterIndex + 1);
- Query query = new Query(pathQueryString, PAIR_DELIMITER, KEY_VALUE_DELIMITER);
- this.pubId = query.getValue("pub");
- this.area = query.getValue("area");
- this.language = query.getValue("lang");
- this.revision = query.getValue("rev");
- } else {
- this.uuid = path;
- }
- }
-
- /**
- * @return The area.
- */
- public String getArea() {
- return area;
- }
-
- /**
- * @param area The area.
- */
- public void setArea(String area) {
- this.area = area;
- }
-
- /**
- * @return The language.
- */
- public String getLanguage() {
- return language;
- }
-
- /**
- * @param language The language.
- */
- public void setLanguage(String language) {
- this.language = language;
- }
-
- /**
- * @return The publication ID.
- */
- public String getPubId() {
- return pubId;
- }
-
- /**
- * @param pubId The publication ID.
- */
- public void setPubId(String pubId) {
- this.pubId = pubId;
- }
-
- /**
- * @return The revision.
- */
- public String getRevision() {
- return revision;
- }
-
- /**
- * @param revision The revision.
- */
- public void setRevision(String revision) {
- this.revision = revision;
- }
-
- /**
- * @return The UUID.
- */
- public String getUuid() {
- return uuid;
- }
-
- /**
- * @param uuid The UUID.
- */
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- /**
- * @return The link URI.
- */
- public String getUri() {
- String uri = LinkResolver.SCHEME + ":";
- if (this.uuid != null) {
- uri = uri + this.uuid;
- }
- if (this.language != null) {
- uri = uri + ",lang=" + this.language;
- }
- if (this.area != null) {
- uri = uri + ",area=" + this.area;
- }
- if (this.pubId != null) {
- uri = uri + ",pub=" + this.pubId;
- }
- if (this.revision != null) {
- uri = uri + ",rev=" + this.revision;
- }
- return uri;
- }
-
- public boolean equals(Object obj) {
- if (!getClass().isInstance(obj)) {
- return false;
- }
- return ((Link) obj).getUri().equals(getUri());
- }
-
- public int hashCode() {
- return getUri().hashCode();
- }
-
- public String toString() {
- return getUri();
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkConverter.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkConverter.java
deleted file mode 100644
index be2a799..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkConverter.java
+++ /dev/null
@@ -1,163 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.ResourceType;
-import org.apache.lenya.xml.DocumentHelper;
-import org.apache.xpath.XPathAPI;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Utility class to convert <code>lenya-document:</code> links from and to URL
- * links.
- */
-public class LinkConverter extends AbstractLogEnabled {
-
- private ServiceManager manager;
-
- /**
- * Creates a link converter.
- * @param manager The service manager.
- * @param logger The logger.
- */
- public LinkConverter(ServiceManager manager, Logger logger) {
- ContainerUtil.enableLogging(this, logger);
- this.manager = manager;
- }
-
- /**
- * Converts all URL-based links to UUID-based links.
- * @param doc The document to convert.
- * @param useContextPath If the request's context path should be considered.
- */
- public void convertUrlsToUuids(Document doc, boolean useContextPath) {
- convertUrlsToUuids(doc.getPublication(), doc, useContextPath);
- }
-
- /**
- * Converts all URL-based links to UUID-based links. The link URLs can
- * originate from a different publication.
- * @param srcPub The publication where the content comes from.
- * @param examinedDocument The document in the target publication.
- * @param useContextPath If the request's context path should be considered.
- */
- public void convertUrlsToUuids(Publication srcPub, Document examinedDocument,
- boolean useContextPath) {
- boolean linksRewritten = false;
- LinkResolver linkResolver = null;
- try {
-
- String prefix = "";
- if (useContextPath) {
- prefix = getContextPath();
- }
-
- ResourceType type = examinedDocument.getResourceType();
- String[] xPaths = type.getLinkAttributeXPaths();
-
- if (xPaths.length == 0) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- "Convert links: No XPaths for resource type [" + type.getName() + "]");
- }
- } else {
- linkResolver = (LinkResolver) this.manager.lookup(LinkResolver.ROLE);
- DocumentFactory factory = examinedDocument.getFactory();
-
- org.w3c.dom.Document xmlDocument = DocumentHelper.readDocument(examinedDocument
- .getInputStream());
-
- for (int xPathIndex = 0; xPathIndex < xPaths.length; xPathIndex++) {
- if (getLogger().isDebugEnabled()) {
- getLogger()
- .debug("Convert links: Check XPath [" + xPaths[xPathIndex] + "]");
- }
- NodeList nodes = XPathAPI.selectNodeList(xmlDocument, xPaths[xPathIndex]);
- for (int nodeIndex = 0; nodeIndex < nodes.getLength(); nodeIndex++) {
- Node node = nodes.item(nodeIndex);
- if (node.getNodeType() != Node.ATTRIBUTE_NODE) {
- throw new RuntimeException("The XPath [" + xPaths[xPathIndex]
- + "] may only match attribute nodes!");
- }
- Attr attribute = (Attr) node;
- final String url = attribute.getValue();
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Convert links: Check URL [" + url + "]");
- }
-
- if (url.startsWith(prefix + "/" + srcPub.getId() + "/"
- + examinedDocument.getArea() + "/")) {
- String targetPubId = examinedDocument.getPublication().getId();
- final String webappUrl = "/" + targetPubId
- + url.substring((prefix + "/" + srcPub.getId()).length());
- if (factory.isDocument(webappUrl)) {
- Document targetDocument = factory.getFromURL(webappUrl);
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- "Convert links: Check webapp URL [" + webappUrl + "]");
- }
-
- Link link = new Link();
- link.setUuid(targetDocument.getUUID());
- attribute.setValue(link.getUri());
- linksRewritten = true;
- }
- }
- }
- }
-
- if (linksRewritten) {
- DocumentHelper.writeDocument(xmlDocument, examinedDocument.getOutputStream());
- }
- }
- } catch (Exception e) {
- throw new RuntimeException("Error rewriting document: [" + examinedDocument + "]", e);
- } finally {
- if (linkResolver != null) {
- this.manager.release(linkResolver);
- }
- }
- }
-
- protected String getContextPath() throws ServiceException {
- String prefix;
- ContextUtility ctxUtil = null;
- try {
- ctxUtil = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
- prefix = ctxUtil.getRequest().getContextPath();
- } finally {
- if (ctxUtil != null) {
- this.manager.release(ctxUtil);
- }
- }
- return prefix;
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkException.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkException.java
deleted file mode 100644
index 8484c42..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkException.java
+++ /dev/null
@@ -1,44 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-/**
- * Link exception.
- */
-public class LinkException extends Exception {
-
- private static final long serialVersionUID = -3304874622495079970L;
-
- public LinkException() {
- super();
- }
-
- public LinkException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- public LinkException(String arg0) {
- super(arg0);
- }
-
- public LinkException(Throwable arg0) {
- super(arg0);
- }
-
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkManager.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkManager.java
deleted file mode 100644
index b8cb709..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkManager.java
+++ /dev/null
@@ -1,48 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import org.apache.lenya.cms.publication.Document;
-
-/**
- * Link manager.
- */
-public interface LinkManager {
-
- /**
- * The Avalon service role.
- */
- String ROLE = LinkManager.class.getName();
-
- /**
- * Returns all links from a document.
- * @param source The document.
- * @return An array of links.
- */
- Link[] getLinksFrom(Document source);
-
- /**
- * Returns all documents which reference a certain document. This depends on
- * the currently available translations of the target document and the link
- * resolver fallback mode.
- * @param target The target document.
- * @return An array of documents.
- */
- Document[] getReferencingDocuments(Document target);
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkResolver.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkResolver.java
deleted file mode 100644
index cd6d2f4..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkResolver.java
+++ /dev/null
@@ -1,102 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import java.net.MalformedURLException;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-
-/**
- * <p>
- * Resolve a link from a document to another document using it's
- * </p>
- * <ul>
- * <li>publication ID</li>
- * <li>area</li>
- * <li>UUID</li>
- * <li>language</li>
- * <li>revision number</li>
- * </ul>
- * <p>
- * All of these parameters are optional and default to the attributes of the
- * document which contains the link.
- * </p>
- * <p>
- * Syntax (square brackets denote optional parts):
- * </p>
- * <code>lenya-document:<uuid>[,lang=...][,area=...][,rev=...][,pub=...]</code>
- * <p>
- * The fallback mode determines the behaviour if the target language is omitted
- * and the target document doesn't exist in the language of the source document.
- * The default fallback mode is {@link #MODE_DEFAULT_LANGUAGE}.
- * <p>
- */
-public interface LinkResolver {
-
- /**
- * The Avalon role.
- */
- String ROLE = LinkResolver.class.getName();
-
- /**
- * The link URI scheme.
- */
- String SCHEME = "lenya-document";
-
- /**
- * Fail if the target document doesn't exist in the source language.
- */
- int MODE_FAIL = 0;
-
- /**
- * Try to fall back to the default language.
- */
- int MODE_DEFAULT_LANGUAGE = 1;
-
- /**
- * Sets the fallback mode.
- * @param mode one of {@link #MODE_FAIL} and {@link #MODE_DEFAULT_LANGUAGE}.
- */
- void setFallbackMode(int mode);
-
- /**
- * @return the fallback mode.
- */
- int getFallbackMode();
-
- /**
- * Resolve a link.
- *
- * @param currentDocument The document which contains the link.
- * @param linkUri The link URI.
- * @return A link target.
- * @throws MalformedURLException if the URI is invalid.
- */
- LinkTarget resolve(Document currentDocument, String linkUri) throws MalformedURLException;
-
- /**
- * Resolve a link. The link URI has to contain the UUID, language, area and publication ID.
- * @param factory The document factory to use.
- * @param linkUri The link URI.
- * @return A link target.
- * @throws MalformedURLException if the URI is invalid.
- */
- LinkTarget resolve(DocumentFactory factory, String linkUri) throws MalformedURLException;
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkResolverImpl.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkResolverImpl.java
deleted file mode 100644
index 50eb58c..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkResolverImpl.java
+++ /dev/null
@@ -1,152 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import java.net.MalformedURLException;
-
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.lenya.cms.publication.Area;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.util.Assert;
-
-/**
- * Link resolver implementation.
- */
-public class LinkResolverImpl extends AbstractLogEnabled implements LinkResolver, Configurable {
-
- /**
- * The Avalon role.
- */
- public static final String ROLE = LinkResolverImpl.class.getName();
-
- public LinkTarget resolve(Document currentDoc, String linkUri) throws MalformedURLException {
-
- Link link = new Link(linkUri);
-
- String language = getValue(link.getLanguage(), currentDoc.getLanguage());
- String revisionString = getValue(link.getRevision(), null);
- String area = getValue(link.getArea(), currentDoc.getArea());
- String pubId = getValue(link.getPubId(), currentDoc.getPublication().getId());
-
- String uuid = getValue(link.getUuid(), currentDoc.getUUID());
- if (uuid.length() == 0) {
- uuid = currentDoc.getUUID();
- }
-
- return resolve(currentDoc.getFactory(), pubId, area, uuid, language, revisionString);
- }
-
- protected String getValue(String value, String defaultValue) {
- if (value == null) {
- return defaultValue;
- } else {
- return value;
- }
- }
-
- private int fallbackMode = MODE_DEFAULT_LANGUAGE;
-
- public int getFallbackMode() {
- return this.fallbackMode;
- }
-
- public void setFallbackMode(int mode) {
- this.fallbackMode = mode;
- }
-
- protected static final String ELEMENT_FALLBACK = "fallback";
-
- public void configure(Configuration config) throws ConfigurationException {
- Configuration fallbackConfig = config.getChild(ELEMENT_FALLBACK, false);
- if (fallbackConfig != null) {
- boolean fallback = config.getValueAsBoolean();
- if (fallback) {
- setFallbackMode(MODE_DEFAULT_LANGUAGE);
- } else {
- setFallbackMode(MODE_FAIL);
- }
- }
- }
-
- public LinkTarget resolve(DocumentFactory factory, String linkUri) throws MalformedURLException {
-
- Link link = new Link(linkUri);
- String language = link.getLanguage();
- Assert.notNull("language", language);
- String uuid = link.getUuid();
- Assert.notNull("uuid", uuid);
- String area = link.getArea();
- Assert.notNull("area", area);
- String pubId = link.getPubId();
- Assert.notNull("publication ID", pubId);
-
- String revisionString = getValue(link.getRevision(), null);
-
- return resolve(factory, pubId, area, uuid, language, revisionString);
- }
-
- protected LinkTarget resolve(DocumentFactory factory, String pubId, String area, String uuid,
- String language, String revisionString) {
- int revision;
- if (revisionString == null) {
- revision = -1;
- } else {
- revision = Integer.valueOf(revisionString).intValue();
- }
-
- try {
- Publication pub = factory.getPublication(pubId);
- Area areaObj = pub.getArea(area);
- Document doc;
- if (areaObj.contains(uuid, language)) {
- doc = areaObj.getDocument(uuid, language);
- } else {
- if (this.fallbackMode == MODE_FAIL) {
- doc = null;
- } else if (this.fallbackMode == MODE_DEFAULT_LANGUAGE) {
- if (areaObj.contains(uuid, pub.getDefaultLanguage())) {
- doc = factory.get(pub, area, uuid, pub.getDefaultLanguage(), revision);
- } else {
- doc = null;
- }
- } else {
- throw new RuntimeException("The fallback mode [" + this.fallbackMode
- + "] is not supported!");
- }
- }
- if (doc == null) {
- return new LinkTarget();
- } else {
- if (revision > -1) {
- return new LinkTarget(doc, revision);
- } else {
- return new LinkTarget(doc);
- }
- }
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkRewriter.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkRewriter.java
deleted file mode 100644
index e08257d..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkRewriter.java
+++ /dev/null
@@ -1,37 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-/**
- * Interface for services which convert links from one form to another.
- */
-public interface LinkRewriter {
-
- /**
- * @param url The URL.
- * @return If this rewriter feels responsible for the URL.
- */
- boolean matches(String url);
-
- /**
- * @param url The original URL.
- * @return The rewritten URL.
- */
- String rewrite(String url);
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkTarget.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkTarget.java
deleted file mode 100644
index 31ccc74..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/LinkTarget.java
+++ /dev/null
@@ -1,96 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.util.Assert;
-
-/**
- * The target of a link.
- */
-public class LinkTarget {
-
- private Document doc;
- private int revisionNumber = -1;
-
- /**
- * Ctor.
- * @param doc The document.
- * @param revisionNumber The revision number.
- */
- protected LinkTarget(Document doc, int revisionNumber) {
- this(doc);
- this.revisionNumber = revisionNumber;
- }
-
- /**
- * Ctor.
- * @param doc The document.
- */
- protected LinkTarget(Document doc) {
- Assert.notNull("document", doc);
- this.doc = doc;
- }
-
- /**
- * Ctor for non-existing targets.
- */
- protected LinkTarget() {
- }
-
- /**
- * @return The linked document.
- * @throws LinkException if the target doesn't exist.
- */
- public Document getDocument() throws LinkException {
- if (!exists()) {
- throw new LinkException("The target doesn't exist!");
- }
- return this.doc;
- }
-
- /**
- * @return The revision number.
- * @throws LinkException if the target doesn't exist or no revision number
- * is specified in the link.
- */
- public int getRevisionNumber() throws LinkException {
- if (!exists()) {
- throw new LinkException("The target doesn't exist!");
- }
- if (this.revisionNumber == -1) {
- throw new LinkException("No revision specified!");
- }
- return this.revisionNumber;
- }
-
- /**
- * @return if the revision is specified in the link.
- */
- public boolean isRevisionSpecified() {
- return this.revisionNumber != -1;
- }
-
- /**
- * @return if the target exists.
- */
- public boolean exists() {
- return this.doc != null;
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/OutgoingLinkRewriter.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/OutgoingLinkRewriter.java
deleted file mode 100644
index 47041f1..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/OutgoingLinkRewriter.java
+++ /dev/null
@@ -1,285 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.AccessControllerResolver;
-import org.apache.lenya.ac.AccreditableManager;
-import org.apache.lenya.ac.Policy;
-import org.apache.lenya.ac.PolicyManager;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.publication.Proxy;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.util.StringUtil;
-
-/**
- * <p>
- * Converts web application links to links which will be sent to the browser by using the
- * publication's proxy settings. If the current request is SSL-encrypted, all link URLs will use the
- * SSL proxy.
- * </p>
- * <p>
- * Objects of this class are not thread-safe.
- * </p>
- */
-public class OutgoingLinkRewriter extends ServletLinkRewriter {
-
- private boolean relativeUrls;
- private PolicyManager policyManager;
- private AccreditableManager accreditableManager;
- private DocumentFactory factory;
- private boolean ssl;
- private GlobalProxies globalProxies;
- private boolean considerSslPolicies;
-
- /**
- * @param manager The service manager to use.
- * @param session The current session.
- * @param requestUrl The request URL where the links should be rewritten.
- * @param ssl If the current page is SSL-encrypted.
- * @param considerSslPolicies If the SSL protection of policies should be considered when
- * resolving the corresponding proxy. Setting this to <code>true</code> leads to a
- * substantial performance overhead.
- * @param relativeUrls If relative URLs should be created.
- */
- public OutgoingLinkRewriter(ServiceManager manager, Session session, String requestUrl,
- boolean ssl, boolean considerSslPolicies, boolean relativeUrls) {
-
- super(manager);
- this.requestUrl = requestUrl;
- this.relativeUrls = relativeUrls;
- this.ssl = ssl;
- this.considerSslPolicies = considerSslPolicies;
-
- ServiceSelector serviceSelector = null;
- AccessControllerResolver acResolver = null;
-
- try {
- this.factory = DocumentUtil.createDocumentFactory(this.manager, session);
-
- if (this.considerSslPolicies) {
- serviceSelector = (ServiceSelector) this.manager
- .lookup(AccessControllerResolver.ROLE + "Selector");
- acResolver = (AccessControllerResolver) serviceSelector
- .select(AccessControllerResolver.DEFAULT_RESOLVER);
- AccessController accessController = acResolver.resolveAccessController(requestUrl);
- if (accessController != null) {
- this.accreditableManager = accessController.getAccreditableManager();
- this.policyManager = accessController.getPolicyManager();
- }
- }
-
- Publication[] pubs = this.factory.getPublications();
- for (int i = 0; i < pubs.length; i++) {
- this.publicationCache.put(pubs[i].getId(), pubs[i]);
- }
-
- } catch (final Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (serviceSelector != null) {
- if (acResolver != null) {
- serviceSelector.release(acResolver);
- }
- this.manager.release(serviceSelector);
- }
- }
- }
-
- protected GlobalProxies getGlobalProxies() {
- if (this.globalProxies == null) {
- try {
- this.globalProxies = (GlobalProxies) this.manager.lookup(GlobalProxies.ROLE);
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- }
- }
- return this.globalProxies;
- }
-
- public boolean matches(String url) {
- return url.startsWith("/");
- }
-
- private Map publicationCache = new HashMap();
-
- protected Publication getPublication(String pubId) throws PublicationException {
- return (Publication) this.publicationCache.get(pubId);
- }
-
- public String rewrite(final String url) {
-
- String rewrittenUrl = "";
-
- try {
- String normalizedUrl = normalizeUrl(url);
- if (this.relativeUrls) {
- rewrittenUrl = getRelativeUrlTo(normalizedUrl);
- } else {
- boolean useSsl = this.ssl;
- if (!useSsl && this.policyManager != null) {
- Policy policy = this.policyManager.getPolicy(this.accreditableManager,
- normalizedUrl);
- useSsl = policy.isSSLProtected();
- }
-
- URLInformation info = new URLInformation(normalizedUrl);
- String pubId = info.getPublicationId();
-
- Publication pub = null;
- if (pubId != null) {
- pub = getPublication(pubId);
- }
-
- // link points to publication
- if (pub != null) {
- rewrittenUrl = rewriteLink(normalizedUrl, pub, useSsl);
- }
-
- // link doesn't point to publication
- else {
- Proxy proxy = getGlobalProxies().getProxy(ssl);
- rewrittenUrl = proxy.getUrl() + normalizedUrl;
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return rewrittenUrl;
- }
-
- protected String normalizeUrl(final String url) throws URISyntaxException {
- String normalizedUrl;
- if (url.indexOf("..") > -1) {
- normalizedUrl = new URI(url).normalize().toString();
- } else {
- normalizedUrl = url;
- }
- return normalizedUrl;
- }
-
- private String requestUrl;
-
- private Map pubId2areaList = new HashMap();
-
- /**
- * Checks if a publication has an area by using a cache for performance reasons.
- * @param pub The publication.
- * @param area The area name.
- * @return if the publication contains the area.
- */
- protected boolean hasArea(Publication pub, String area) {
- String pubId = pub.getId();
- List areas = (List) this.pubId2areaList.get(pubId);
- if (areas == null) {
- areas = Arrays.asList(pub.getAreaNames());
- this.pubId2areaList.put(pubId, areas);
- }
- return areas.contains(area);
- }
-
- /**
- * @param linkUrl The original link URL.
- * @param pub The publication to use for proxy resolving.
- * @param ssl If the URL uses SSL.
- * @return A link URL.
- */
- protected String rewriteLink(String linkUrl, Publication pub, boolean ssl) {
- URLInformation info = new URLInformation(linkUrl);
- String rewrittenUrl;
- String areaName = info.getArea();
-
- // valid area
- if (areaName != null && hasArea(pub, areaName)) {
- Proxy proxy = pub.getProxy(areaName, ssl);
- rewrittenUrl = proxy.getUrl() + info.getDocumentUrl();
- }
-
- // invalid area
- else {
- Proxy proxy = getGlobalProxies().getProxy(ssl);
- rewrittenUrl = proxy.getUrl() + linkUrl;
- }
- return rewrittenUrl;
- }
-
- protected String getRelativeUrlTo(String webappUrl) {
- String relativeUrl;
- if (this.requestUrl.equals(webappUrl)) {
- relativeUrl = getLastStep(webappUrl);
- }
- else {
- List sourceSteps = toList(this.requestUrl);
- List targetSteps = toList(webappUrl);
-
- while (!sourceSteps.isEmpty() && !targetSteps.isEmpty()
- && sourceSteps.get(0).equals(targetSteps.get(0))) {
- sourceSteps.remove(0);
- targetSteps.remove(0);
- }
-
- String prefix = "";
- if (targetSteps.isEmpty()) {
- prefix = generateUpDots(sourceSteps.size());
- }
- else if (sourceSteps.isEmpty()) {
- prefix = getLastStep(this.requestUrl) + "/";
- }
- else if (sourceSteps.size() > 1) {
- prefix = generateUpDots(sourceSteps.size() - 1) + "/";
- }
-
- String[] targetArray = (String[]) targetSteps.toArray(new String[targetSteps.size()]);
- String targetPath = StringUtil.join(targetArray, "/");
- relativeUrl = prefix + targetPath;
- }
- return relativeUrl;
- }
-
- protected String getLastStep(String url) {
- return url.substring(url.lastIndexOf("/") + 1);
- }
-
- protected String generateUpDots(int length) {
- String upDots;
- String[] upDotsArray = new String[length];
- Arrays.fill(upDotsArray, "..");
- upDots = StringUtil.join(upDotsArray, "/");
- return upDots;
- }
-
- protected List toList(String url) {
- return new ArrayList(Arrays.asList(url.substring(1).split("/", -1)));
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/ServletLinkRewriter.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/ServletLinkRewriter.java
deleted file mode 100644
index 80374af..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/ServletLinkRewriter.java
+++ /dev/null
@@ -1,58 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
-
-/**
- * Abstract base class for servlet-oriented link rewriters.
- */
-public abstract class ServletLinkRewriter implements LinkRewriter {
-
- protected ServiceManager manager;
-
- /**
- * @param manager The service manager.
- */
- public ServletLinkRewriter(ServiceManager manager) {
- this.manager = manager;
- }
-
- private String contextPath;
-
- protected String getContextPath() {
- if (this.contextPath == null) {
- ContextUtility context = null;
- try {
- context = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
- this.contextPath = context.getRequest().getContextPath();
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- }
- finally {
- if (context != null) {
- this.manager.release(context);
- }
- }
- }
- return this.contextPath;
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/UrlToUuidRewriter.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/UrlToUuidRewriter.java
deleted file mode 100644
index 39a0b38..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/UrlToUuidRewriter.java
+++ /dev/null
@@ -1,111 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import org.apache.lenya.cms.publication.Area;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-
-/**
- * <p>
- * Converts webapp URLs to UUID-based internal links. If the URL
- * doesn't refer to a document, the original URL is returned.
- * </p>
- * <p>
- * Objects of this class are not thread-safe.
- * </p>
- */
-public class UrlToUuidRewriter implements LinkRewriter {
-
- private Area area;
-
- /**
- * @param area The area to operate in.
- */
- public UrlToUuidRewriter(Area area) {
- this.area = area;
- }
-
- public boolean matches(String url) {
- return url.startsWith("/" + this.area.getPublication().getId() + "/" + this.area.getName());
- }
-
- public String rewrite(String webappUrl) {
-
- String anchor = null;
- String url = null;
-
- int anchorIndex = webappUrl.indexOf("#");
- if (anchorIndex > -1) {
- url = webappUrl.substring(0, anchorIndex);
- anchor = webappUrl.substring(anchorIndex + 1);
- } else {
- url = webappUrl;
- }
-
- String[] linkUrlAndQuery = url.split("\\?");
- String linkUrl = linkUrlAndQuery[0];
- String queryString = null;
- if (linkUrlAndQuery.length > 1) {
- queryString = linkUrlAndQuery[1];
- }
-
- DocumentFactory factory = this.area.getPublication().getFactory();
-
- String rewrittenUrl;
-
- try {
- if (factory.isDocument(linkUrl)) {
- Document targetDocument = factory.getFromURL(linkUrl);
- rewrittenUrl = getUuidBasedUri(targetDocument, anchor, queryString);
- } else {
- rewrittenUrl = webappUrl;
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return rewrittenUrl;
- }
-
- /**
- * Rewrites a link.
- *
- * @param targetDocument The target document.
- * @param anchor The anchor (the string after the # character in the URL).
- * @param queryString The query string without question mark.
- * @return A UUID-based link URI.
- */
- protected String getUuidBasedUri(Document targetDocument, String anchor, String queryString) {
-
- Link link = new Link();
- link.setUuid(targetDocument.getUUID());
-
- String linkUri = link.getUri();
-
- if (anchor != null) {
- linkUri += "#" + anchor;
- }
-
- if (queryString != null) {
- linkUri += "?" + queryString;
- }
-
- return linkUri;
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/impl/GlobalProxiesImpl.java b/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/impl/GlobalProxiesImpl.java
deleted file mode 100644
index 68f34a2..0000000
--- a/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/linking/impl/GlobalProxiesImpl.java
+++ /dev/null
@@ -1,96 +0,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.
- *
- */
-package org.apache.lenya.cms.linking.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
-import org.apache.lenya.cms.linking.GlobalProxies;
-import org.apache.lenya.cms.publication.Proxy;
-
-/**
- * GlobalProxy service implementation.
- * The class is implemented as a singleton.
- */
-public class GlobalProxiesImpl extends AbstractLogEnabled implements GlobalProxies, Serviceable,
- ThreadSafe, Configurable {
-
- private Map ssl2proxy = new HashMap();
- private ServiceManager manager;
-
- public Proxy getProxy(boolean ssl) {
- Object key = Boolean.valueOf(ssl);
- Proxy proxy = (Proxy) this.ssl2proxy.get(key);
- if (proxy == null) {
- proxy = initializeProxy(key);
- }
- return proxy;
- }
-
- protected synchronized Proxy initializeProxy(Object key) {
- Proxy proxy;
- proxy = new Proxy();
- ContextUtility context = null;
- try {
- context = (ContextUtility) manager.lookup(ContextUtility.ROLE);
- proxy.setUrl(context.getRequest().getContextPath());
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- }
- finally {
- if (context != null) {
- this.manager.release(context);
- }
- }
- this.ssl2proxy.put(key, proxy);
- return proxy;
- }
-
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
- public void configure(Configuration config) throws ConfigurationException {
- Configuration[] proxyConfigs = config.getChildren("proxy");
- for (int p = 0; p < proxyConfigs.length; p++) {
- boolean ssl = proxyConfigs[p].getAttributeAsBoolean("ssl");
- String url = proxyConfigs[p].getAttribute("url");
- Proxy proxy = new Proxy();
- proxy.setUrl(url);
- setProxy(ssl, proxy);
- }
- }
-
- /**
- * @param ssl If the proxy is responsible for SSL requests.
- * @param proxy A proxy.
- */
- public void setProxy(boolean ssl, Proxy proxy) {
- this.ssl2proxy.put(Boolean.valueOf(ssl), proxy);
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/test/org/apache/lenya/cms/cocoon/transformation/ProxyTransformerTest.java b/trunk/src/modules-core/linking/java/test/org/apache/lenya/cms/cocoon/transformation/ProxyTransformerTest.java
deleted file mode 100644
index a60c3a7..0000000
--- a/trunk/src/modules-core/linking/java/test/org/apache/lenya/cms/cocoon/transformation/ProxyTransformerTest.java
+++ /dev/null
@@ -1,177 +0,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.
- *
- */
-package org.apache.lenya.cms.cocoon.transformation;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.components.serializers.XHTMLSerializer;
-import org.apache.cocoon.components.source.SourceResolverAdapter;
-import org.apache.excalibur.source.SourceNotFoundException;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.cocoon.source.SourceUtil;
-import org.apache.lenya.cms.linking.GlobalProxies;
-import org.apache.lenya.cms.linking.impl.GlobalProxiesImpl;
-import org.apache.lenya.cms.publication.Proxy;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.templating.Instantiator;
-import org.apache.lenya.xml.NamespaceHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-public class ProxyTransformerTest extends AbstractAccessControlTest {
-
- protected static final String PUBCONF_NAMESPACE = "http://apache.org/cocoon/lenya/publication/1.1";
-
- protected static final String NAMESPACE = XHTMLSerializer.XHTML1_NAMESPACE;
- protected static final String ELEMENT = "a";
- protected static final String ATTRIBUTE = "href";
-
- protected String getWebappUrl() {
- return "/default/authoring/index.html";
- }
-
- public void testProxyTransformer() throws Exception {
-
- ProxyTransformer transformer = new ProxyTransformer();
- transformer.enableLogging(getLogger());
- transformer.service(getManager());
-
- String pubId = "mock";
- String area = "authoring";
- String proxyUrl = "http://www.mock.org";
-
- createMockPublication(pubId, area, proxyUrl);
-
- Context context = this.context;
- Map objectModel = (Map) context.get(ContextHelper.CONTEXT_OBJECT_MODEL);
-
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);
- transformer.setup(new SourceResolverAdapter(resolver), objectModel, "",
- new Parameters());
-
- String documentUrl = "/index.html";
- String linkUrl = "/" + pubId + "/" + area + documentUrl;
- String targetUrl = proxyUrl + documentUrl;
- rewriteLink(transformer, linkUrl, targetUrl);
-
- String cssUrl = "/lenya/foo.css";
- rewriteLink(transformer, cssUrl, cssUrl);
-
- String moduleUrl = "/modules/foo/bar.html?x=y";
- rewriteLink(transformer, moduleUrl, moduleUrl);
-
- } finally {
- if (resolver != null) {
- getManager().release(resolver);
- }
- }
- }
-
- protected void rewriteLink(ProxyTransformer transformer, String linkUrl, String targetUrl) throws Exception {
- AttributesImpl attrs = new AttributesImpl();
- attrs.addAttribute("", ATTRIBUTE, ATTRIBUTE, "string", linkUrl);
-
- AbstractLinkTransformer.AttributeConfiguration config = new AbstractLinkTransformer.AttributeConfiguration(
- NAMESPACE, ELEMENT, ATTRIBUTE);
-
- transformer.handleLink(linkUrl, config, attrs);
-
- String rewrittenUrl = attrs.getValue(ATTRIBUTE);
- assertEquals(rewrittenUrl, targetUrl);
- }
-
- protected void createMockPublication(String pubId, String area, String proxyUrl)
- throws PublicationException, ServiceException, Exception {
- if (!existsPublication(pubId)) {
-
- Publication defaultPub = getPublication("default");
- Instantiator instantiator = null;
- ServiceSelector selector = null;
- try {
- selector = (ServiceSelector) getManager().lookup(Instantiator.ROLE + "Selector");
- instantiator = (Instantiator) selector.select(defaultPub.getInstantiatorHint());
- instantiator.instantiate(defaultPub, pubId, "Mock");
- configureProxy(area, proxyUrl);
- } finally {
- if (selector != null) {
- if (instantiator != null) {
- selector.release(instantiator);
- }
- getManager().release(selector);
- }
- }
- }
- }
-
- protected void configureProxy(String area, String proxyUrl)
- throws ServiceException, SourceNotFoundException, ParserConfigurationException,
- SAXException, IOException, TransformerConfigurationException, TransformerException,
- MalformedURLException {
- String configUri = "context://lenya/pubs/mock/config/publication.xml";
- Document dom = SourceUtil.readDOM(configUri, getManager());
- NamespaceHelper helper = new NamespaceHelper(PUBCONF_NAMESPACE, "", dom);
-
- Element proxies = helper.getFirstChild(dom.getDocumentElement(), "proxies");
- if (proxies == null) {
- proxies = helper.createElement("proxies");
- dom.getDocumentElement().appendChild(proxies);
- }
-
- addProxyElement(helper, proxies, area, proxyUrl, false);
- addProxyElement(helper, proxies, area, proxyUrl, true);
-
- SourceUtil.writeDOM(dom, configUri, getManager());
- }
-
- protected void addProxyElement(NamespaceHelper helper, Element proxies, String area,
- String proxyUrl, boolean ssl) {
- Element proxyElement = helper.createElement("proxy");
- proxyElement.setAttribute("ssl", Boolean.toString(ssl));
- proxyElement.setAttribute("area", area);
- proxyElement.setAttribute("url", proxyUrl);
- proxies.appendChild(proxyElement);
- }
-
- protected boolean existsPublication(String pubId) {
- Publication[] pubs = getFactory().getPublications();
- List pubIds = new ArrayList();
- for (int i = 0; i < pubs.length; i++) {
- pubIds.add(pubs[i].getId());
- }
- return pubIds.contains(pubId);
- }
-}
diff --git a/trunk/src/modules-core/linking/java/test/org/apache/lenya/cms/linking/LinkTest.java b/trunk/src/modules-core/linking/java/test/org/apache/lenya/cms/linking/LinkTest.java
deleted file mode 100644
index f87833a..0000000
--- a/trunk/src/modules-core/linking/java/test/org/apache/lenya/cms/linking/LinkTest.java
+++ /dev/null
@@ -1,78 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import java.util.Arrays;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.publication.Area;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.site.SiteStructure;
-
-/**
- * Test for link functionality.
- */
-public class LinkTest extends AbstractAccessControlTest {
-
- /**
- * Link test.
- * @throws Exception
- */
- public void testLinks() throws Exception {
-
- Publication pub = getPublication("test");
- Area area = pub.getArea("authoring");
- SiteStructure site = area.getSite();
-
- Document source = site.getNode("/index").getLink("en").getDocument();
- Document target = site.getNode("/tutorial").getLink("en").getDocument();
-
- LinkManager linkManager = null;
- LinkResolver resolver = null;
- try {
- linkManager = (LinkManager) getManager().lookup(LinkManager.ROLE);
- resolver = (LinkResolver) getManager().lookup(LinkResolver.ROLE);
-
- Link[] links = linkManager.getLinksFrom(source);
-
- boolean matched = false;
- for (int i = 0; i < links.length; i++) {
- LinkTarget linkTarget = resolver.resolve(source, links[i].getUri());
- if (linkTarget.exists() && linkTarget.getDocument().equals(target)) {
- matched = true;
- }
- }
-
- assertTrue(matched);
-
- Document[] references = linkManager.getReferencingDocuments(target);
- assertTrue(Arrays.asList(references).contains(source));
- }
- finally {
- if (linkManager != null) {
- getManager().release(linkManager);
- }
- if (resolver != null) {
- getManager().release(resolver);
- }
- }
-
- }
-
-}
diff --git a/trunk/src/modules-core/linking/java/test/org/apache/lenya/cms/linking/OutgoingLinkRewriterTest.java b/trunk/src/modules-core/linking/java/test/org/apache/lenya/cms/linking/OutgoingLinkRewriterTest.java
deleted file mode 100644
index 073b5e5..0000000
--- a/trunk/src/modules-core/linking/java/test/org/apache/lenya/cms/linking/OutgoingLinkRewriterTest.java
+++ /dev/null
@@ -1,39 +0,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.
- *
- */
-package org.apache.lenya.cms.linking;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.repository.Session;
-
-public class OutgoingLinkRewriterTest extends AbstractAccessControlTest {
-
- public void testRelativeUrls() throws Exception {
- Session session = login("lenya");
- String url = "/aaa/bbb/ccc";
- OutgoingLinkRewriter rewriter = new OutgoingLinkRewriter(getManager(), session, url, false, false, true);
-
- assertEquals(rewriter.rewrite("/aaa/bbb/foo"), "foo");
- assertEquals(rewriter.rewrite("/aaa/bbb"), "..");
- assertEquals(rewriter.rewrite("/aaa/bbb/ccc/ddd"), "ccc/ddd");
- assertEquals(rewriter.rewrite("/aaa/foo"), "../foo");
- assertEquals(rewriter.rewrite("/aaa/foo/bar"), "../foo/bar");
- assertEquals(rewriter.rewrite("/foo/bar"), "../../foo/bar");
- assertEquals(rewriter.rewrite("/aaa/foo/bar/baz"), "../foo/bar/baz");
- }
-
-}
diff --git a/trunk/src/modules-core/observation/config/cocoon-xconf/observation-registry.xconf b/trunk/src/modules-core/observation/config/cocoon-xconf/observation-registry.xconf
deleted file mode 100644
index ce8e9d3..0000000
--- a/trunk/src/modules-core/observation/config/cocoon-xconf/observation-registry.xconf
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-
- <xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.cms.observation.ObservationRegistry']">
- <component logger="lenya.observation.registry"
- class="org.apache.lenya.cms.observation.ObservationManager"
- role="org.apache.lenya.cms.observation.ObservationRegistry"/>
- </xconf>
diff --git a/trunk/src/modules-core/observation/config/module.xml b/trunk/src/modules-core/observation/config/module.xml
deleted file mode 100644
index fd88e5f..0000000
--- a/trunk/src/modules-core/observation/config/module.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.observation</id>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>Observation implementation</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>Observation implementation</description>
-</module>
diff --git a/trunk/src/modules-core/observation/java/src/org/apache/lenya/cms/observation/ObservationManager.java b/trunk/src/modules-core/observation/java/src/org/apache/lenya/cms/observation/ObservationManager.java
deleted file mode 100644
index cfeb902..0000000
--- a/trunk/src/modules-core/observation/java/src/org/apache/lenya/cms/observation/ObservationManager.java
+++ /dev/null
@@ -1,104 +0,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.
- *
- */
-package org.apache.lenya.cms.observation;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentIdentifier;
-import org.apache.lenya.util.Assert;
-
-/**
- * Observation manager. Works as an observation registry and sends the notifications.
- */
-public class ObservationManager extends AbstractLogEnabled implements ObservationRegistry,
- ThreadSafe {
-
- private Map identifier2listeners = new HashMap();
- private Set listeners = new HashSet();
-
- public synchronized void registerListener(RepositoryListener listener, Document doc)
- throws ObservationException {
- Set listeners = getListeners(doc.getIdentifier());
- if (listeners.contains(listener)) {
- throw new ObservationException("The listener [" + listener
- + "] is already registered for the document [" + doc + "].");
- }
- listeners.add(listener);
- }
-
- protected Set getListeners(DocumentIdentifier doc) {
- Set listeners = (Set) this.identifier2listeners.get(doc);
- if (listeners == null) {
- listeners = new HashSet();
- this.identifier2listeners.put(doc, listeners);
- }
- return listeners;
- }
-
- public synchronized void registerListener(RepositoryListener listener)
- throws ObservationException {
- if (this.listeners.contains(listener)) {
- throw new ObservationException("The listener [" + listener + "] is already registered.");
- }
- this.listeners.add(listener);
- }
-
- protected DocumentIdentifier getIdentifier(DocumentEvent event) {
-
- Assert.notNull("event", event);
- DocumentIdentifier id = new DocumentIdentifier(event.getPublicationId(), event.getArea(),
- event.getUuid(), event.getLanguage());
- return id;
- }
-
- protected Set getAllListeners(DocumentIdentifier doc) {
- Set allListeners = new HashSet();
- synchronized (this) {
- allListeners.addAll(this.listeners);
- allListeners.addAll(getListeners(doc));
- }
- return allListeners;
- }
-
- protected void notify(Set listeners, RepositoryEvent event) {
- for (Iterator i = listeners.iterator(); i.hasNext();) {
- RepositoryListener listener = (RepositoryListener) i.next();
- listener.eventFired(event);
- }
- }
-
- public void eventFired(RepositoryEvent event) {
- Assert.notNull("event", event);
- Set listeners;
- if (event instanceof DocumentEvent) {
- DocumentIdentifier id = getIdentifier((DocumentEvent) event);
- listeners = getAllListeners(id);
- } else {
- listeners = this.listeners;
- }
- notify(listeners, event);
- }
-
-}
diff --git a/trunk/src/modules-core/observation/java/test/org/apache/lenya/cms/observation/ObservationTest.java b/trunk/src/modules-core/observation/java/test/org/apache/lenya/cms/observation/ObservationTest.java
deleted file mode 100644
index 207e8f7..0000000
--- a/trunk/src/modules-core/observation/java/test/org/apache/lenya/cms/observation/ObservationTest.java
+++ /dev/null
@@ -1,127 +0,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.
- *
- */
-package org.apache.lenya.cms.observation;
-
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.xml.DocumentHelper;
-import org.apache.lenya.xml.NamespaceHelper;
-
-public class ObservationTest extends AbstractAccessControlTest {
-
- public void testObservation() throws Exception {
-
- Publication publication = getPublication("test");
- SiteStructure site = publication.getArea("authoring").getSite();
- Document doc = site.getNode("/index").getLink("en").getDocument();
-
- TestListener docListener = new TestListener();
- TestListener allListener = new TestListener();
-
- ObservationRegistry registry = null;
- try {
- registry = (ObservationRegistry) getManager().lookup(ObservationRegistry.ROLE);
-
- // check if it works if only the allListener is registered
- registry.registerListener(allListener);
- testChanged(doc, allListener);
-
- registry.registerListener(docListener, doc);
- Exception e = null;
- try {
- registry.registerListener(docListener, doc);
- }
- catch (ObservationException e1) {
- e = e1;
- }
- assertNotNull(e);
-
- testChanged(doc, docListener);
- testChanged(doc, allListener);
-
- testMetaDataChanged(doc, docListener);
- testMetaDataChanged(doc, allListener);
-
- }
- finally {
- if (registry != null) {
- getManager().release(registry);
- }
- }
-
-
- }
-
- protected void testChanged(Document doc, TestListener listener) throws Exception {
- listener.reset();
- org.w3c.dom.Document oldXml = DocumentHelper.readDocument(doc.getInputStream());
- NamespaceHelper xml = new NamespaceHelper("http://apache.org/lenya/test", "", "test");
- xml.save(doc.getOutputStream());
- DocumentHelper.writeDocument(oldXml, doc.getOutputStream());
-
- assertFalse(listener.wasChanged());
- doc.getRepositoryNode().getSession().commit();
- Thread.currentThread().sleep(100);
- assertTrue(listener.wasChanged());
- }
-
- protected void testMetaDataChanged(Document doc, TestListener listener) throws Exception {
- listener.reset();
-
- String mimeType = doc.getMimeType();
- doc.setMimeType("");
- doc.setMimeType(mimeType);
-
- assertFalse(listener.wasChanged());
- doc.getRepositoryNode().getSession().commit();
- Thread.currentThread().sleep(100);
- assertTrue(listener.wasChanged());
- }
-
- protected void testRemoved(Document doc, TestListener listener) throws Exception {
- listener.reset();
-
- DocumentManager docManager = null;
- try {
- docManager = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
- Document target = doc.getFactory().get(doc.getPublication(), doc.getArea(), "/testTarget", doc.getLanguage());
- docManager.move(doc, target.getLocator());
-
- assertFalse(listener.wasRemoved());
- doc.getRepositoryNode().getSession().commit();
- Thread.currentThread().sleep(100);
- assertTrue(listener.wasRemoved());
-
- docManager.move(target, doc.getLocator());
- assertFalse(listener.wasChanged());
- doc.getRepositoryNode().getSession().commit();
- Thread.currentThread().sleep(100);
- assertTrue(listener.wasChanged());
- }
- finally {
- if (docManager != null) {
- getManager().release(docManager);
- }
- }
-
- }
-
-}
diff --git a/trunk/src/modules-core/observation/java/test/org/apache/lenya/cms/observation/TestListener.java b/trunk/src/modules-core/observation/java/test/org/apache/lenya/cms/observation/TestListener.java
deleted file mode 100644
index f9dd8de..0000000
--- a/trunk/src/modules-core/observation/java/test/org/apache/lenya/cms/observation/TestListener.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- */
-package org.apache.lenya.cms.observation;
-
-public class TestListener implements RepositoryListener {
-
- private boolean changed = false;
- private boolean removed = false;
-
- public void eventFired(RepositoryEvent repoEvent) {
- if (!(repoEvent instanceof DocumentEvent)) {
- return;
- }
- DocumentEvent event = (DocumentEvent) repoEvent;
- if (event.getDescriptor().equals(DocumentEvent.CHANGED)) {
- this.changed = true;
- }
- else if (event.getDescriptor().equals(DocumentEvent.REMOVED)) {
- this.removed = true;
- }
- }
-
- public boolean wasChanged() {
- return this.changed;
- }
-
- public boolean wasRemoved() {
- return this.removed;
- }
-
- public void reset() {
- this.changed = false;
- this.removed = false;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/properties/config/cocoon-xconf/properties-input-module.xconf b/trunk/src/modules-core/properties/config/cocoon-xconf/properties-input-module.xconf
deleted file mode 100644
index a35c3ee..0000000
--- a/trunk/src/modules-core/properties/config/cocoon-xconf/properties-input-module.xconf
+++ /dev/null
@@ -1,27 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/input-modules" unless="/cocoon/input-modules/component-instance[@name = 'properties']">
- <component-instance logger="core.modules.input.properties" name="properties"
- class="org.apache.lenya.cms.cocoon.components.modules.input.PropertiesModule"/>
- </xconf>
diff --git a/trunk/src/modules-core/properties/config/module.xml b/trunk/src/modules-core/properties/config/module.xml
deleted file mode 100644
index 3643042..0000000
--- a/trunk/src/modules-core/properties/config/module.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.properties</id>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>Property system implementation</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>Property system implementation</description>
-</module>
diff --git a/trunk/src/modules-core/properties/java/lib/org.apache.forrest.plugin.output.inputModule-r431162.jar b/trunk/src/modules-core/properties/java/lib/org.apache.forrest.plugin.output.inputModule-r431162.jar
deleted file mode 100644
index a1fe65f..0000000
--- a/trunk/src/modules-core/properties/java/lib/org.apache.forrest.plugin.output.inputModule-r431162.jar
+++ /dev/null
Binary files differ
diff --git a/trunk/src/modules-core/properties/java/src/org/apache/lenya/cms/cocoon/components/modules/input/PropertiesModule.java b/trunk/src/modules-core/properties/java/src/org/apache/lenya/cms/cocoon/components/modules/input/PropertiesModule.java
deleted file mode 100644
index c0e7331..0000000
--- a/trunk/src/modules-core/properties/java/src/org/apache/lenya/cms/cocoon/components/modules/input/PropertiesModule.java
+++ /dev/null
@@ -1,324 +0,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.
- */
-package org.apache.lenya.cms.cocoon.components.modules.input;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-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.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.components.modules.input.DefaultsModule;
-import org.apache.cocoon.components.modules.input.InputModule;
-import org.apache.commons.lang.SystemUtils;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.forrest.conf.AntProperties;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.module.ModuleManager;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-/**
- * Input module for accessing the base properties used in Lenya. The main values
- * are the locations of the <b>source </b> directories and of the <b>Lenya </b>
- * directories.
- */
-public class PropertiesModule extends DefaultsModule implements InputModule,
- Initializable, ThreadSafe, Serviceable {
-
- private HashSet pubInit;
-
- private AntProperties filteringProperties;
-
- private SourceResolver m_resolver;
-
- private ModuleManager moduleManager;
-
- private ServiceManager serviceManager;
-
- private final static String lenyaHome = "context:/";
-
- private final static String DEFAULT_HOME_PROP = "lenya.home";
-
- private final static String PROPERTY_NAME = "lenya.properties.xml";
-
- private final static String PROPERTY_NAME_LOCAL = "local." + PROPERTY_NAME;
-
- public Object getAttribute(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- String attributeValue;
-
- loadPublicationPropertiesIfNotDone(objectModel);
- attributeValue = filteringProperties.getProperty(name);
- if (attributeValue == null) {
- String error = "Unable to get attribute value for "
- + name
- + ".\n"
- + "Please make sure you defined "
- + name
- + " in lenya.properties.xml either in $LENYA_HOME, $PUB_HOME or "
- + "in the module that is requesting this property.\n"
- + "If you see this message, most of the time you spotted a module bug "
- + "(forget to define the default property). Please report it to "
- + "our mailing list.";
- throw new ConfigurationException(error);
- }
-
- if (debugging()) {
- debug(" - Requested:" + name);
- debug(" - Given:" + attributeValue);
- }
-
- return attributeValue;
- }
-
- public Object[] getAttributeValues(String name, Configuration modeConf,
- Map objectModel) throws ConfigurationException {
- loadPublicationPropertiesIfNotDone(objectModel);
- Object[] attributeValues = super.getAttributeValues(name, modeConf,
- objectModel);
- for (int i = 0; i < attributeValues.length; i++) {
- attributeValues[i] = filteringProperties.filter(attributeValues[i]
- .toString());
- }
-
- return attributeValues;
- }
-
- public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- loadPublicationPropertiesIfNotDone(objectModel);
- SortedSet matchset = new TreeSet();
- Enumeration enumeration = filteringProperties.keys();
- while (enumeration.hasMoreElements()) {
- String key = (String) enumeration.nextElement();
- matchset.add(key);
- }
- Iterator iterator = super.getAttributeNames(modeConf, objectModel);
- while (iterator.hasNext())
- matchset.add(iterator.next());
- return matchset.iterator();
- }
-
- public void initialize() throws Exception {
-
- pubInit = new HashSet();
-
- // add all homes important to Lenya to the properties
- setHomes();
-
- loadSystemProperties(filteringProperties);
-
- // NOTE: the first values set get precedence, as in AntProperties
- //
- // Order of precedence:
- // 1. Publication (lazy loaded in loadPublicationPropertiesIfNotDone())
- // 2. Lenya local
- // 3. Modules (all modules, not only the ones referenced in the publication)
- // 4. Lenya
- //
- String lenyaPropertiesStringURI = "";
-
- try {
- // get the values from local.lenya.properties.xml
- lenyaPropertiesStringURI = lenyaHome + SystemUtils.FILE_SEPARATOR
- + PROPERTY_NAME_LOCAL;
- filteringProperties = loadXMLPropertiesFromURI(filteringProperties,
- lenyaPropertiesStringURI, false);
-
- // get the values from all modules
- String[] module2src = moduleManager.getModuleIds();
- for (int i = 0; i < module2src.length; i++) {
- String id = module2src[i];
- Object value = moduleManager.getBaseURI(id);
- if (value != null) {
- lenyaPropertiesStringURI = value + SystemUtils.FILE_SEPARATOR
- + PROPERTY_NAME;
- filteringProperties = loadXMLPropertiesFromURI(
- filteringProperties, lenyaPropertiesStringURI, false);
- }
- }
- // get the values from lenya.properties.xml this are the default
- // lenya values
- lenyaPropertiesStringURI = lenyaHome + SystemUtils.FILE_SEPARATOR
- + PROPERTY_NAME;
- filteringProperties = loadXMLPropertiesFromURI(filteringProperties,
- lenyaPropertiesStringURI, false);
- } finally {
- if (debugging())
- debug("Loaded project lenya.properties.xml:" + filteringProperties);
- }
-
- }
-
- /**
- * Sets all Lenya related home locations such as - LenyaHome - projectHome -
- * contextHome
- *
- * @throws Exception
- */
- private void setHomes() throws Exception {
-
- filteringProperties = new AntProperties();
- filteringProperties.setProperty(DEFAULT_HOME_PROP, lenyaHome);
- }
-
- /**
- * Override any properties for which a system property exists
- */
- private void loadSystemProperties(AntProperties props) {
- for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
- String propName = (String) e.nextElement();
- String systemPropValue = System.getProperty(propName);
- if (systemPropValue != null) {
- overwriteProperty(props, propName, systemPropValue);
- }
- }
- }
-
- private void overwriteProperty(AntProperties props, String propName, String propValue) {
- //
- // AntProperties.setProperty doesn't let you override, so we
- // have to remove the property then add it again
- props.remove(propName);
- props.setProperty(propName, propValue);
- }
-
- /**
- * @param precedingProperties
- * @param propertiesStringURI
- * @param overwrite
- * @throws IOException
- * @throws MalformedURLException
- * @throws ParserConfigurationException
- * @throws SAXException
- */
- private AntProperties loadXMLPropertiesFromURI(AntProperties precedingProperties,
- String propertiesStringURI, boolean overwrite)
- throws MalformedURLException, IOException,
- ParserConfigurationException, SAXException {
-
- Source source = null;
- try {
-
- source = m_resolver.resolveURI(propertiesStringURI);
-
- if (source.exists()) {
-
- DocumentBuilderFactory factory = DocumentBuilderFactory
- .newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document document = builder.parse(source.getURI());
-
- NodeList nl = document.getElementsByTagName("property");
- if (nl != null && nl.getLength() > 0) {
- for (int i = 0; i < nl.getLength(); i++) {
- Element el = (Element) nl.item(i);
- if (overwrite == true) {
- overwriteProperty(filteringProperties, el.getAttribute("name"),
- el.getAttribute("value"));
- } else {
- filteringProperties.setProperty(el.getAttribute("name"),
- el.getAttribute("value"));
- }
- }
- }
-
- if (debugging())
- debug("Loaded:" + propertiesStringURI
- + filteringProperties.toString());
-
- }
-
- } finally {
- if (source != null) {
- m_resolver.release(source);
- }
- }
-
- return filteringProperties;
- }
-
- /**
- * Get the properties from the requested publication
- */
- private void loadPublicationPropertiesIfNotDone(Map objectModel)
- throws ConfigurationException {
- Publication pub;
- String pubId;
-
- try {
- pub = PublicationUtil.getPublication(serviceManager, objectModel);
- } catch (Exception e) {
- throw new ConfigurationException(e.getMessage());
- }
- pubId = pub.getId();
- if (pubInit.contains(pubId)) {
- return;
- }
- try {
- filteringProperties = loadXMLPropertiesFromURI(filteringProperties,
- PROPERTY_NAME, true);
- } catch (IOException e) {
- getLogger().warn("Could not load properties from pub \""+pubId+"\".\n"+e);
- } catch (Exception e) {
- throw new ConfigurationException(e.getMessage());
- }
- pubInit.add(pubId);
- }
-
- public void service(ServiceManager manager) throws ServiceException {
- this.serviceManager = manager;
- m_resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
- moduleManager = (ModuleManager) manager.lookup(ModuleManager.ROLE);
- }
-
- /**
- * Rocked science
- */
- private final boolean debugging() {
- return getLogger().isDebugEnabled();
- }
-
- /**
- * Rocked science
- *
- * @param debugString
- */
- private final void debug(String debugString) {
- getLogger().debug(debugString);
- }
-
-}
diff --git a/trunk/src/modules-core/properties/sitemap.xmap b/trunk/src/modules-core/properties/sitemap.xmap
deleted file mode 100644
index 57bd12e..0000000
--- a/trunk/src/modules-core/properties/sitemap.xmap
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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.
--->
-<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
- <map:components>
- <map:generators default="file">
- <map:generator name="module"
- src="org.apache.forrest.generation.ModuleGenerator"/>
- </map:generators>
- </map:components>
- <map:pipelines>
- <!-- ============================================================ -->
- <!-- input-module properties file -->
- <!-- ============================================================ -->
- <map:pipeline>
- <map:match pattern="input-module.*.properties.xml">
- <map:generate type="module">
- <map:parameter name="input-module" value="{1}"/>
- </map:generate>
- <map:serialize type="xml"/>
- </map:match>
- </map:pipeline>
- </map:pipelines>
-</map:sitemap>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-archive.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-archive.xconf
deleted file mode 100644
index 60bcc31..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-archive.xconf
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.archive']">
- <component-instance name="sitemanagement.archive" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Archive">
- <view uri="modules/sitemanagement/usecases/site/archive.jx"/>
- <exit usecase="tab.overview" />
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-changeLabel.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-changeLabel.xconf
deleted file mode 100644
index 89eae5b..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-changeLabel.xconf
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.changeLabel']">
- <component-instance name="sitemanagement.changeLabel" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.ChangeLabel">
- <view uri="modules/sitemanagement/usecases/site/changeLabel.jx"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-changeNodeID.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-changeNodeID.xconf
deleted file mode 100644
index 7a315a5..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-changeNodeID.xconf
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.changeNodeID']">
- <component-instance name="sitemanagement.changeNodeID" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.ChangeNodeID">
- <view uri="modules/sitemanagement/usecases/site/changeNodeID.jx"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-changeVisibility.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-changeVisibility.xconf
deleted file mode 100644
index 4e7fb1c..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-changeVisibility.xconf
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.changeVisibility']">
- <component-instance name="sitemanagement.changeVisibility" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.ChangeVisibility"/>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-copy.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-copy.xconf
deleted file mode 100644
index 6e2f6d2..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-copy.xconf
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.copy']">
- <component-instance name="sitemanagement.copy" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Copy">
- <view uri="modules/sitemanagement/usecases/site/copy.jx"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-create.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-create.xconf
deleted file mode 100644
index 65424f0..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-create.xconf
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.create']">
- <component-instance name="sitemanagement.create" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.CreateDocument">
- <view uri="modules/sitemanagement/usecases/site/create.jx"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-createLanguage.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-createLanguage.xconf
deleted file mode 100644
index 30fa589..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-createLanguage.xconf
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.createLanguage']">
- <component-instance name="sitemanagement.createLanguage" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.CreateLanguage">
- <view uri="modules/sitemanagement/usecases/site/createLanguage.jx"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-cut.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-cut.xconf
deleted file mode 100644
index 6ece025..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-cut.xconf
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.cut']">
- <component-instance name="sitemanagement.cut" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Cut">
- <view uri="modules/sitemanagement/usecases/site/cut.jx"/>
- <exit usecase="tab.overview" />
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-delete.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-delete.xconf
deleted file mode 100644
index 4fe07fa..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-delete.xconf
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.delete']">
- <component-instance name="sitemanagement.delete" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Delete">
- <view uri="modules/sitemanagement/usecases/site/delete.jx"/>
- <exit usecase="tab.overview" />
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-deleteLanguage.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-deleteLanguage.xconf
deleted file mode 100644
index 4e0c5d4..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-deleteLanguage.xconf
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.deleteLanguage']">
- <component-instance name="sitemanagement.deleteLanguage" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.DeleteLanguage">
- <view uri="modules/sitemanagement/usecases/site/deleteLanguage.jx"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-forceCheckIn.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-forceCheckIn.xconf
deleted file mode 100644
index 2336f12..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-forceCheckIn.xconf
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
-<xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.forceCheckIn']">
- <component-instance name="sitemanagement.forceCheckIn" logger="lenya.site"
- class="org.apache.lenya.cms.site.usecases.ForceCheckIn">
- <view uri="modules/sitemanagement/usecases/site/forceCheckIn.jx"/>
- </component-instance>
-</xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-paste.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-paste.xconf
deleted file mode 100644
index 81e6edf..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-paste.xconf
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.paste']">
- <component-instance name="sitemanagement.paste" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Paste">
- <view uri="modules/sitemanagement/usecases/site/paste.jx"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-restore.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-restore.xconf
deleted file mode 100644
index 0d0decc..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-restore.xconf
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.restore']">
- <component-instance name="sitemanagement.restore" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Restore">
- <view uri="modules/sitemanagement/usecases/site/restore.jx"/>
- <exit usecase="tab.overview" />
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-rollback.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-rollback.xconf
deleted file mode 100644
index 1fc3016..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/site/usecase-site-rollback.xconf
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'sitemanagement.rollback']">
- <component-instance name="sitemanagement.rollback" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Rollback">
- <parameter name="workflowEvent" value="edit"/>
- <exit usecase="tab.revisions" />
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/tabs.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/tabs.xconf
deleted file mode 100644
index 2862e6d..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/tabs.xconf
+++ /dev/null
@@ -1,43 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/gui-manager" unless="/cocoon/gui-manager/tab-group[@name = 'site']">
- <tab-group name="site">
- <tab name="overview" label="Overview" usecase="tab.overview"/>
- <tab name="meta" label="Meta" usecase="tab.meta"/>
- <tab name="assets" label="Assets" usecase="tab.assets"/>
- <tab name="workflow" label="Workflow" usecase="tab.workflow"/>
- <tab name="revisions" label="Revisions" usecase="tab.revisions"/>
- <tab name="acAuthoring" label="AC Auth" usecase="tab.acAuthoring">
- <parameter name="acArea" value="authoring"/>
- </tab>
- <tab name="acTrash" label="AC Trash" usecase="tab.acTrash">
- <parameter name="acArea" value="trash"/>
- </tab>
- <tab name="acArchive" label="AC Archive" usecase="tab.acArchive">
- <parameter name="acArea" value="archive"/>
- </tab>
- <tab name="acLive" label="AC Live" usecase="tab.acLive"/>
- <tab name="scheduler" label="Scheduler" usecase="tab.scheduler"/>
- </tab-group>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acArchive.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acArchive.xconf
deleted file mode 100644
index 65a43fb..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acArchive.xconf
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'tab.acArchive']">
- <component-instance name="tab.acArchive" logger="lenya.site" class="org.apache.lenya.cms.ac.usecases.AccessControl">
- <view uri="modules/sitemanagement/usecases/tab/acArchive.jx" menu="true">
- <tab group="site" name="acArchive"/>
- </view>
- <parameter name="acArea" value="archive"/>
- <exit usecase="tab.acArchive"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acAuthoring.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acAuthoring.xconf
deleted file mode 100644
index fe1afe8..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acAuthoring.xconf
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'tab.acAuthoring']">
- <component-instance name="tab.acAuthoring" logger="lenya.site" class="org.apache.lenya.cms.ac.usecases.AccessControl">
- <view uri="modules/sitemanagement/usecases/tab/acAuthoring.jx" menu="true">
- <tab group="site" name="acAuthoring"/>
- </view>
- <parameter name="acArea" value="authoring"/>
- <exit usecase="tab.acAuthoring"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acLive.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acLive.xconf
deleted file mode 100644
index 784e8df..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acLive.xconf
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'tab.acLive']">
- <component-instance name="tab.acLive" logger="lenya.site" class="org.apache.lenya.cms.ac.usecases.AccessControl">
- <view uri="modules/sitemanagement/usecases/tab/acLive.jx" menu="true">
- <tab group="site" name="acLive"/>
- </view>
- <parameter name="acArea" value="live"/>
- <exit usecase="tab.acLive"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acTrash.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acTrash.xconf
deleted file mode 100644
index 83ff95b..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-acTrash.xconf
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'tab.acTrash']">
- <component-instance name="tab.acTrash" logger="lenya.site" class="org.apache.lenya.cms.ac.usecases.AccessControl">
- <view uri="modules/sitemanagement/usecases/tab/acTrash.jx" menu="true">
- <tab group="site" name="acTrash"/>
- </view>
- <parameter name="acArea" value="trash"/>
- <exit usecase="tab.acTrash"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-assets.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-assets.xconf
deleted file mode 100644
index 8e3d2ed..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-assets.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'tab.assets']">
- <component-instance name="tab.assets" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Assets">
- <view uri="modules/sitemanagement/usecases/tab/assets.jx" menu="true">
- <tab group="site" name="assets"/>
- </view>
- <exit usecase="tab.assets"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-meta.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-meta.xconf
deleted file mode 100644
index 46c2744..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-meta.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'tab.meta']">
- <component-instance name="tab.meta" logger="lenya.site" class="org.apache.lenya.cms.metadata.usecases.Metadata">
- <view uri="modules/sitemanagement/usecases/tab/meta.jx" menu="true">
- <tab group="site" name="meta"/>
- </view>
- <exit usecase="tab.meta" />
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-overview.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-overview.xconf
deleted file mode 100644
index 937bb54..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-overview.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'tab.overview']">
- <component-instance name="tab.overview" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Overview">
- <view uri="modules/sitemanagement/usecases/tab/overview.jx" menu="true">
- <tab group="site" name="overview"/>
- </view>
- <exit usecase="tab.overview"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-revisions.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-revisions.xconf
deleted file mode 100644
index b58cd99..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-revisions.xconf
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'tab.revisions']">
- <component-instance name="tab.revisions" logger="lenya.site" class="org.apache.lenya.cms.site.usecases.Revisions">
- <view uri="modules/sitemanagement/usecases/tab/revisions.jx" menu="true">
- <tab group="site" name="revisions"/>
- </view>
- <parameter name="workflowEvent" value="edit"/>
- <exit usecase="tab.revisions"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-scheduler.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-scheduler.xconf
deleted file mode 100644
index 359079b..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-scheduler.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'tab.workflow']">
- <component-instance name="tab.scheduler" logger="lenya.site" class="org.apache.lenya.cms.usecase.scheduling.ManageJobs">
- <view uri="modules/sitemanagement/usecases/tab/scheduler.jx" menu="true">
- <tab group="site" name="scheduler"/>
- </view>
- <exit usecase="tab.scheduler"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-workflow.xconf b/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-workflow.xconf
deleted file mode 100644
index bf0cfc1..0000000
--- a/trunk/src/modules-core/sitemanagement/config/cocoon-xconf/tab/usecase-tab-workflow.xconf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'tab.workflow']">
- <component-instance name="tab.workflow" logger="lenya.site" class="org.apache.lenya.cms.workflow.usecases.History">
- <view uri="modules/sitemanagement/usecases/tab/workflow.jx" menu="true">
- <tab group="site" name="workflow"/>
- </view>
- <exit usecase="tab.workflow"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/sitemanagement/config/module.xml b/trunk/src/modules-core/sitemanagement/config/module.xml
deleted file mode 100644
index 9df48c9..0000000
--- a/trunk/src/modules-core/sitemanagement/config/module.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.sitemanagement</id>
- <export package="org.apache.lenya.cms.site.usecases"/>
- <depends module="org.apache.lenya.modules.usecase"/>
- <depends module="org.apache.lenya.modules.workflow"/>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>Site management</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>Site management usecases</description>
-</module>
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/metadata/usecases/Metadata.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/metadata/usecases/Metadata.java
deleted file mode 100644
index 8c977ee..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/metadata/usecases/Metadata.java
+++ /dev/null
@@ -1,184 +0,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.
- *
- */
-package org.apache.lenya.cms.metadata.usecases;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.lenya.cms.metadata.Element;
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.metadata.MetaDataRegistry;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.site.usecases.SiteUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-import org.apache.lenya.cms.workflow.WorkflowUtil;
-import org.apache.lenya.cms.workflow.usecases.UsecaseWorkflowHelper;
-
-/**
- * Usecase to edit metadata for a resource.
- *
- * @version $Id$
- */
-public class Metadata extends SiteUsecase {
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
- */
- protected Node[] getNodesToLock() throws UsecaseException {
- Node[] objects = new Node[0];
- if(getSourceDocument() != null) {
- objects = new Node[] { getSourceDocument().getRepositoryNode() };
- }
- return objects;
- }
-
- public static class MetaDataWrapper {
-
- private String[] values;
- private Element element;
-
- public MetaDataWrapper(Element element, String[] values) {
- this.values = values;
- this.element = element;
- }
-
- public String[] getValues() {
- return this.values;
- }
-
- public Element getElement() {
- return this.element;
- }
-
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- if (getSourceDocument() == null) {
- return;
- }
-
- MetaDataRegistry registry = null;
- try {
- registry = (MetaDataRegistry) this.manager.lookup(MetaDataRegistry.ROLE);
-
- List numbers = new ArrayList();
- Map num2namespace = new HashMap();
- List keyList = new ArrayList();
-
- String[] namespaces = registry.getNamespaceUris();
-
- for (int nsIndex = 0; nsIndex < namespaces.length; nsIndex++) {
- MetaData meta = getSourceDocument().getMetaData(namespaces[nsIndex]);
- String[] keys = meta.getPossibleKeys();
- for (int keyIndex = 0; keyIndex < keys.length; keyIndex++) {
- String key = "ns" + nsIndex + "." + keys[keyIndex];
- String[] values = meta.getValues(keys[keyIndex]);
- Element element = meta.getElementSet().getElement(keys[keyIndex]);
- setParameter(key, new MetaDataWrapper(element, values));
- keyList.add(key);
- }
- numbers.add("" + nsIndex);
- num2namespace.put("" + nsIndex, namespaces[nsIndex]);
- }
-
- setParameter("numbers", numbers);
- setParameter("namespaces", num2namespace);
-
- Collections.sort(keyList);
- setParameter("keys", keyList);
-
- } catch (Exception e) {
- getLogger().error("Unable to load meta data.", e);
- addErrorMessage("Unable to load meta data: " + e.getMessage());
- } finally {
- if (registry != null) {
- this.manager.release(registry);
- }
- }
-
- }
-
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
- Document doc = getSourceDocument();
- if (doc == null) {
- return;
- }
-
- if (!doc.getArea().equals(Publication.AUTHORING_AREA)) {
- addErrorMessage("This usecase can only be invoked in the authoring area!");
- }
- UsecaseWorkflowHelper.checkWorkflow(this.manager, this, getEvent(), doc,
- getLogger());
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- // we need a reverse lookup to get the correct ns index:
- Map num2namespace = (Map) getParameter("namespaces");
- Map namespace2num = new HashMap();
-
- Iterator iter = num2namespace.keySet().iterator();
- while (iter.hasNext()) {
- String key = (String) iter.next();
- namespace2num.put(num2namespace.get(key), key);
- }
-
- Document document = getSourceDocument();
- String[] namespaces = document.getMetaDataNamespaceUris();
-
- for (int nsIndex = 0; nsIndex < namespaces.length; nsIndex++) {
- MetaData meta = document.getMetaData(namespaces[nsIndex]);
- String orgNsIndex = (String) namespace2num.get(namespaces[nsIndex]);
-
- String[] keys = meta.getPossibleKeys();
- for (int keyIndex = 0; keyIndex < keys.length; keyIndex++) {
- String key = keys[keyIndex];
- Element element = meta.getElementSet().getElement(key);
- if (element.isEditable()) {
- Object value = getParameter("ns" + orgNsIndex + "." + key);
- if (value != null && value instanceof String) {
- meta.setValue(key, (String) value);
- }
- }
- }
- }
-
- WorkflowUtil.invoke(this.manager, getSession(), getLogger(), document, getEvent());
- }
-
- protected String getEvent() {
- return "edit";
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Archive.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Archive.java
deleted file mode 100644
index f0c1247..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Archive.java
+++ /dev/null
@@ -1,51 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * Archive usecase handler.
- *
- * @version $Id:$
- */
-public class Archive extends MoveSubsite {
-
- /**
- * @see org.apache.lenya.cms.site.usecases.MoveSubsite#getSourceAreas()
- */
- protected String[] getSourceAreas() {
- return new String[] { Publication.AUTHORING_AREA };
- }
-
- /**
- * @see org.apache.lenya.cms.site.usecases.MoveSubsite#getTargetArea()
- */
- protected String getTargetArea() {
- return Publication.ARCHIVE_AREA;
- }
-
- /**
- * @see org.apache.lenya.cms.site.usecases.MoveSubsite#getEvent()
- */
- protected String getEvent() {
- return "archive";
- }
-
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Assets.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Assets.java
deleted file mode 100644
index 89d09aa..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Assets.java
+++ /dev/null
@@ -1,65 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteNode;
-
-/**
- * Usecase to add Assets to a resource.
- *
- * @version $Id$
- */
-public class Assets extends SiteUsecase {
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- if (getSourceDocument() != null) {
- try {
- Document[] resourceDocs = getResourceDocuments();
- setParameter("resourceDocuments", resourceDocs);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- protected Document[] getResourceDocuments() throws DocumentException, SiteException {
- List list = new ArrayList();
- Document[] docs = getSourceDocument().area().getDocuments();
- SiteNode node = getSourceDocument().getLink().getNode();
- for (int i = 0; i < docs.length; i++) {
- if (docs[i].hasLink() && !docs[i].getLink().getNode().isTopLevel()
- && docs[i].getLink().getNode().getParent().getPath().equals(node.getPath())
- && docs[i].getResourceType().getName().equals("resource")) {
- list.add(docs[i]);
- }
- }
- return (Document[]) list.toArray(new Document[list.size()]);
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeLabel.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeLabel.java
deleted file mode 100644
index c5e08cb..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeLabel.java
+++ /dev/null
@@ -1,118 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.usecase.DocumentUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-import org.apache.lenya.cms.workflow.WorkflowUtil;
-import org.apache.lenya.cms.workflow.usecases.UsecaseWorkflowHelper;
-
-/**
- * Change the label of a document.
- *
- * @version $Id$
- */
-public class ChangeLabel extends DocumentUsecase {
-
- protected static final String LABEL = "label";
- protected static final String DOCUMENT_ID = "documentId";
-
- protected String getEvent() {
- return "edit";
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
- */
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
- if (hasErrors()) {
- return;
- }
-
- Document doc = getSourceDocument();
- if (!getSourceDocument().getArea().equals(Publication.AUTHORING_AREA)) {
- addErrorMessage("This usecase can only be invoked in the authoring area!");
- }
-
- UsecaseWorkflowHelper.checkWorkflow(this.manager, this, getEvent(), doc,
- getLogger());
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
- */
- protected Node[] getNodesToLock() throws UsecaseException {
- List nodes = new ArrayList();
- if(getSourceDocument() != null) {
- SiteStructure structure = getSourceDocument().area().getSite();
- nodes.add(structure.getRepositoryNode());
- }
-
- return (Node[]) nodes.toArray(new Node[nodes.size()]);
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
- Document document = getSourceDocument();
- try {
- if (document != null && document.exists()) {
- setParameter(DOCUMENT_ID, document.getUUID());
- setParameter(LABEL, document.getLink().getLabel());
- }
- } catch (final DocumentException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- String label = getParameterAsString(LABEL);
- if (label.trim().equals("")) {
- addErrorMessage("missing-navigation-title");
- }
- }
-
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- Document document = getSourceDocument();
- String label = getParameterAsString(LABEL).trim();
- document.getLink().setLabel(label);
-
- WorkflowUtil.invoke(this.manager, getSession(), getLogger(), document, getEvent());
-
- }
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeNodeID.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeNodeID.java
deleted file mode 100644
index 3e20641..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeNodeID.java
+++ /dev/null
@@ -1,193 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentBuilder;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.site.NodeIterator;
-import org.apache.lenya.cms.site.NodeSet;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteNode;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.site.SiteUtil;
-import org.apache.lenya.cms.usecase.DocumentUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-import org.apache.lenya.transaction.TransactionException;
-
-/**
- * Change the node ID of a document.
- *
- * @version $Id$
- */
-public class ChangeNodeID extends DocumentUsecase {
-
- protected static final String NODE_ID = "nodeId";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
- Document document = getSourceDocument();
- if (document != null) {
- setParameter(NODE_ID, document.getName());
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
- */
- protected Node[] getNodesToLock() throws UsecaseException {
-
- List nodes = new ArrayList();
-
- try {
- if(getSourceDocument() != null) {
- Node siteNode = getSourceDocument().area().getSite().getRepositoryNode();
- nodes.add(siteNode);
-
- Document sourceDocument = getSourceDocument();
-
- NodeSet subsite = SiteUtil.getSubSite(this.manager, sourceDocument.getLink().getNode());
- for (NodeIterator i = subsite.ascending(); i.hasNext();) {
- SiteNode node = i.next();
- String[] languages = node.getLanguages();
- for (int l = 0; l < languages.length; l++) {
- Document doc = node.getLink(languages[l]).getDocument();
- nodes.add(doc.getRepositoryNode());
- }
- }
- }
- } catch (Exception e) {
- throw new UsecaseException(e);
- }
-
- return (Node[]) nodes.toArray(new Node[nodes.size()]);
- }
-
- protected List getAllLanguageVersionNodes(Document doc) throws DocumentException,
- TransactionException, DocumentBuildException {
- String[] languages = doc.getLanguages();
- List nodes = new ArrayList();
- for (int i = 0; i < languages.length; i++) {
- nodes.add(doc.getTranslation(languages[i]).getRepositoryNode());
- }
- return nodes;
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
- */
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
- if (hasErrors()) {
- return;
- }
-
- if (!getSourceDocument().getArea().equals(Publication.AUTHORING_AREA)) {
- addErrorMessage("This usecase can only be invoked in the authoring area!");
- } else {
- if (getSourceDocument().existsAreaVersion(Publication.LIVE_AREA)) {
- addErrorMessage("This usecase cannot be invoked when the live version exists!");
- }
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- super.doCheckExecutionConditions();
-
- String nodeId = getParameterAsString(NODE_ID);
- DocumentBuilder builder = getSourceDocument().getPublication().getDocumentBuilder();
- if (!builder.isValidDocumentName(nodeId)) {
- addErrorMessage("The document ID is not valid.");
- } else {
- DocumentLocator target = getTargetLocator();
- Publication pub = getDocumentFactory().getPublication(target.getPublicationId());
- SiteStructure site = pub.getArea(target.getArea()).getSite();
- if (site.contains(target.getPath(), target.getLanguage())) {
- addErrorMessage("The document does already exist.");
- }
- }
- }
-
- protected DocumentLocator getTargetLocator() throws DocumentBuildException, SiteException,
- DocumentException {
- String nodeId = getParameterAsString(NODE_ID);
- Document doc = getSourceDocument();
- DocumentLocator loc = DocumentLocator.getLocator(doc.getPublication().getId(), doc
- .getArea(), doc.getPath(), doc.getLanguage());
- DocumentLocator parent = loc.getParent();
- return parent.getChild(nodeId);
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- Document targetDoc;
- Document source = getSourceDocument();
- DocumentLocator target = getTargetLocator();
- DocumentManager documentManager = null;
- try {
- documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
- documentManager.moveAll(source.area(), source.getPath(), source.area(), target
- .getPath());
- targetDoc = getDocumentFactory().get(target);
- } finally {
- if (documentManager != null) {
- this.manager.release(documentManager);
- }
- }
-
- setTargetDocument(targetDoc);
- }
-
- /**
- * Returns the resulting document when the node ID would be changed.
- * @return A document.
- */
- protected String getNewDocumentId() {
- String nodeId = getParameterAsString(NODE_ID);
-
- String oldPath;
- try {
- oldPath = getSourceDocument().getPath();
- } catch (DocumentException e) {
- throw new RuntimeException(e);
- }
- int lastSlashIndex = oldPath.lastIndexOf("/");
- String strippedDocumentId = oldPath.substring(0, lastSlashIndex + 1);
- String newDocumentId = strippedDocumentId + nodeId;
-
- return newDocumentId;
- }
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeVisibility.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeVisibility.java
deleted file mode 100644
index b0454ce..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ChangeVisibility.java
+++ /dev/null
@@ -1,90 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.site.SiteNode;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.usecase.DocumentUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-import org.apache.lenya.cms.workflow.WorkflowUtil;
-import org.apache.lenya.cms.workflow.usecases.UsecaseWorkflowHelper;
-
-/**
- * Switch the navigation visibility of a document.
- */
-public class ChangeVisibility extends DocumentUsecase {
-
- protected String getEvent() {
- return "edit";
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
- */
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
- if (hasErrors()) {
- return;
- }
-
- Document doc = getSourceDocument();
- if (!getSourceDocument().getArea().equals(Publication.AUTHORING_AREA)) {
- addErrorMessage("This usecase can only be invoked in the authoring area!");
- }
-
- String[] languages = doc.getLanguages();
- for (int i = 0; i < languages.length; i++) {
- Document version = doc.getTranslation(languages[i]);
- UsecaseWorkflowHelper.checkWorkflow(this.manager, this, getEvent(), version,
- getLogger());
- }
- }
-
- protected void doExecute() throws Exception {
- super.doExecute();
- Document doc = getSourceDocument();
- SiteNode node = doc.getLink().getNode();
- node.setVisible(!node.isVisible());
-
- String[] languages = doc.getLanguages();
- for (int i = 0; i < languages.length; i++) {
- Document version = doc.getTranslation(languages[i]);
- WorkflowUtil.invoke(this.manager, getSession(), getLogger(), version, getEvent());
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
- */
- protected Node[] getNodesToLock() throws UsecaseException {
- List nodes = new ArrayList();
- if(getSourceDocument() != null) {
- SiteStructure structure = getSourceDocument().area().getSite();
- nodes.add(structure.getRepositoryNode());
- }
-
- return (Node[]) nodes.toArray(new Node[nodes.size()]);
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Clipboard.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Clipboard.java
deleted file mode 100644
index f774dcb..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Clipboard.java
+++ /dev/null
@@ -1,88 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * Clipboard for cut/copy/paste of documents. The clipping method is either {@link #METHOD_CUT} or
- * {@link #METHOD_COPY}.
- *
- * @version $Id$
- */
-public class Clipboard {
-
- private String publicationId;
- private String area;
- private String uuid;
- private String language;
- private int method;
-
- /**
- * The "cut" method.
- */
- public static final int METHOD_CUT = 0;
-
- /**
- * The "copy" method.
- */
- public static final int METHOD_COPY = 1;
-
- /**
- * Ctor.
- * @param document The document to put on the clipboard.
- * @param _method The clipping method.
- */
- public Clipboard(Document document, int _method) {
- this.publicationId = document.getPublication().getId();
- this.area = document.getArea();
- this.uuid = document.getUUID();
- this.language = document.getLanguage();
- this.method = _method;
- }
-
- /**
- * Returns the document for the current identity map.
- * @param identityMap The identity map.
- * @param publication The publication.
- * @return A document.
- * @throws DocumentBuildException if the document could not be built.
- */
- public Document getDocument(DocumentFactory identityMap, Publication publication) throws DocumentBuildException {
- Document document = identityMap.get(publication, this.area, this.uuid, this.language);
- return document;
- }
-
- /**
- * @return The ID of the publication the document belongs to.
- */
- public String getPublicationId() {
- return this.publicationId;
- }
-
- /**
- * Returns the method of this clipboard.
- * @return An integer.
- */
- public int getMethod() {
- return this.method;
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ClipboardHelper.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ClipboardHelper.java
deleted file mode 100644
index 512aa0e..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ClipboardHelper.java
+++ /dev/null
@@ -1,84 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.Map;
-
-import org.apache.avalon.framework.context.Context;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Session;
-
-/**
- * Helper class for clipboard handling.
- *
- * @version $Id$
- */
-public class ClipboardHelper {
-
- /**
- * Returns the clipboard attachted to the session.
- * @param context The context containing the session.
- * @return A clipboard or <code>null</code> if no clipboard is attached to
- * the session.
- */
- public Clipboard getClipboard(Context context) {
- Session session = getSession(context);
- Clipboard clipboard = (Clipboard) session.getAttribute(getSessionAttributeName());
- return clipboard;
- }
-
- /**
- * @return The name of the session attribute to hold the clipboard.
- */
- protected String getSessionAttributeName() {
- return Clipboard.class.getName();
- }
-
- /**
- * @param context The context.
- * @return The session of the context.
- */
- protected Session getSession(Context context) {
- Map objectModel = ContextHelper.getObjectModel(context);
- Request request = ObjectModelHelper.getRequest(objectModel);
- Session session = request.getSession(true);
- return session;
- }
-
- /**
- * Saves the clipboard to the session.
- * @param context The context.
- * @param clipboard The clipboard.
- */
- public void saveClipboard(Context context, Clipboard clipboard) {
- Session session = getSession(context);
- session.setAttribute(getSessionAttributeName(), clipboard);
- }
-
- /**
- * Removes the clipboard from the session.
- * @param context The context.
- */
- public void removeClipboard(Context context) {
- Session session = getSession(context);
- session.removeAttribute(getSessionAttributeName());
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Copy.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Copy.java
deleted file mode 100644
index 3f9b528..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Copy.java
+++ /dev/null
@@ -1,51 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.usecase.DocumentUsecase;
-
-/**
- * Copy a document into the clipboard.
- *
- * @version $Id$
- */
-public class Copy extends DocumentUsecase {
-
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
- if (hasErrors()) {
- return;
- }
- if (!getSourceDocument().getArea().equals(Publication.AUTHORING_AREA)) {
- addErrorMessage("only-in-authoring-area");
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- Clipboard clipboard = new Clipboard(getSourceDocument(), Clipboard.METHOD_COPY);
- ClipboardHelper helper = new ClipboardHelper();
- helper.saveClipboard(getContext(), clipboard);
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
deleted file mode 100644
index c722308..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Create.java
+++ /dev/null
@@ -1,419 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.GregorianCalendar;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Session;
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.metadata.MetaDataException;
-import org.apache.lenya.cms.metadata.dublincore.DublinCore;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.publication.ResourceType;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.usecase.AbstractUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-
-/**
- * <p>
- * Abstract superclass for usecases to create a document.
- * </p>
- * <p>
- * You can pass the following parameters into the usecase:
- * </p>
- * <ul>
- * <li><strong>path</strong> - the path of the document to create (optional)</li>
- * </ul>
- *
- * @version $Id$
- */
-public abstract class Create extends AbstractUsecase {
-
- protected static final String RESOURCE_TYPES = "resourceTypes";
- protected static final String LANGUAGE = "language";
- protected static final String LANGUAGES = "languages";
- protected static final String PATH = "path";
- protected static final String NODE_NAME = "nodeName";
- protected static final String VISIBLEINNAV = "visibleInNav";
- protected static final String SAMPLE = "sample";
- protected static final String SAMPLES = "samples";
-
- /**
- * Ctor.
- */
- public Create() {
- super();
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
- */
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
-
- if (!getArea().equals(Publication.AUTHORING_AREA)) {
- addErrorMessage("This usecase can only be invoked in the authoring area!");
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
- */
- protected Node[] getNodesToLock() throws UsecaseException {
- try {
- SiteStructure structure = getPublication().getArea(getArea()).getSite();
- Node[] nodes = { structure.getRepositoryNode() };
- return nodes;
- } catch (Exception e) {
- throw new UsecaseException(e);
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- String navigationTitle = getDublinCoreParameter(DublinCore.ELEMENT_TITLE);
- if (navigationTitle.trim().equals("")) {
- addErrorMessage("missing-navigation-title");
- }
-
- if (getInitialDocument() == null) {
- String[] samples = (String[]) getParameter(SAMPLES);
- String sample = getParameterAsString(SAMPLE);
- if (samples != null && samples.length > 1 && (sample == null || sample.equals(""))) {
- addErrorMessage("missing-page-layout");
- }
- }
-
- if (isPathValid()) {
- String path = getNewDocumentPath();
- SiteStructure site = getPublication().getArea(getArea()).getSite();
- if (!createVersion() && site.contains(path)) {
- String[] params = { path };
- addErrorMessage("path-already-exists", params);
- }
- }
-
- String doctypeName = getDocumentTypeName();
- if (getParameterAsString(SAMPLE) == null && doctypeName != null) {
- initSampleParameters();
- }
- }
-
- /**
- * This method is used by {@link #doCheckExecutionConditions()} to check if
- * the path entered by the user is valid. If not, checking the existence of
- * the new document in the site structure is omitted because this operation
- * could cause errors.
- * @return A boolean value.
- */
- protected boolean isPathValid() {
- return true;
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- // create new document
- DocumentManager documentManager = null;
- ServiceSelector selector = null;
- ResourceType resourceType = null;
- try {
-
- documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
-
- String language = getParameterAsString(LANGUAGE);
- Document initialDocument = getInitialDocument();
-
- Document document;
-
- String title = getDublinCoreParameter(DublinCore.ELEMENT_TITLE).trim();
-
- if (createVersion()) {
- document = documentManager.addVersion(initialDocument, getArea(), language, true);
- document.getLink().setLabel(title);
- } else {
- if (initialDocument == null) {
- selector = (ServiceSelector) this.manager
- .lookup(ResourceType.ROLE + "Selector");
- resourceType = (ResourceType) selector.select(getDocumentTypeName());
- String sampleName = getParameterAsString(SAMPLE, resourceType.getSampleNames()[0]);
- ResourceType.Sample sample = resourceType.getSample(sampleName);
- document = documentManager.add(getDocumentFactory(), resourceType, sample.getUri(),
- getPublication(), getArea(), getNewDocumentPath(), language,
- getSourceExtension(), title, getVisibleInNav());
- document.setMimeType(sample.getMimeType());
- } else {
- document = documentManager.add(initialDocument, getArea(),
- getNewDocumentPath(), language, getSourceExtension(), title,
- getVisibleInNav());
- }
- }
-
- setMetaData(document);
-
- // the location to navigate to after completion of usecase
- setDefaultTargetURL(document.getCanonicalWebappURL());
-
- } finally {
- if (documentManager != null) {
- this.manager.release(documentManager);
- }
- if (selector != null) {
- if (resourceType != null) {
- selector.release(resourceType);
- }
- this.manager.release(selector);
- }
- }
- }
-
- protected String getDublinCoreParameter(String name) {
- Object param = getParameter(DUBLIN_CORE_PREFIX + name);
- if (param != null && getParameter(DUBLIN_CORE_PREFIX + name).getClass().isArray()) {
- String[] values = (String[]) getParameter(DUBLIN_CORE_PREFIX + name);
- StringBuffer paramValue = new StringBuffer();
- for (int i = 0; i < values.length; i++) {
- String value = values[i];
- if (i > 0)
- paramValue.append(',').append(value);
- else
- paramValue.append(value);
- }
- return paramValue.toString();
- }
- return getParameterAsString(DUBLIN_CORE_PREFIX + name, null);
- }
-
- protected void setDublinCoreParameter(String name, String value) {
- setParameter(DUBLIN_CORE_PREFIX + name, value);
- }
-
- protected abstract boolean createVersion();
-
- /**
- * @return the extension to use for the document source.
- */
- protected abstract String getSourceExtension();
-
- /**
- * @return the name of the document being created in the usecase
- */
- protected abstract String getNewDocumentName();
-
- /**
- * @return the id of the new document being created in the usecase
- */
- protected abstract String getNewDocumentPath();
-
- /**
- * If the document created in the usecase shall have initial contents copied
- * from an existing document, construct that document in this method.
- *
- * @return A document.
- */
- protected Document getInitialDocument() {
- return null;
- }
-
- /**
- * @return The type of the created document.
- */
- protected abstract String getDocumentTypeName();
-
- protected static final String DUBLIN_CORE_PREFIX = "dublincore.";
-
- /**
- * Sets the meta data of the created document.
- *
- * @param document The document.
- * @throws MetaDataException if an error occurs.
- */
- protected void setMetaData(Document document) throws MetaDataException {
-
- if (document == null)
- throw new IllegalArgumentException("parameter document may not be null");
-
- MetaData dcMetaData = document.getMetaData(DublinCore.DC_NAMESPACE);
- String[] dcKeys = dcMetaData.getAvailableKeys();
-
- for (int i = 0; i < dcKeys.length; i++) {
- String param = getDublinCoreParameter(dcKeys[i]);
- if (param != null) {
- dcMetaData.setValue(dcKeys[i], param);
- }
- }
-
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- Map objectModel = ContextHelper.getObjectModel(getContext());
- Request request = ObjectModelHelper.getRequest(objectModel);
- Session session = request.getSession(false);
- Identity identity = (Identity) session.getAttribute(Identity.class.getName());
- User user = identity.getUser();
- if (user != null) {
- setDublinCoreParameter(DublinCore.ELEMENT_CREATOR, user.getId());
- } else {
- setDublinCoreParameter(DublinCore.ELEMENT_CREATOR, "");
- }
-
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- setDublinCoreParameter(DublinCore.ELEMENT_DATE, format.format(new GregorianCalendar()
- .getTime()));
-
- String doctypeName = getDocumentTypeName();
- if (doctypeName != null) {
- initSampleParameters();
- setParameter(RESOURCE_TYPES, Collections.EMPTY_LIST);
- } else {
- String[] resourceTypes = getPublication().getResourceTypeNames();
- setParameter(RESOURCE_TYPES, Arrays.asList(resourceTypes));
- }
- }
-
- protected void initSampleParameters() {
- ServiceSelector selector = null;
- ResourceType resourceType = null;
- try {
- selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
- resourceType = (ResourceType) selector.select(getDocumentTypeName());
- String[] samples = resourceType.getSampleNames();
- if (samples.length == 0) {
- addErrorMessage("The resource type [" + resourceType.getName()
- + "] doesn't provide any samples!");
- } else {
- setParameter(SAMPLES, samples);
- String presetSample = getParameterAsString(SAMPLE);
- if (presetSample == null) {
- setParameter(SAMPLE, samples[0]);
- } else {
- List sampleList = Arrays.asList(samples);
- if (!sampleList.contains(presetSample)) {
- getLogger().warn(
- "Sample [" + presetSample + "] not defined, using default sample.");
- setParameter(SAMPLE, samples[0]);
- }
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (selector != null) {
- if (resourceType != null) {
- selector.release(resourceType);
- }
- this.manager.release(selector);
- }
- }
- }
-
- /**
- * @return The source document or <code>null</code> if the usecase was not
- * invoked on a document.
- */
- protected Document getSourceDocument() {
- Document document = null;
- String url = getSourceURL();
- try {
- if (getDocumentFactory().isDocument(url)) {
- document = getDocumentFactory().getFromURL(url);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return document;
- }
-
- /**
- * @return The new document.
- */
- protected Document getNewDocument() {
- try {
- String path = getNewDocumentPath();
- String language = getParameterAsString(LANGUAGE);
- return getPublication().getArea(getArea()).getSite().getNode(path).getLink(language)
- .getDocument();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @return The area without the "info-" prefix.
- */
- public String getArea() {
- URLInformation info = new URLInformation(getSourceURL());
- return info.getArea();
- }
-
- /**
- * Access to the current publication. Use this when the publication is not
- * yet known in the usecase: e.g. when creating a global asset. When adding
- * a resource or a child to a document, access the publication via that
- * document's interface instead.
- *
- * @return the publication in which the use-case is being executed
- */
- protected Publication getPublication() {
- try {
- return PublicationUtil.getPublicationFromUrl(this.manager, getDocumentFactory(),
- getSourceURL());
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @return the visibleInNav Attribute of the document being created in the
- * usecase
- */
- protected boolean getVisibleInNav() {
- if (getParameterAsString(VISIBLEINNAV).equals("false")) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateDocument.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateDocument.java
deleted file mode 100644
index 668373d..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateDocument.java
+++ /dev/null
@@ -1,194 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.Arrays;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuilder;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * Usecase to create a document.
- *
- * @version $Id$
- */
-public class CreateDocument extends Create {
-
- protected static final String PARENT_PATH = "parentPath";
-
- protected static final String DOCUMENT_TYPE = "doctype";
-
- protected static final String RELATION = "relation";
- protected static final String RELATIONS = "relations";
- protected static final String RELATION_CHILD = "child";
- protected static final String RELATION_BEFORE = "sibling before";
- protected static final String RELATION_AFTER = "sibling after";
- protected static final String PATH_PROVIDED = "pathProvided";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- Document parent = getSourceDocument();
- if (parent == null) {
- setParameter(PARENT_PATH, "");
- } else {
- try {
- setParameter(PARENT_PATH, parent.getPath());
- } catch (DocumentException e) {
- throw new RuntimeException(e);
- }
- }
-
- String[] languages = getPublication().getLanguages();
- if (languages.length == 0) {
- addErrorMessage("The publication doesn't contain any languages!");
- }
- setParameter(LANGUAGES, languages);
-
- Document sourceDoc = getSourceDocument();
- String[] childOnly = { RELATION_CHILD };
- String[] childAndAfter = { RELATION_CHILD, RELATION_AFTER };
- String[] relations = sourceDoc == null ? childOnly : childAndAfter;
-
- setParameter(RELATIONS, relations);
- setParameter(RELATION, RELATION_CHILD);
-
- String path = getParameterAsString(PATH);
- boolean provided = path != null && !path.equals("");
- setParameter(PATH_PROVIDED, Boolean.valueOf(provided));
- }
-
- /**
- * Override this method to support other relations.
- * @return The supported relations.
- */
- protected String[] getSupportedRelations() {
- return new String[] { RELATION_CHILD, RELATION_AFTER };
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- super.doCheckExecutionConditions();
-
- String relation = getParameterAsString(RELATION);
-
- if (!Arrays.asList(getSupportedRelations()).contains(relation)) {
- addErrorMessage("The relation '" + relation + "' is not supported.");
- }
-
- Publication pub = getPublication();
-
- DocumentBuilder builder = pub.getDocumentBuilder();
- boolean provided = getParameterAsBoolean(PATH_PROVIDED, false);
-
- if (provided) {
- String newPath = getNewDocumentPath();
- if (pub.getArea(getArea()).getSite().contains(newPath)) {
- String[] params = { newPath };
- addErrorMessage("path-already-exists", params);
- }
- } else {
- String nodeName = getNodeName();
- if (nodeName.equals("")) {
- addErrorMessage("missing-node-name");
- } else if (!builder.isValidDocumentName(nodeName)) {
- addErrorMessage("node-name-special-characters");
- }
- }
- }
-
- protected String getNodeName() {
- return getParameterAsString(NODE_NAME).trim();
- }
-
- protected boolean isPathValid() {
- String nodeName = getNewDocumentName();
- DocumentBuilder builder = getPublication().getDocumentBuilder();
- return !nodeName.trim().equals("") && builder.isValidDocumentName(nodeName);
- }
-
- /**
- * @see Create#getNewDocumentName()
- */
- protected String getNewDocumentName() {
- String nodeName;
- if (getParameterAsBoolean(PATH_PROVIDED, false)) {
- final String path = getParameterAsString(PATH);
- nodeName = path.substring(path.lastIndexOf("/") + 1);
- } else {
- nodeName = getNodeName();
- }
- return nodeName;
- }
-
- /**
- * @return The relation between the source document and the created
- * document.
- */
- protected String getRelation() {
- return getParameterAsString(RELATION);
- }
-
- /**
- * @see Create#getNewDocumentPath()
- */
- protected String getNewDocumentPath() {
- if (getParameterAsBoolean(PATH_PROVIDED, false)) {
- return getParameterAsString(PATH);
- } else {
- String relation = getRelation();
- Document sourceDoc = getSourceDocument();
- if (sourceDoc == null) {
- return "/" + getNewDocumentName();
- } else {
- DocumentLocator sourceLoc = getSourceDocument().getLocator();
- if (relation.equals(RELATION_CHILD)) {
- return sourceLoc.getChild(getNewDocumentName()).getPath();
- } else if (relation.equals(RELATION_BEFORE) || relation.equals(RELATION_AFTER)) {
- return sourceLoc.getParent().getChild(getNewDocumentName()).getPath();
- } else {
- throw new IllegalStateException("unsupported relation " + relation);
- }
- }
- }
- }
-
- /**
- * @see org.apache.lenya.cms.site.usecases.Create#getDocumentTypeName()
- */
- protected String getDocumentTypeName() {
- return getParameterAsString(DOCUMENT_TYPE);
- }
-
- protected String getSourceExtension() {
- return "xml";
- }
-
- protected boolean createVersion() {
- return false;
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateLanguage.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateLanguage.java
deleted file mode 100644
index 75fb2d7..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/CreateLanguage.java
+++ /dev/null
@@ -1,176 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.ResourceType;
-import org.apache.lenya.cms.site.SiteManager;
-
-/**
- * Usecase to create a new language version of a resource.
- *
- * @version $Id$
- */
-public class CreateLanguage extends Create {
-
- private String documentTypeName;
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
- */
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
-
- if (getSourceDocument() == null) {
- addErrorMessage("This operation must be invoked on a document.");
- return;
- }
-
- String area = getSourceDocument().getArea();
- if (!area.equals(Publication.AUTHORING_AREA)) {
- addErrorMessage("This operation is only supported in the authoring area.");
- return;
- }
-
- if (getNonExistingLanguages().isEmpty()) {
- addErrorMessage("All language versions already exist.");
- }
- }
-
- /**
- * @return All languages supported by the publication for which this document does not yet have
- * a version
- * @throws DocumentBuildException if an error occurs.
- * @throws DocumentException if an error occurs.
- */
- protected List getNonExistingLanguages() throws DocumentBuildException, DocumentException {
- Document source = getSourceDocument();
- List nonExistingLanguages = new ArrayList();
- String[] languages = source.getPublication().getLanguages();
- for (int i = 0; i < languages.length; i++) {
- if (!source.existsTranslation(languages[i])) {
- nonExistingLanguages.add(languages[i]);
- }
- }
- return nonExistingLanguages;
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- Document source = getSourceDocument();
- if (source != null) {
- try {
- setParameter(PATH, source.getPath());
- List nonExistingLanguages = getNonExistingLanguages();
- setParameter(LANGUAGES, nonExistingLanguages
- .toArray(new String[nonExistingLanguages.size()]));
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- /**
- * For new language version of a document, name is the same as that document's
- * @see Create#getNewDocumentName()
- */
- protected String getNewDocumentName() {
- return getSourceDocument().getName();
- }
-
- /**
- * For new language version of a document, the path is the same as that document's
- * @see Create#getNewDocumentPath()
- */
- protected String getNewDocumentPath() {
- try {
- return getSourceDocument().getPath();
- } catch (DocumentException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * New language version of a document: use that document's content
- * @see Create#getInitialDocument()
- */
- protected Document getInitialDocument() {
- return getSourceDocument();
- }
-
- /**
- * @see Create#getDocumentTypeName()
- */
- protected String getDocumentTypeName() {
- if (this.documentTypeName == null && getSourceDocument() != null) {
- try {
- ResourceType type = getSourceDocument().getResourceType();
- this.documentTypeName = type.getName();
-
- List nonExistingLanguages = getNonExistingLanguages();
- setParameter(LANGUAGES, nonExistingLanguages
- .toArray(new String[nonExistingLanguages.size()]));
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- return this.documentTypeName;
- }
-
- protected boolean getVisibleInNav() {
- Document source = getSourceDocument();
- ServiceSelector selector = null;
- SiteManager siteManager = null;
- try {
- selector = (ServiceSelector) manager.lookup(SiteManager.ROLE + "Selector");
- siteManager = (SiteManager) selector.select(source.getPublication()
- .getSiteManagerHint());
- return siteManager.isVisibleInNav(source);
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- manager.release(selector);
- }
- }
- }
-
- protected String getSourceExtension() {
- return getSourceDocument().getSourceExtension();
- }
-
- protected boolean createVersion() {
- return true;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Cut.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Cut.java
deleted file mode 100644
index 99da15f..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Cut.java
+++ /dev/null
@@ -1,61 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.usecase.DocumentUsecase;
-
-/**
- * Cut a document into the clipboard.
- *
- * @version $Id$
- */
-public class Cut extends DocumentUsecase {
-
- protected static final String MESSAGE_ISLIVE = "cut-error-islive";
-
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
- if (hasErrors()) {
- return;
- }
-
- Document doc = getSourceDocument();
- if (!doc.getArea().equals(Publication.AUTHORING_AREA)) {
- addErrorMessage("only-in-authoring-area");
- }
- SiteStructure liveSite = doc.getPublication().getArea(Publication.LIVE_AREA).getSite();
- if (liveSite.contains(doc.getPath())) {
- addErrorMessage(MESSAGE_ISLIVE);
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- Clipboard clipboard = new Clipboard(getSourceDocument(), Clipboard.METHOD_CUT);
- ClipboardHelper helper = new ClipboardHelper();
- helper.saveClipboard(getContext(), clipboard);
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Delete.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Delete.java
deleted file mode 100644
index d7374be..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Delete.java
+++ /dev/null
@@ -1,51 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * Delete a document and all its descendants, including all language versions. The documents are
- * moved to the trash.
- *
- * @version $Id$
- */
-public class Delete extends MoveSubsite {
-
- /**
- * @see org.apache.lenya.cms.site.usecases.MoveSubsite#getSourceAreas()
- */
- protected String[] getSourceAreas() {
- return new String[] { Publication.AUTHORING_AREA, Publication.ARCHIVE_AREA };
- }
-
- /**
- * @see org.apache.lenya.cms.site.usecases.MoveSubsite#getTargetArea()
- */
- protected String getTargetArea() {
- return Publication.TRASH_AREA;
- }
-
- /**
- * @see org.apache.lenya.cms.site.usecases.MoveSubsite#getEvent()
- */
- protected String getEvent() {
- return "delete";
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/DeleteLanguage.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/DeleteLanguage.java
deleted file mode 100644
index 15baba7..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/DeleteLanguage.java
+++ /dev/null
@@ -1,86 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.util.DocumentHelper;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.usecase.DocumentUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-
-/**
- * Delete a language version.
- *
- * @version $Id$
- */
-public class DeleteLanguage extends DocumentUsecase {
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
- */
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
- if (hasErrors()) {
- return;
- }
-
- Document doc = getSourceDocument();
-
- if (!doc.getArea().equals(Publication.AUTHORING_AREA)) {
- addErrorMessage("This usecase can only be invoked in the authoring area!");
- } else if (doc.getLanguages().length == 1) {
- addErrorMessage("The last language version cannot be removed.");
- }
-
- if (doc.existsVersion(Publication.LIVE_AREA, doc.getLanguage())) {
- addErrorMessage("The document can't be deleted if a live version exists.");
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
- */
- protected Node[] getNodesToLock() throws UsecaseException {
- List nodes = new ArrayList();
- if(getSourceDocument() != null) {
- Node docNode = getSourceDocument().getRepositoryNode();
- Node siteNode = getSourceDocument().area().getSite().getRepositoryNode();
- nodes.add(docNode);
- nodes.add(siteNode);
- }
- return (Node[]) nodes.toArray(new Node[nodes.size()]);
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- Document document = getSourceDocument();
- document.getLink().delete();
- document.delete();
-
- setTargetDocument(DocumentHelper.getExistingLanguageVersion(document));
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/EmptyTrash.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/EmptyTrash.java
deleted file mode 100644
index 31eec52..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/EmptyTrash.java
+++ /dev/null
@@ -1,155 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.publication.util.DocumentSet;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteManager;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.usecase.AbstractUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-
-/**
- * Empty the trash.
- *
- * @version $Id$
- */
-public class EmptyTrash extends AbstractUsecase {
-
- protected static final String DOCUMENTS = "documents";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
- try {
- Document[] documents = getTrashDocuments();
- setParameter(DOCUMENTS, Arrays.asList(documents));
- } catch (SiteException e) {
- throw new RuntimeException(e);
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Lock the following objects:
- * <ul>
- * <li>all involved documents in the trash area</li>
- * <li>the document trash site structure</li>
- * </ul>
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
- */
- protected org.apache.lenya.cms.repository.Node[] getNodesToLock() throws UsecaseException {
- List nodes = new ArrayList();
- ServiceSelector selector = null;
- SiteManager siteManager = null;
-
- try {
- Publication publication = PublicationUtil.getPublicationFromUrl(this.manager,
- getDocumentFactory(),
- getSourceURL());
- DocumentFactory identityMap = getDocumentFactory();
- Document[] docs = getTrashDocuments();
- for (int i = 0; i < docs.length; i++) {
- nodes.add(docs[i].getRepositoryNode());
- }
-
- selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
- siteManager = (SiteManager) selector.select(publication.getSiteManagerHint());
- SiteStructure structure = siteManager.getSiteStructure(identityMap,
- publication,
- Publication.TRASH_AREA);
- nodes.add(structure.getRepositoryNode());
- } catch (Exception e) {
- throw new UsecaseException(e);
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- this.manager.release(selector);
- }
- }
- return (org.apache.lenya.cms.repository.Node[]) nodes.toArray(new org.apache.lenya.cms.repository.Node[nodes.size()]);
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- DocumentManager documentManager = null;
- try {
- documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
- Document[] documents = getTrashDocuments();
- DocumentSet set = new DocumentSet(documents);
- documentManager.delete(set);
- } finally {
- if (documentManager != null) {
- this.manager.release(documentManager);
- }
- }
- }
-
- /**
- * @return The documents in the trash area.
- * @throws PublicationException if an error occurs.
- * @throws SiteException if an error occurs.
- */
- protected Document[] getTrashDocuments() throws PublicationException, SiteException {
- Publication publication = PublicationUtil.getPublicationFromUrl(this.manager,
- getDocumentFactory(),
- getSourceURL());
- DocumentFactory identityMap = getDocumentFactory();
- Document[] documents;
-
- ServiceSelector selector = null;
- SiteManager siteManager = null;
- try {
- selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
- siteManager = (SiteManager) selector.select(publication.getSiteManagerHint());
- documents = siteManager.getDocuments(identityMap, publication, Publication.TRASH_AREA);
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- this.manager.release(selector);
- }
- }
-
- return documents;
- }
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ForceCheckIn.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ForceCheckIn.java
deleted file mode 100644
index ab3ed33..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/ForceCheckIn.java
+++ /dev/null
@@ -1,122 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
-import java.util.WeakHashMap;
-
-import javax.servlet.http.HttpSession;
-
-import org.apache.lenya.ac.Identity;
-import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.metadata.dublincore.DublinCoreHelper;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.usecase.DocumentUsecase;
-import org.apache.lenya.util.SessionListener;
-
-/**
- * Force a document to be checked in (override a checkout).
- */
-public class ForceCheckIn extends DocumentUsecase {
-
- private static final String IDENTITY = Identity.class.getName();
- private static final String HISTORY = "org.apache.lenya.cms.cocoon.acting.History";
-
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
-
- Document doc = getSourceDocument();
- if (doc == null) {
- return;
- }
-
- Node node = doc.getRepositoryNode();
- if (!node.isCheckedOut()) {
- String[] params = { DublinCoreHelper.getTitle(doc, true) };
- addErrorMessage("not-checked-out", params);
- }
- }
-
- protected void prepareView() throws Exception {
- Node node = getSourceDocument().getRepositoryNode();
- if (node.isCheckedOut()) {
- String userId = node.getCheckoutUserId();
- String[] params = { userId };
- if (isLoggedIn(userId)) {
- addInfoMessage("user-logged-in", params);
- }
- else {
- addInfoMessage("user-not-logged-in", params);
- }
- }
- }
-
- protected boolean isLoggedIn(String userId) {
- String pubId = getSourceDocument().getPublication().getId();
- SessionListener sessions = new SessionListener();
- WeakHashMap allSessions = sessions.getAllSessions();
-
- boolean loggedIn = false;
- Iterator userit = allSessions.entrySet().iterator();
- while (userit.hasNext()) {
- Map.Entry entry = (Map.Entry) userit.next();
- HttpSession nextsession = (HttpSession) entry.getValue();
-
- Identity identity = (Identity) nextsession.getAttribute(IDENTITY);
-
- if(identity == null) {
- continue;
- }
-
- User user = identity.getUser();
- Vector history = (Vector) nextsession.getAttribute(HISTORY);
- String publicationID = getPublicationIDfromHistory(history);
- if (publicationID.equals(pubId) && user != null && user.getId().equals(userId)) {
- loggedIn = true;
- }
- }
- return loggedIn;
- }
-
- protected void doExecute() throws Exception {
- super.doExecute();
-
- Document doc = getSourceDocument();
- Node node = doc.getRepositoryNode();
-
- node.forceCheckIn();
- }
-
- /**
- * Extract the publicationID from the history information stored in the
- * session
- *
- * @param history The history stored in the session.. An entry looks like \/
- * <publication-id>/authoring/index.html
- * @return A publication ID.
- */
- private String getPublicationIDfromHistory(Vector history) {
- String firstElement = history.firstElement().toString();
- String publicationID = firstElement.substring(1, firstElement.indexOf("/", 1));
- return publicationID;
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Move.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Move.java
deleted file mode 100644
index caf073e..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Move.java
+++ /dev/null
@@ -1,66 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import org.apache.lenya.cms.site.usecases.SiteUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-
-/**
- * Usecase to move a resource.
- *
- * @version $Id$
- */
-public class Move extends SiteUsecase {
-
- /**
- * Ctor.
- */
- public Move() {
- super();
- }
-
- /**
- * Validates the request parameters.
- * @throws UsecaseException if an error occurs.
- */
- void validate() throws UsecaseException {
- // do nothing
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- validate();
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.Usecase#setParameter(java.lang.String,
- * java.lang.Object)
- */
- public void setParameter(String name, Object value) {
- super.setParameter(name, value);
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java
deleted file mode 100644
index 4475477..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/MoveSubsite.java
+++ /dev/null
@@ -1,221 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.lenya.cms.publication.Area;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.site.Link;
-import org.apache.lenya.cms.site.NodeSet;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteNode;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.site.SiteUtil;
-import org.apache.lenya.cms.usecase.DocumentUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-import org.apache.lenya.cms.workflow.WorkflowUtil;
-import org.apache.lenya.cms.workflow.usecases.UsecaseWorkflowHelper;
-import org.apache.lenya.util.Assert;
-import org.apache.lenya.workflow.Workflowable;
-
-/**
- * Usecase to move a subsite to another area.
- *
- * @version $Id:$
- */
-public abstract class MoveSubsite extends DocumentUsecase {
-
- /**
- * @return The possible source areas.
- */
- protected abstract String[] getSourceAreas();
-
- /**
- * @return The target area.
- */
- protected abstract String getTargetArea();
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
- */
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
- if (hasErrors()) {
- return;
- }
-
- List sourceAreas = Arrays.asList(getSourceAreas());
- if (!sourceAreas.contains(getSourceDocument().getArea())) {
- addErrorMessage("This usecase can only be invoked in the authoring area!");
- } else {
-
- Document document = getSourceDocument();
-
- NodeSet subsite = SiteUtil.getSubSite(this.manager, document.getLink().getNode());
- Document[] docs = subsite.getDocuments();
- for (int i = 0; i < docs.length; i++) {
- if (docs[i].existsAreaVersion(Publication.LIVE_AREA)) {
- Document liveVersion = docs[i].getAreaVersion(Publication.LIVE_AREA);
- addErrorMessage("delete-doc-live", new String[] { liveVersion.toString() });
- }
- UsecaseWorkflowHelper.checkWorkflow(this.manager, this, getEvent(), docs[i],
- getLogger());
- }
- }
- }
-
- /**
- * @return The workflow event.
- */
- protected abstract String getEvent();
-
- /**
- * Lock all source documents and the site structure repository nodes because
- * changes to the site structure would compromise the operation.
- */
- protected Node[] getNodesToLock() throws UsecaseException {
- Set nodes = new HashSet();
-
- if(getSourceDocument() != null) {
- try {
-
- SiteStructure sourceSite = getSourceDocument().area().getSite();
- SiteStructure targetSite = getSourceDocument().getPublication()
- .getArea(getTargetArea()).getSite();
-
- nodes.add(sourceSite.getRepositoryNode());
- nodes.add(targetSite.getRepositoryNode());
-
- Document[] docs = SiteUtil.getSubSite(this.manager,
- getSourceDocument().getLink().getNode()).getDocuments();
- for (int i = 0; i < docs.length; i++) {
- nodes.add(docs[i].getRepositoryNode());
- }
-
- } catch (PublicationException e) {
- throw new UsecaseException(e);
- }
- }
-
- return (Node[]) nodes.toArray(new Node[nodes.size()]);
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
-
- String targetAreaName = getTargetArea();
- Document doc = getSourceDocument();
- Document[] sources = SiteUtil.getSubSite(this.manager, doc.getLink().getNode())
- .getDocuments();
- Area targetArea = doc.getPublication().getArea(targetAreaName);
-
- DocumentLocator targetLoc = doc.getLocator().getAreaVersion(targetAreaName);
- targetLoc = SiteUtil.getAvailableLocator(this.manager, getDocumentFactory(), targetLoc);
-
- for (int i = 0; i < sources.length; i++) {
- WorkflowUtil.invoke(this.manager, getSession(), getLogger(), sources[i], getEvent(),
- true);
-
- if (this.getClass().getName().equals(Restore.class.getName())) {
- Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, getSession(),
- getLogger(), sources[i]);
- String state = workflowable.getLatestVersion().getState();
- if (!state.equals("authoring")) {
- addErrorMessage("The state is [" + state + "] instead of [authoring]!");
- }
- }
-
- }
-
- DocumentManager docManager = null;
- try {
- docManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
- docManager.moveAll(doc.area(), doc.getPath(), targetArea, targetLoc.getPath());
-
- } finally {
- if (docManager != null) {
- this.manager.release(docManager);
- }
- }
-
- setTargetDocument(doc.getAreaVersion(targetAreaName));
-
- }
-
- public String getTargetURL(boolean success) {
- if (getTargetArea().equals(Publication.AUTHORING_AREA)) {
- return super.getTargetURL(success);
- }
-
- String url;
- if (!success) {
- url = getSourceURL();
- } else {
- try {
- Document document = getTargetDocument(success);
- SiteStructure site = document.getPublication().getArea(Publication.AUTHORING_AREA).getSite();
- return getTargetUrl(site, document.getPath()) + getExitQueryString();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- return url + getExitQueryString();
- }
-
- protected static String getTargetUrl(SiteStructure site, String path) throws SiteException {
- if (path.length() == 0) {
- return "/" + site.getPublication().getId() + "/" + site.getArea() + "/";
- } else if (site.contains(path)) {
- SiteNode node = site.getNode(path);
- if (node.getLanguages().length > 0) {
- Link link;
- String defaultLanguage = site.getPublication().getDefaultLanguage();
- if (node.hasLink(defaultLanguage)) {
- link = node.getLink(defaultLanguage);
- }
- else {
- link = node.getLink(node.getLanguages()[0]);
- }
- return link.getDocument().getCanonicalWebappURL();
- }
- else {
- return getTargetUrl(site, getParentPath(path));
- }
- } else {
- return getTargetUrl(site, getParentPath(path));
- }
- }
-
- protected static String getParentPath(String path) {
- Assert.notNull("path", path);
- Assert.isTrue("not empty", path.length() > 0);
- return path.substring(0, path.lastIndexOf("/"));
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Overview.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Overview.java
deleted file mode 100644
index 2adb81b..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Overview.java
+++ /dev/null
@@ -1,124 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.metadata.dublincore.DublinCore;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.site.usecases.SiteUsecase;
-import org.apache.lenya.cms.workflow.WorkflowUtil;
-import org.apache.lenya.workflow.Version;
-import org.apache.lenya.workflow.Workflow;
-import org.apache.lenya.workflow.WorkflowManager;
-import org.apache.lenya.workflow.Workflowable;
-
-/**
- * Usecase to display the overview tab in the site area for a document.
- *
- * @version $Id$
- */
-public class Overview extends SiteUsecase {
-
- protected static final String LASTMODIFIED = "lastmodified";
- protected static final String LANGUAGES = "languages";
- protected static final String STATE = "state";
- protected static final String ISLIVE = "isLive";
- protected static final String VISIBLE_IN_NAVIGATION = "visibleInNav";
- protected static final String WORKFLOW_VARIABLE_ISLIVE = "is_live";
-
- /**
- * Ctor.
- */
- public Overview() {
- super();
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- WorkflowManager resolver = null;
- try {
- Document doc = getSourceDocument();
- if (doc != null) {
- // read parameters from Dublin Core meta-data
- MetaData dc = doc.getMetaData(DublinCore.DC_NAMESPACE);
- setParameter(DublinCore.ELEMENT_TITLE, dc.getFirstValue(DublinCore.ELEMENT_TITLE));
- setParameter(DublinCore.ELEMENT_DESCRIPTION, dc
- .getFirstValue(DublinCore.ELEMENT_DESCRIPTION));
-
- // read parameters from document attributes
- setParameter(LANGUAGES, doc.getLanguages());
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
- String lastModified = format
- .format(new Date(getSourceDocument().getLastModified()));
- setParameter(LASTMODIFIED, lastModified);
- boolean visible = doc.getLink().getNode().isVisible();
- setParameter(VISIBLE_IN_NAVIGATION, Boolean.valueOf(visible));
-
- Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager,
- getSession(), getLogger(), doc);
- resolver = (WorkflowManager) this.manager.lookup(WorkflowManager.ROLE);
- if (resolver.hasWorkflow(workflowable)) {
- Workflow workflow = resolver.getWorkflowSchema(workflowable);
- String[] variableNames = workflow.getVariableNames();
- Version latestVersion = workflowable.getLatestVersion();
- Boolean isLive = null;
- if (latestVersion != null) {
- setParameter(STATE, latestVersion.getState());
- if (Arrays.asList(variableNames).contains(WORKFLOW_VARIABLE_ISLIVE)) {
- isLive = Boolean.valueOf(latestVersion
- .getValue(WORKFLOW_VARIABLE_ISLIVE));
- }
- } else {
- setParameter(STATE, workflow.getInitialState());
- if (Arrays.asList(variableNames).contains(WORKFLOW_VARIABLE_ISLIVE)) {
- isLive = Boolean.valueOf(workflow
- .getInitialValue(WORKFLOW_VARIABLE_ISLIVE));
- }
- }
- setParameter(ISLIVE, isLive);
- } else {
- setParameter(STATE, "");
- }
- }
-
- } catch (final Exception e) {
- addErrorMessage("Could not read a value. See log files for details.");
- getLogger().error("Could not read value for Overview usecase. ", e);
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
- */
- protected void doCheckPreconditions() throws Exception {
- // don't complain if document is null
- }
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Paste.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Paste.java
deleted file mode 100644
index c478743..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Paste.java
+++ /dev/null
@@ -1,240 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.lenya.cms.publication.Area;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.site.NodeSet;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteNode;
-import org.apache.lenya.cms.site.SiteUtil;
-import org.apache.lenya.cms.usecase.AbstractUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-
-/**
- * Paste a document from the clipboard.
- *
- * @version $Id$
- */
-public class Paste extends AbstractUsecase {
-
- protected static final String CLIPBOARD_LABEL = "clipboardLabel";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
- */
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
-
- if (hasErrors()) {
- return;
- }
-
- if (!getArea().getName().equals(Publication.AUTHORING_AREA)) {
- addErrorMessage("only-in-authoring-area");
- }
-
- Clipboard clipboard = new ClipboardHelper().getClipboard(getContext());
- if (clipboard == null) {
- addErrorMessage("clipboard-empty");
- }
- else {
- Document doc = getSourceDocument();
- if(doc != null) {
- Document clippedDoc = clipboard.getDocument(getDocumentFactory(), doc.getPublication());
- String uuid = clippedDoc.getUUID();
- SiteNode node = doc.getLink().getNode();
- if (clipboard.getMethod() == Clipboard.METHOD_CUT) {
- if (willPasteInOwnSubtree(node, uuid)) {
- addErrorMessage("will-paste-in-own-subtree");
- }
- }
- }
- }
- }
-
- protected boolean willPasteInOwnSubtree(SiteNode node, String uuid) throws SiteException {
- String nodeUuid = node.getUuid();
- if (nodeUuid.equals(uuid)) {
- return true;
- } else if (!node.isTopLevel()) {
- return willPasteInOwnSubtree(node.getParent(), uuid);
- } else {
- return false;
- }
- }
-
- protected Document getSourceDocument() {
- Document doc = null;
- try {
- DocumentFactory factory = getDocumentFactory();
- String sourceUrl = getParameterAsString(SOURCE_URL);
- if (factory.isDocument(sourceUrl)) {
- doc = factory.getFromURL(sourceUrl);
- }
- } catch (DocumentBuildException e) {
- throw new RuntimeException(e);
- }
- return doc;
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- Clipboard clipboard = new ClipboardHelper().getClipboard(getContext());
- if (clipboard != null) {
- String label;
- try {
- Publication pub = getPublication();
- label = clipboard.getDocument(getDocumentFactory(), pub).getLink().getLabel();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- setParameter(CLIPBOARD_LABEL, label);
- }
- }
-
- protected Publication getPublication() {
- URLInformation info = new URLInformation(getSourceURL());
- String pubId = info.getPublicationId();
- try {
- return getDocumentFactory().getPublication(pubId);
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
- */
- protected Node[] getNodesToLock() throws UsecaseException {
- List nodes = new ArrayList();
-
- try {
-
- Clipboard clipboard = new ClipboardHelper().getClipboard(getContext());
- if (clipboard != null) {
-
- Node siteNode = getArea().getSite().getRepositoryNode();
- nodes.add(siteNode);
-
- DocumentFactory map = getDocumentFactory();
- Publication pub = getPublication();
- Document clippedDocument = clipboard.getDocument(map, pub);
-
- NodeSet subsite = SiteUtil
- .getSubSite(this.manager, clippedDocument.getLink().getNode());
- Document[] subsiteDocs = subsite.getDocuments();
-
- for (int i = 0; i < subsiteDocs.length; i++) {
- if (clipboard.getMethod() == Clipboard.METHOD_CUT) {
- nodes.add(subsiteDocs[i].getRepositoryNode());
- }
- }
- }
-
- } catch (Exception e) {
- throw new UsecaseException(e);
- }
-
- return (Node[]) nodes.toArray(new Node[nodes.size()]);
- }
-
- protected Area getArea() {
- Publication pub = getPublication();
- URLInformation info = new URLInformation(getSourceURL());
- try {
- return pub.getArea(info.getArea());
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- DocumentFactory identityMap = getDocumentFactory();
- ClipboardHelper helper = new ClipboardHelper();
-
- Clipboard clipboard = helper.getClipboard(getContext());
- Publication pub = getPublication();
- Document clippedDocument = clipboard.getDocument(identityMap, pub);
-
- final String targetPath = getTargetPath();
- final Area area = clippedDocument.area();
- DocumentManager documentManager = null;
- try {
- documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
-
- if (clipboard.getMethod() == Clipboard.METHOD_COPY) {
- documentManager.copyAll(area, clippedDocument.getPath(), area, targetPath);
- } else if (clipboard.getMethod() == Clipboard.METHOD_CUT) {
- documentManager.moveAll(area, clippedDocument.getPath(), area, targetPath);
- } else {
- throw new RuntimeException("This clipboard method is not supported!");
- }
- } finally {
- if (documentManager != null) {
- this.manager.release(documentManager);
- }
- }
-
- helper.removeClipboard(getContext());
- }
-
- protected String getTargetPath() throws SiteException, DocumentBuildException,
- ServiceException, DocumentException {
- DocumentFactory identityMap = getDocumentFactory();
- Clipboard clipboard = new ClipboardHelper().getClipboard(getContext());
- Publication pub = getPublication();
- Document clippedDocument = clipboard.getDocument(identityMap, pub);
-
- String targetArea = getArea().getName();
- String language = clippedDocument.getLanguage();
- String nodeId = clippedDocument.getName();
-
- Document sourceDoc = getSourceDocument();
- String basePath = sourceDoc != null ? sourceDoc.getPath() : "";
-
- String potentialPath = basePath + "/" + nodeId;
-
- DocumentLocator potentialLoc = DocumentLocator.getLocator(getPublication().getId(),
- targetArea, potentialPath, language);
- return SiteUtil.getAvailableLocator(this.manager, getDocumentFactory(), potentialLoc)
- .getPath();
- }
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Restore.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Restore.java
deleted file mode 100644
index 0df3f27..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Restore.java
+++ /dev/null
@@ -1,88 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import org.apache.lenya.cms.publication.Area;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.site.SiteUtil;
-import org.apache.lenya.cms.workflow.WorkflowUtil;
-import org.apache.lenya.workflow.Workflowable;
-
-/**
- * Restore usecase handler.
- *
- * @version $Id:$
- */
-public class Restore extends MoveSubsite {
-
- /**
- * @see org.apache.lenya.cms.site.usecases.MoveSubsite#getSourceAreas()
- */
- protected String[] getSourceAreas() {
- return new String[] { Publication.TRASH_AREA, Publication.ARCHIVE_AREA };
- }
-
- /**
- * @see org.apache.lenya.cms.site.usecases.MoveSubsite#getTargetArea()
- */
- protected String getTargetArea() {
- return Publication.AUTHORING_AREA;
- }
-
- /**
- * @see org.apache.lenya.cms.site.usecases.MoveSubsite#getEvent()
- */
- protected String getEvent() {
- return "restore";
- }
-
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
-
- String targetAreaName = getTargetArea();
- Document doc = getSourceDocument();
- if(doc == null) {
- return;
- }
- // Check to see if parent node exists in target to prevent ghost nodes
- Area targetArea = doc.getPublication().getArea(targetAreaName);
- DocumentLocator targetLoc = doc.getLocator().getAreaVersion(targetAreaName);
- targetLoc = SiteUtil.getAvailableLocator(this.manager, getDocumentFactory(), targetLoc);
- String targetPath = targetLoc.getPath();
- targetPath = targetPath.substring(0,targetPath.lastIndexOf('/'));
- if(!targetArea.getSite().contains(targetPath)) {
- addErrorMessage("The authoring path [" + targetPath + "] does not exist.");
- }
- }
-
- protected void doCheckPostconditions() throws Exception {
- super.doCheckPostconditions();
-
- Document doc = getTargetDocument(true);
- Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, getSession(),
- getLogger(), doc);
- String state = workflowable.getLatestVersion().getState();
- if (!state.equals("authoring")) {
- addErrorMessage("The state is [" + state + "] instead of [authoring]!");
- }
-
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Revisions.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Revisions.java
deleted file mode 100644
index b59bb30..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Revisions.java
+++ /dev/null
@@ -1,100 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.repository.History;
-import org.apache.lenya.cms.repository.Revision;
-import org.apache.lenya.cms.workflow.WorkflowUtil;
-import org.apache.lenya.workflow.Version;
-import org.apache.lenya.workflow.Workflow;
-import org.apache.lenya.workflow.Workflowable;
-
-/**
- * Usecase to display revisions of a resource.
- *
- * @version $Id$
- */
-public class Revisions extends SiteUsecase {
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters() TODO
- * filter out checkin entries
- */
- protected void initParameters() {
- super.initParameters();
- Document sourceDoc = getSourceDocument();
- if (sourceDoc != null) {
- try {
- History history = sourceDoc.getRepositoryNode().getHistory();
-
- int[] numbers = history.getRevisionNumbers();
- Revision[] revisions = new Revision[numbers.length];
- for (int i = 0; i < numbers.length; i++) {
- revisions[i] = history.getRevision(numbers[i]);
- }
- setParameter("revisions", revisions);
-
- Boolean canRollback = Boolean.valueOf(WorkflowUtil.canInvoke(this.manager,
- getDocumentFactory().getSession(), getLogger(), sourceDoc, getEvent()));
- setParameter("canRollback", canRollback);
-
- if (WorkflowUtil.hasWorkflow(this.manager, getSession(), getLogger(), sourceDoc)) {
- Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager,
- getSession(), getLogger(), sourceDoc);
- Version latestVersion = workflowable.getLatestVersion();
- String state;
- if (latestVersion != null) {
- state = latestVersion.getState();
- } else {
- Workflow workflow = WorkflowUtil.getWorkflowSchema(this.manager,
- getSession(), getLogger(), sourceDoc);
- state = workflow.getInitialState();
- }
- setParameter("workflowState", state);
- }
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
-
- /*
- * // since we need both state and canInvoke, we could deal with the
- * avalon // component ourselves rather than using WorkflowUtil -
- * saves one // service manager lookup. // problem is that
- * DocumentWorkflowable is not public and Workflowable is abstract :(
- *
- * WorkflowManager wfManager = null; String workflowState; Boolean
- * canRollback; try { wfManager = (WorkflowManager)
- * this.manager.lookup(WorkflowManager.ROLE); Workflowable
- * workflowable = new DocumentWorkflowable( this.manager,
- * getDocumentFactory().getSession(), sourceDoc, getLogger() );
- * workflowState = workflowable.getLatestVersion().getState();
- * canRollback = new Boolean(wfManager.canInvoke(workflowable,
- * WORKFLOW_EVENT_EDIT)); } catch (ServiceException e) { throw new
- * RuntimeException(e); } finally { if (wfManager != null) {
- * manager.release(wfManager); } } setParameter("workflowState",
- * workflowState); setParameter("canRollback", canRollback);
- */
-
- }
- }
-
- protected String getEvent() {
- return getParameterAsString("workflowEvent");
- }
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Rollback.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Rollback.java
deleted file mode 100644
index c6f9941..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/Rollback.java
+++ /dev/null
@@ -1,69 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.usecase.DocumentUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-import org.apache.lenya.cms.workflow.WorkflowUtil;
-import org.apache.lenya.cms.workflow.usecases.UsecaseWorkflowHelper;
-
-/**
- * Rollback.
- */
-public class Rollback extends DocumentUsecase {
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
- */
- protected org.apache.lenya.cms.repository.Node[] getNodesToLock() throws UsecaseException {
- org.apache.lenya.cms.repository.Node[] objects = { getSourceDocument().getRepositoryNode() };
- return objects;
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
- */
- protected void doCheckPreconditions() throws Exception {
- super.doCheckPreconditions();
- UsecaseWorkflowHelper.checkWorkflow(this.manager, this, getEvent(), getSourceDocument(),
- getLogger());
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- int revision = getParameterAsInteger("rollbackRevision", -1);
-
- Document document = getSourceDocument();
- Node node = document.getRepositoryNode();
- node.rollback(revision);
-
- WorkflowUtil.invoke(this.manager, getSession(), getLogger(), getSourceDocument(),
- getEvent());
- }
-
- protected String getEvent() {
- return getParameterAsString("workflowEvent");
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/SiteOverview.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/SiteOverview.java
deleted file mode 100644
index c6552e6..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/SiteOverview.java
+++ /dev/null
@@ -1,306 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.publication.ResourceType;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.site.SiteException;
-import org.apache.lenya.cms.site.SiteManager;
-import org.apache.lenya.cms.usecase.AbstractUsecase;
-import org.apache.lenya.cms.usecase.UsecaseException;
-import org.apache.lenya.cms.workflow.WorkflowUtil;
-import org.apache.lenya.workflow.Version;
-import org.apache.lenya.workflow.Workflow;
-import org.apache.lenya.workflow.Workflowable;
-
-/**
- * Overview over all documents.
- */
-public class SiteOverview extends AbstractUsecase {
-
- protected static final String ALL_DOCUMENTS = "allDocuments";
- protected static final String DOCUMENTS = "documents";
- protected static final String FILTER_WORKFLOW_STATE_VALUES = "filterWorkflowStateValues";
- protected static final String FILTER_RESOURCE_TYPE_VALUES = "filterResourceTypeValues";
-
- protected static final String KEY_PATH = "keyPath";
- protected static final String KEY_RESOURCE_TYPE = "keyResourceType";
- protected static final String KEY_WORKFLOW_STATE = "keyWorkflowState";
- protected static final String KEY_LANGUAGE = "keyLanguage";
- protected static final String KEY_LAST_MODIFIED = "keyLastModified";
- protected static final String KEY_URL = "keyUrl";
- protected static final String KEY_CHECKED_OUT = "keyCheckedOut";
- protected static final String PARAMETER_KEYS = "keys";
-
- protected static final String[] KEYS = { KEY_PATH, KEY_LANGUAGE, KEY_RESOURCE_TYPE,
- KEY_WORKFLOW_STATE, KEY_LAST_MODIFIED, KEY_CHECKED_OUT };
-
- protected static final String FILTER_RESOURCE_TYPE = "filterResourceType";
- protected static final String FILTER_WORKFLOW_STATE = "filterWorkflowState";
- protected static final String FILTER_LANGUAGE = "filterLanguage";
- protected static final String PARAMETER_FILTERS = "filters";
-
- protected static final String[] FILTERS = { FILTER_LANGUAGE, FILTER_RESOURCE_TYPE,
- FILTER_WORKFLOW_STATE };
-
- protected static final String VALUE_ALL = "- all -";
-
- protected static final String SORT = "sort";
-
- protected static final String ORDER = "order";
-
- protected static final String DESC = "desc";
- protected static final String ASC = "asc";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
- try {
- Document[] documents = getDocuments();
-
- List entries = new ArrayList();
- for (int i = 0; i < documents.length; i++) {
-
- Entry entry = new Entry();
- if (documents[i].hasLink()) {
- entry.setValue(KEY_PATH, documents[i].getPath());
- } else {
- entry.setValue(KEY_PATH, "not in site structure");
- }
- entry.setValue(KEY_RESOURCE_TYPE, ResourceType.I18N_PREFIX
- + documents[i].getResourceType().getName());
- entry.setValue(KEY_LANGUAGE, documents[i].getLanguage());
- entry.setValue(KEY_URL, documents[i].getCanonicalWebappURL());
-
- DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- String lastModified = format.format(new Date(documents[i].getLastModified()));
- entry.setValue(KEY_LAST_MODIFIED, lastModified);
-
- if (WorkflowUtil.hasWorkflow(this.manager, getSession(), getLogger(), documents[i])) {
- Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager,
- getSession(), getLogger(), documents[i]);
- Version latestVersion = workflowable.getLatestVersion();
- String state;
- if (latestVersion != null) {
- state = latestVersion.getState();
- } else {
- Workflow workflow = WorkflowUtil.getWorkflowSchema(this.manager,
- getSession(), getLogger(), documents[i]);
- state = workflow.getInitialState();
- }
- entry.setValue(KEY_WORKFLOW_STATE, state);
- } else {
- entry.setValue(KEY_WORKFLOW_STATE, "");
- }
-
- Node node = documents[i].getRepositoryNode();
- if (node.isCheckedOut()) {
- entry.setValue(KEY_CHECKED_OUT, node.getCheckoutUserId());
- } else {
- entry.setValue(KEY_CHECKED_OUT, "");
- }
- entries.add(entry);
- }
-
- for (int i = 0; i < FILTERS.length; i++) {
- SortedSet filterValues = new TreeSet();
- filterValues.add(VALUE_ALL);
-
- String key = "key" + FILTERS[i].substring("filter".length());
-
- for (Iterator docs = entries.iterator(); docs.hasNext();) {
- Entry entry = (Entry) docs.next();
- filterValues.add(entry.getValue(key));
- }
- setParameter(FILTERS[i] + "Values", filterValues);
- setParameter(FILTERS[i], VALUE_ALL);
- }
- setParameter(PARAMETER_FILTERS, Arrays.asList(FILTERS));
-
- setParameter(ALL_DOCUMENTS, new ArrayList(entries));
- setParameter(DOCUMENTS, entries);
-
- setParameter(PARAMETER_KEYS, Arrays.asList(KEYS));
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @return The documents in the authoring area.
- * @throws PublicationException if an error occurs.
- * @throws SiteException if an error occurs.
- */
- protected Document[] getDocuments() throws PublicationException, SiteException {
- Publication publication = getPublication();
- DocumentFactory identityMap = getDocumentFactory();
- Document[] documents;
-
- ServiceSelector selector = null;
- SiteManager siteManager = null;
- try {
- selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
- siteManager = (SiteManager) selector.select(publication.getSiteManagerHint());
- documents = siteManager.getDocuments(identityMap, publication,
- Publication.AUTHORING_AREA);
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- } finally {
- if (selector != null) {
- if (siteManager != null) {
- selector.release(siteManager);
- }
- this.manager.release(selector);
- }
- }
-
- return documents;
- }
-
- /**
- * @return The publication.
- * @throws PublicationException if an error occurs.
- */
- protected Publication getPublication() throws PublicationException {
- return PublicationUtil.getPublicationFromUrl(this.manager, getDocumentFactory(),
- getSourceURL());
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.Usecase#advance()
- */
- public void advance() throws UsecaseException {
- super.advance();
-
- List allDocuments = (List) getParameter(ALL_DOCUMENTS);
- List filteredDocuments = new ArrayList(allDocuments);
-
- for (int i = 0; i < FILTERS.length; i++) {
- String key = "key" + FILTERS[i].substring("filter".length());
- String filterValue = getParameterAsString(FILTERS[i]);
- if (!filterValue.equals(VALUE_ALL)) {
- Entry[] entries = (Entry[]) filteredDocuments.toArray(new Entry[filteredDocuments
- .size()]);
- for (int entryIndex = 0; entryIndex < entries.length; entryIndex++) {
- if (!entries[entryIndex].getValue(key).equals(filterValue)) {
- filteredDocuments.remove(entries[entryIndex]);
- }
- }
- }
- }
-
- String sort = getParameterAsString(SORT);
- String order = getParameterAsString(ORDER, ASC);
- if (sort != null) {
- Comparator comparator = new EntryComparator(sort, order);
- Collections.sort(filteredDocuments, comparator);
- }
-
- setParameter(DOCUMENTS, filteredDocuments);
- }
-
- /**
- * Comparator for entries.
- */
- public static class EntryComparator implements Comparator {
-
- private String key;
- private String order;
-
- /**
- * @param key The key to compare.
- * @param order The order string ({@link SiteOverview#ASC} or {@link SiteOverview#DESC}).
- */
- public EntryComparator(String key, String order) {
- this.key = key;
- this.order = order;
- }
-
- /**
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object arg0, Object arg1) {
- Entry e1 = (Entry) arg0;
- Entry e2 = (Entry) arg1;
-
- String value1 = e1.getValue(this.key);
- String value2 = e2.getValue(this.key);
- if (this.order.equals(DESC))
- return value2.compareTo(value1);
- else
- return value1.compareTo(value2);
- }
-
- }
-
- /**
- * Stores document-related information.
- */
- public static class Entry {
-
- private Map values = new HashMap();
-
- /**
- * Ctor.
- */
- public Entry() {
- }
-
- /**
- * @param key The key.
- * @param value The value.
- */
- public void setValue(String key, String value) {
- this.values.put(key, value);
- }
-
- /**
- * @param key The key.
- * @return The value.
- */
- public String getValue(String key) {
- return (String) this.values.get(key);
- }
-
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/SiteUsecase.java b/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/SiteUsecase.java
deleted file mode 100644
index f98ad05..0000000
--- a/trunk/src/modules-core/sitemanagement/java/src/org/apache/lenya/cms/site/usecases/SiteUsecase.java
+++ /dev/null
@@ -1,30 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import org.apache.lenya.cms.usecase.DocumentUsecase;
-
-/**
- * Super class for site related usecases.
- *
- * @version $Id$
- */
-public class SiteUsecase extends DocumentUsecase {
-
-
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/java/test/org/apache/lenya/cms/site/usecases/CopyPasteTest.java b/trunk/src/modules-core/sitemanagement/java/test/org/apache/lenya/cms/site/usecases/CopyPasteTest.java
deleted file mode 100644
index 2fe2d1a..0000000
--- a/trunk/src/modules-core/sitemanagement/java/test/org/apache/lenya/cms/site/usecases/CopyPasteTest.java
+++ /dev/null
@@ -1,61 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.usecase.AbstractUsecaseTest;
-
-public class CopyPasteTest extends AbstractUsecaseTest {
-
- String PARENT_PATH = "/doctypes";
- String CHILD_URL = "/test/authoring/doctypes/cforms.html";
- String VERIFICATION_PATH = "/doctypes/cforms/doctypes/cforms";
-
- protected String getUsecaseName() {
- return "sitemanagement.paste";
- }
-
- protected Map getParameters() {
- return Collections.singletonMap("private.sourceUrl", CHILD_URL);
- }
-
- protected void prepareUsecase() throws Exception {
- super.prepareUsecase();
-
- Publication pub = getPublication("test");
- SiteStructure site = pub.getArea(Publication.AUTHORING_AREA).getSite();
- Document parent = site.getNode(PARENT_PATH).getLink(pub.getDefaultLanguage()).getDocument();
-
- Clipboard clipboard = new Clipboard(parent, Clipboard.METHOD_COPY);
- ClipboardHelper helper = new ClipboardHelper();
- helper.saveClipboard(this.context, clipboard);
- }
-
- protected void checkPostconditions() throws Exception {
- super.checkPostconditions();
-
- Publication pub = getPublication("test");
- SiteStructure site = pub.getArea(Publication.AUTHORING_AREA).getSite();
- assertTrue(site.contains(VERIFICATION_PATH));
- }
-}
diff --git a/trunk/src/modules-core/sitemanagement/java/test/org/apache/lenya/cms/site/usecases/MoveSubsiteTest.java b/trunk/src/modules-core/sitemanagement/java/test/org/apache/lenya/cms/site/usecases/MoveSubsiteTest.java
deleted file mode 100644
index c0f4975..0000000
--- a/trunk/src/modules-core/sitemanagement/java/test/org/apache/lenya/cms/site/usecases/MoveSubsiteTest.java
+++ /dev/null
@@ -1,107 +0,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.
- *
- */
-package org.apache.lenya.cms.site.usecases;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.lenya.cms.publication.Area;
-import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentLocator;
-import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.site.SiteNode;
-import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.usecase.AbstractUsecaseTest;
-
-/**
- * Test class for moving subsites to a different area.
- */
-public class MoveSubsiteTest extends AbstractUsecaseTest {
-
- protected static final String PATH = "/foo/bar/baz";
- protected static final String DELETE_URL = "/test/authoring" + PATH + ".html";
- protected static final String TARGET_URL = "/test/authoring/foo_de.html";
- protected static final String SOURCE_PATH = "/tutorial";
-
- protected String getUsecaseName() {
- return "sitemanagement.delete";
- }
-
- protected void checkPostconditions() throws Exception {
-
- assertTrue(getTargetUrl().startsWith(TARGET_URL));
-
- super.checkPostconditions();
-
- Area authoring = getPublication("test").getArea("authoring");
- SiteStructure authoringSite = authoring.getSite();
- assertFalse(authoringSite.contains(PATH));
-
- Area trash = getPublication("test").getArea("trash");
- SiteStructure trashSite = trash.getSite();
- assertTrue(trashSite.contains(PATH));
- String trashUuid = trashSite.getNode(PATH).getUuid();
- assertNotNull(trashUuid);
- assertEquals(trashUuid, this.uuid);
-
- }
-
- protected Map getParameters() {
- Map params = new HashMap();
- params.put("private.sourceUrl", DELETE_URL);
- return params;
- }
-
- private String uuid;
-
- protected void prepareUsecase() throws Exception {
- super.prepareUsecase();
- Area authoring = getPublication("test").getArea("authoring");
-
- SiteStructure authoringSite = authoring.getSite();
- SiteNode node = authoringSite.getNode(SOURCE_PATH);
- Document doc = node.getLink("en").getDocument();
-
- DocumentManager docMgr = null;
- try {
- docMgr = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
-
- String pubId = doc.getPublication().getId();
- String area = doc.getArea();
- DocumentLocator loc = DocumentLocator.getLocator(pubId, area, PATH, doc.getLanguage());
-
- authoringSite.add("/foo");
- authoringSite.add("/foo/bar");
-
- docMgr.copy(doc, loc);
-
- // add an ancestor language version to test the method
- // MoveSubSite.getTargetURL()
- DocumentLocator ancestorLoc = DocumentLocator.getLocator(pubId, area, "/foo", "de");
- docMgr.copy(doc, ancestorLoc);
-
- SiteNode childNode = authoringSite.getNode(PATH);
- this.uuid = childNode.getUuid();
- } finally {
- if (docMgr != null) {
- getManager().release(docMgr);
- }
- }
- }
-
-}
diff --git a/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui.xml b/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui.xml
deleted file mode 100644
index e270ff3..0000000
--- a/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-<?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.
--->
-
-<!-- $Id: cmsui.xml 446564 2006-09-15 10:13:16Z andreas $ -->
-
-<catalogue xml:lang="en" xmlns:xhtml="http://www.w3.org/1999/xhtml">
-
- <message key="sitemanagement.delete">Delete</message>
- <message key="sitemanagement.archive">Archive</message>
- <message key="sitemanagement.restore">Restore</message>
- <message key="cut-error-islive">The node cannot be cut when a language version is published.</message>
- <message key="Parent Path">Parent Path</message>
- <message key="Node Name">Node Name</message>
- <message key="missing-node-name">Please enter a node name.</message>
- <message key="node-name-special-characters">The node name may not contain any special characters.</message>
- <message key="Document visible in Navigation">Visible in Navigation</message>
- <message key="Relation">Relation</message>
- <message key="Page Layout">Page Layout</message>
- <message key="Document Path">Path</message>
- <message key="Meta Data">Meta Data</message>
- <message key="no-assets">No assets uploaded yet.</message>
- <message key="Editor">Editor</message>
- <message key="missing-languages">Missing Languages<br/> (click to create)</message>
- <message key="Namespace">Namespace</message>
- <message key="http://purl.org/dc/terms/">Dublin Core Terms</message>
- <message key="http://purl.org/dc/elements/1.1/">Dublin Core Elements</message>
- <message key="value-not-set">not set</message>
- <message key="Inherited credentials">Inherited credentials</message>
- <message key="Subtree credentials">Subtree credentials</message>
- <message key="New subtree credential">New subtree credential</message>
- <message key="no-jobs-scheduled">No jobs scheduled.</message>
- <message key="No overview available.">No overview available.</message>
- <message key="missing-navigation-title">Please enter a navigation title.</message>
- <message key="missing-page-layout">Please select a page layout.</message>
- <message key="path-already-exists">The path {0} already exists.</message>
- <message key="yes">yes</message>
- <message key="no">no</message>
- <message key="Type">Type</message>
- <message key="Method">Method</message>
- <message key="grant">grant</message>
- <message key="deny">deny</message>
- <message key="world">World</message>
- <message key="only-in-authoring-area">This usecase can only be invoked in the authoring area.</message>
- <message key="clipboard-empty">The clipboard is empty.</message>
- <message key="Resource Type">Resource Type</message>
- <message key="Mime Type">Mime Type</message>
- <message key="Document Size">Document Size</message>
- <message key="no-rollback">Rollback is disabled.</message>
- <message key="workflow-state">Workflow state is "{0}".</message>
- <message key="view-revision-in-new-window">view revision in new window</message>
- <message key="view-revision">View revision</message>
- <message key="is-current-version">(is current)</message>
- <message key="rollback">Roll back</message>
- <message key="rollback-ok">roll back to this version</message>
- <message key="no-rollback-in-review">Rollback disabled. Document is in
- review state.</message>
- <message key="no-rollback-no-privileges">Rollback disabled. You do not
- have sufficient privileges.</message>
- <message key="will-paste-in-own-subtree">Can't paste a cut document in its own subtree.</message>
- <message key="Change Document URL">Change Document URL</message>
- <message key="change-document-url">Change the URL of document <q>{0}</q></message>
- <message key="New URL Fragment">New URL Fragment</message>
- <message key="The document ID is not valid.">The URL fragment is not valid.</message>
- <message key="The document can't be deleted if a live version exists.">
- The document can't be deleted if a live version exists.
- </message>
- <message key="child">Child</message>
- <message key="sibling after">Following sibling</message>
- <message key="The last language version cannot be removed.">The last language version cannot be removed.</message>
- <message key="All language versions already exist.">All language versions already exist.</message>
-
- <!-- force check-in -->
- <message key="force-checkin">Force Check-In</message>
- <message key="force-checkin-question">Do you really want to check-in the document '{0}'?</message>
- <message key="user-logged-in">The user '{0}' is still logged in.</message>
- <message key="user-not-logged-in">The user '{0}' is not logged in anymore.</message>
- <message key="not-checked-out">The document '{0}' is not checked out.</message>
-</catalogue>
diff --git a/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui_de.xml b/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui_de.xml
deleted file mode 100644
index 6fccce4..0000000
--- a/trunk/src/modules-core/sitemanagement/resources/i18n/cmsui_de.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?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.
--->
-
-<!-- $Id: cmsui_de.xml 446564 2006-09-15 10:13:16Z andreas $ -->
-
-<catalogue xml:lang="de" xmlns:xhtml="http://www.w3.org/1999/xhtml">
-
- <message key="sitemanagement.delete">Löschen</message>
- <message key="sitemanagement.archive">Archivieren</message>
- <message key="sitemanagement.restore">Wiederherstellen</message>
- <message key="cut-error-islive">Der Knoten kann nicht ausgeschnitten werden wenn eine Sprachversion publiziert ist.</message>
- <message key="Parent Path">Übergeordneter Pfad</message>
- <message key="Node Name">Knoten-Name</message>
- <message key="missing-node-name">Bitte geben Sie einen Knoten-Namen ein.</message>
- <message key="node-name-special-characters">Der Knoten-Name darf keine Sonderzeichen enthalten.</message>
- <message key="Document visible in Navigation">Sichtbar in Navigation</message>
- <message key="Relation">Relation</message>
- <message key="Page Layout">Seitenlayout</message>
- <message key="Document Path">Pfad</message>
- <message key="Meta Data">Meta-Daten</message>
- <message key="no-assets">Es wurden noch keine Anlagen hochgeladen.</message>
- <message key="Editor">Bearbeiter</message>
- <message key="missing-languages">Fehlende Sprachen<br/> (Klicken zum Erstellen)</message>
- <message key="Namespace">Namensraum</message>
- <message key="http://purl.org/dc/terms/">Dublin-Core-Terme</message>
- <message key="http://purl.org/dc/elements/1.1/">Dublin-Core-Elemente</message>
- <message key="value-not-set">nicht gesetzt</message>
- <message key="Inherited credentials">Vererbte Berechtigungen</message>
- <message key="Subtree credentials">Berechtigungen für diesen Teilbaum</message>
- <message key="New subtree credential">Neue Berechtigung für diesen Teilbaum</message>
- <message key="no-jobs-scheduled">Es wurden keine zeitgesteuerten Aktionen gestartet.</message>
- <message key="No overview available.">Es ist keine Übersicht verfügbar.</message>
- <message key="missing-navigation-title">Bitte geben Sie einen Navigationstitel ein.</message>
- <message key="missing-page-layout">Bitte wählen Sie ein Seiten-Layout.</message>
- <message key="path-already-exists">Der Pfad {0} existiert bereits.</message>
- <message key="yes">ja</message>
- <message key="no">nein</message>
- <message key="Type">Typ</message>
- <message key="Method">Methode</message>
- <message key="grant">erlauben</message>
- <message key="deny">verbieten</message>
- <message key="world">Welt</message>
- <message key="only-in-authoring-area">Dieser Usecase kann nur im Authoring-Bereich ausgeführt werden.</message>
- <message key="clipboard-empty">Die Zwischenablage ist leer.</message>
- <message key="Resource Type">Ressourcen-Typ</message>
- <message key="Mime Type">Mime-Type</message>
- <message key="Document Size">Größe des Dokuments</message>
- <message key="no-rollback">Rollback ist deaktiviert.</message>
- <message key="workflow-state">Das Dokument ist im Arbeitsschritt "{0}".</message>
- <message key="view-revision-in-new-window">Version in neuem Fenster ansehen</message>
- <message key="view-revision">Version ansehen</message>
- <message key="is-current-version">(aktuell)</message>
- <message key="rollback">Wiederherstellen</message>
- <message key="rollback-ok">diese Version wiederherstellen</message>
- <message key="no-rollback-in-review">Im Arbeitsschritt "Freigabe" ist
- keine Wiederherstellung möglich.</message>
- <message key="no-rollback-no-privileges">Keine ausreichenden Rechte zum Wiederherstellen.</message>
- <message key="will-paste-in-own-subtree">
- Ein ausgeschnittenes Dokument kann nicht im eigenen Teilbaum eingefügt werden.
- </message>
- <message key="Change Document URL">URL des Dokuments ändern</message>
- <message key="change-document-url">URL des Dokuments <q>{0}</q> ändern</message>
- <message key="New URL Fragment">Neues URL-Fragment</message>
- <message key="The document ID is not valid.">Das URL-Fragment ist ungültig.</message>
- <message key="The document can't be deleted if a live version exists.">
- Das Dokument kann nicht gelöscht werden, wenn eine Live-Version existiert.
- </message>
- <message key="child">Kind-Dokument</message>
- <message key="sibling after">Folgendes Geschwister-Dokument</message>
- <message key="The last language version cannot be removed.">Die letzte Sprachversion kann nicht gelöscht werden.</message>
- <message key="All language versions already exist.">Es existieren bereits alle Sprachversionen.</message>
-
- <!-- force check-in -->
- <message key="force-checkin">Check-In erzwingen</message>
- <message key="force-checkin-question">Wollen Sie das Dokument "{0}" wirklich einchecken?</message>
- <message key="user-logged-in">Der Nutzer "{0}" ist noch eingeloggt.</message>
- <message key="user-not-logged-in">Der Nutzer "{0}" ist nicht mehr eingeloggt.</message>
- <message key="not-checked-out">Das Dokument "{0}" ist nicht ausgecheckt.</message>
-</catalogue>
-
diff --git a/trunk/src/modules-core/sitemanagement/resources/javascript/lenyaTabs.js b/trunk/src/modules-core/sitemanagement/resources/javascript/lenyaTabs.js
deleted file mode 100644
index a88df8d..0000000
--- a/trunk/src/modules-core/sitemanagement/resources/javascript/lenyaTabs.js
+++ /dev/null
@@ -1,43 +0,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.
-*/
-
-function lenyaGetTitle(num) {
- return document.getElementById('lenyaTabTitle' + num);
-}
-
-function lenyaGetBody(num) {
- return document.getElementById('lenyaTabBody' + num);
-}
-
-function lenyaInitTabs(count) {
- lenyaToggleTab(count, 0);
-}
-
-function lenyaToggleTab(count, num) {
- for (var i = 0; i < count; i++) {
- var title = document.getElementById('lenyaTabTitle' + i);
- var body = document.getElementById('lenyaTabBody' + i);
- if (i == num) {
- title.className = 'lenyaTabTitleActive';
- body.className = 'lenyaTabBodyActive';
- }
- else {
- title.className = 'lenyaTabTitle';
- body.className = 'lenyaTabBody';
- }
- }
-}
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/test/canoo/test.xml b/trunk/src/modules-core/sitemanagement/test/canoo/test.xml
deleted file mode 100644
index bd09bd5..0000000
--- a/trunk/src/modules-core/sitemanagement/test/canoo/test.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?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 project SYSTEM "../../../../modules/development/test/canoo/lenya_webtest.dtd">
-
-<project name="sitemanagement" basedir="." default="main">
-
- <import file="../../../../modules/development/test/canoo/macros.xml"/>
-
- <target name="main">
- <antcall target="sitemanagement.delete">
- <param name="webtest.config.basepath" value="default"/>
- </antcall>
- </target>
-
- <target name="sitemanagement.delete">
- <property name="number" value="1"/>
- <webtest name="sitemanagement.delete">
- &doConfig;
- <steps>
- <doLogin username="lenya" password="levi" url="authoring/index.html"/>
- <repeat count="${number}">
- <echo>Delete/Restore/Archive/Restore: Test #{count} of ${number}</echo>
-
- <!-- delete -->
- <invoke url="authoring/tutorial.html?lenya.usecase=sitemanagement.delete"/>
- <verifyElementText type="h1" text="Delete Document"/>
- <clickButton name="submit"/>
- <verifyElementText type="h1" text="Overview"/>
- <verifyText text="No overview available."/>
- <invoke url="trash/tutorial.html?lenya.usecase=tab.overview"/>
- <verifyElementText type="span" name="workflow-state" text="trash"/>
-
- <!-- restore -->
- <invoke url="trash/tutorial.html?lenya.usecase=sitemanagement.restore"/>
- <verifyElementText type="h1" text="Restore Document"/>
- <clickButton name="submit"/>
- <verifyElementText type="h1" text="Overview"/>
- <verifyText text="A short tutorial on using Apache Lenya"/>
- <verifyElementText type="span" name="workflow-state" text="authoring"/>
-
- <!-- archive -->
- <invoke url="authoring/tutorial.html?lenya.usecase=sitemanagement.archive"/>
- <verifyElementText type="h1" text="Archive Document"/>
- <clickButton name="submit"/>
- <verifyElementText type="h1" text="Overview"/>
- <verifyText text="No overview available."/>
- <invoke url="archive/tutorial.html?lenya.usecase=tab.overview"/>
- <verifyElementText type="span" name="workflow-state" text="archive"/>
-
- <!-- restore -->
- <invoke url="archive/tutorial.html?lenya.usecase=sitemanagement.restore"/>
- <verifyElementText type="h1" text="Restore Document"/>
- <clickButton name="submit"/>
- <verifyElementText type="h1" text="Overview"/>
- <verifyText text="A short tutorial on using Apache Lenya"/>
- <verifyElementText type="span" name="workflow-state" text="authoring"/>
-
- </repeat>
- <doLogout/>
- </steps>
- </webtest>
- </target>
-</project>
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/archive.jx b/trunk/src/modules-core/sitemanagement/usecases/site/archive.jx
deleted file mode 100644
index 8767dc7..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/archive.jx
+++ /dev/null
@@ -1,78 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
-
- <page:title><i18n:text>Archive Document</i18n:text></page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:translate>
- <i18n:text key="archive-doc"/>
- <i18n:param><q><jx:out value="${usecase.getParameter('document').getLink().getLabel()}"/></q></i18n:param>
- </i18n:translate>
- </div>
- <div class="lenya-box-body">
- <form method="get" id="form-archive_document">
-
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
-
- <table class="lenya-table-noborder">
- <tr>
- <td>
- <i18n:translate>
- <i18n:text key="archive-doc?"/>
- <i18n:param><strong><jx:out value="${usecase.getParameter('document').getLink().getLabel()}"/></strong></i18n:param>
- </i18n:translate><br/><br/>
- </td>
- </tr>
- <tr>
- <td>
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <jx:if test="${not(empty(usecase.getParameter('inconsistentdocument')))}">
- <td class="lenya-entry-caption">
- <span class="lenya-form-message-error"><i18n:text key="docs-have-links-to-doc"/>:</span>
- </td>
- <td valign="top">
- <jx:forEach var="item" items="${usecase.getParameter('inconsistentdocument')}">
- <a target="_blank" href="{@href}"><jx:out value="${item.id}"/><jx:out value="."/></a><br/>
- </jx:forEach>
- </td>
- </jx:if>
- </tr>
- <tr>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Archive"/> 
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/changeLabel.jx b/trunk/src/modules-core/sitemanagement/usecases/site/changeLabel.jx
deleted file mode 100644
index ef581cd..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/changeLabel.jx
+++ /dev/null
@@ -1,69 +0,0 @@
-<?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.
--->
-<!-- $Id: renameLabel.jx 123364 2004-12-26 16:11:27Z gregor $ -->
-<page:page xmlns:c="http://apache.org/cocoon/templates/jx/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- >
-
- <page:title>
- <i18n:text>Edit Navigation Title</i18n:text>
- </page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:translate>
- <i18n:text key="rename-label-doc"/>
- <i18n:param>
- <q><jx:out value="${usecase.getParameter('document')
- .getMetaData('http://purl.org/dc/elements/1.1/')
- .getFirstValue('title')}"/></q>
- </i18n:param>
- </i18n:translate>
- </div>
- <div class="lenya-box-body">
- <form method="post" action="" id="form-change_label">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="label"><i18n:text>New Navigation Title</i18n:text>:</label></td>
- <td><input type="text" class="lenya-form-element" name="label" value="${usecase.getParameter('label')}"/></td>
- </tr>
- <tr>
- <td/>
- <td>
- <br/>
- <input i18n:attr="value" type="submit" name="submit" value="Save"/>
-  
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/changeNodeID.jx b/trunk/src/modules-core/sitemanagement/usecases/site/changeNodeID.jx
deleted file mode 100644
index 1f50ad5..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/changeNodeID.jx
+++ /dev/null
@@ -1,65 +0,0 @@
-<?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.
--->
-<!-- $Id: renameLabel.jx 123364 2004-12-26 16:11:27Z gregor $ -->
-<page:page xmlns:c="http://apache.org/cocoon/templates/jx/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- >
-
- <page:title>
- <i18n:text>Change Document URL</i18n:text>
- </page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:translate>
- <i18n:text key="change-document-url"/>
- <i18n:param><jx:out value="${usecase.getParameter('document').getLink().getLabel()}"/></i18n:param>
- </i18n:translate>
- </div>
- <div class="lenya-box-body">
- <form method="post" action="" id="form-change_node_id">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="nodeId"><i18n:text>New URL Fragment</i18n:text>: *</label></td>
- <td><input type="text" class="lenya-form-element" name="nodeId" value="${usecase.getParameter('nodeId')}"/></td>
- </tr>
- <tr>
- <td/>
- <td>
- <br/>
- <input i18n:attr="value" type="submit" name="submit" value="Save"/>
-  
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/copy.jx b/trunk/src/modules-core/sitemanagement/usecases/site/copy.jx
deleted file mode 100644
index b5ee1a9..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/copy.jx
+++ /dev/null
@@ -1,66 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-<page:page xmlns:c="http://apache.org/cocoon/templates/jx/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- >
-
- <page:title>
- <i18n:text>Copy Document</i18n:text>
- </page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:text>Copy Document</i18n:text>
- </div>
- <div class="lenya-box-body">
- <form method="get" action="" id="form-copy_document">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <table class="lenya-table-noborder">
- <tr>
- <td>
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td>
- <br/>
- <i18n:translate>
- <i18n:text key="copy-doc-to-clip?"/>
- <i18n:param>${usecase.getParameter('document').getLink().getLabel()}</i18n:param>
- </i18n:translate>
- </td>
- </tr>
- <tr>
- <td>
- <br/>
- <input i18n:attr="value" type="submit" name="submit" value="Copy"/>
-  
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/create.jx b/trunk/src/modules-core/sitemanagement/usecases/site/create.jx
deleted file mode 100644
index 5cf2734..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/create.jx
+++ /dev/null
@@ -1,70 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
-
- <page:title>
- <jx:choose>
- <jx:when test="${usecase.getParameter('doctype') == null}">
- <i18n:translate>
- <i18n:text>New Document</i18n:text>
- </i18n:translate>
- </jx:when>
- <jx:otherwise>
- <i18n:translate>
- <i18n:text>New ... Document</i18n:text>
- <i18n:param><i18n:text>resourceType-<jx:out value="${usecase.getParameter('doctype')}"/></i18n:text></i18n:param>
- </i18n:translate>
- </jx:otherwise>
- </jx:choose>
- </page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:translate>
- <i18n:text>New Document</i18n:text>
- </i18n:translate>
- </div>
-
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
-
- <div class="lenya-box-body">
- <form method="post" id="form-create">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <table class="lenya-table-noborder">
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/site/createFields.jx"/>
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Create"/>
-  
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/createFields.jx b/trunk/src/modules-core/sitemanagement/usecases/site/createFields.jx
deleted file mode 100644
index 17efff0..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/createFields.jx
+++ /dev/null
@@ -1,235 +0,0 @@
-<?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.
--->
-
-<!-- $Id: create.jx 486213 2006-12-12 16:14:30Z andreas $ -->
-
-<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
-
- <jx:set var="newLanguageVersion" value="${usecase.getName().equals('sitemanagement.createLanguage')}"/>
-
- <jx:choose>
- <jx:when test="${usecase.getParameter('pathProvided')}">
- <tr>
- <td class="lenya-entry-caption">
- <label for="nodeName"><i18n:text>Path</i18n:text>: </label>
- </td>
- <td>
- <jx:out value="${usecase.getParameter('path')}"/>
- </td>
- </tr>
- </jx:when>
- <jx:when test="${newLanguageVersion}">
- <tr>
- <td class="lenya-entry-caption">
- <label for="nodeName"><i18n:text>Path</i18n:text>: </label>
- </td>
- <td>
- <jx:out value="${usecase.getParameter('path')}"/>
- </td>
- </tr>
- </jx:when>
- <jx:otherwise>
- <tr>
- <td class="lenya-entry-caption">
- <label for="nodeName"><i18n:text>Parent Path</i18n:text>: </label>
- </td>
- <td>
- <jx:out value="${usecase.getParameter('parentPath')}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption">
- <label for="nodeName"><i18n:text>Node Name</i18n:text>*: </label>
- </td>
- <td>
- <input class="lenya-form-element" type="text" name="nodeName" value="${usecase.getParameter('nodeName')}"/>
- <br/> (<i18n:text>No whitespace, no special characters</i18n:text>)
- </td>
- </tr>
- </jx:otherwise>
- </jx:choose>
- <tr>
- <td class="lenya-entry-caption">
- <label for="dublincore.title"><i18n:text>Navigation Title</i18n:text>*: </label></td>
- <td>
- <input class="lenya-form-element" type="text"
- name="dublincore.title" value="${usecase.getParameter('dublincore.title')}"/>
- </td>
- </tr>
- <jx:if test="${!newLanguageVersion}">
- <tr>
- <td class="lenya-entry-caption">
- <label for="visibleinnav"><i18n:text>Document visible in Navigation</i18n:text>*: </label></td>
- <jx:set var="visible" value="yes"/>
- <jx:if test="${usecase.getParameter('visibleInNav').equals('false')}">
- <jx:set var="visible" value="no"/>
- </jx:if>
- <td>
- <select class="lenya-form-element" name="visibleInNav">
- <jx:choose>
- <jx:when test="${visible.equals('yes')}">
- <option value="true" selected="selected"><i18n:text>yes</i18n:text></option>
- <option value="false"><i18n:text>no</i18n:text></option>
- </jx:when>
- <jx:otherwise>
- <option value="true"><i18n:text>yes</i18n:text></option>
- <option value="false" selected="selected"><i18n:text>no</i18n:text></option>
- </jx:otherwise>
- </jx:choose>
- </select>
- </td>
- </tr>
- </jx:if>
- <jx:set var="relations" value="${usecase.getParameter('relations')}"/>
- <jx:if test="${relations.size() > 1}">
- <tr>
- <td class="lenya-entry-caption">
- <label for="relation"><i18n:text>Relation</i18n:text>*: </label>
- </td>
- <td>
- <jx:forEach var="relation" items="${relations}">
- <jx:choose>
- <jx:when test="${relation.equals(usecase.getParameter('relation'))}">
- <input type="radio" name="relation" value="${relation}" checked="checked"/><i18n:text>${relation}</i18n:text>
- </jx:when>
- <jx:otherwise>
- <input type="radio" name="relation" value="${relation}"/><i18n:text>${relation}</i18n:text>
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </td>
- </tr>
- </jx:if>
- <jx:set var="languages" value="${usecase.getParameter('languages')}"/>
- <jx:choose>
- <jx:when test="${languages.size() > 1}">
- <tr>
- <td class="lenya-entry-caption">
- <label for="language"><i18n:text>Language</i18n:text>*: </label></td>
- <td>
- <select class="lenya-form-element" name="language">
- <jx:forEach var="language" items="${usecase.getParameter('languages')}">
- <jx:choose>
- <jx:when test="${language.equals(usecase.getParameter('language'))}">
- <option value="${language}" selected="selected">${language} (<i18n:text>${language}</i18n:text>)</option>
- </jx:when>
- <jx:otherwise>
- <option value="${language}">${language} (<i18n:text>${language}</i18n:text>)</option>
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </select>
- </td>
- </tr>
- </jx:when>
- <jx:otherwise>
- <tr>
- <td class="lenya-entry-caption">
- <label for="language"><i18n:text>Language</i18n:text>: </label></td>
- <td>
- <jx:set var="language" value="${languages[0]}"/>
- <input type="hidden" name="language" value="${language}"/>
- <jx:out value="${language}"/>
- </td>
- </tr>
- </jx:otherwise>
- </jx:choose>
- <tr>
- <td class="lenya-entry-caption">
- <label for="dublincore.creator"><i18n:text>Creator</i18n:text>:</label></td>
- <td>
- <input class="lenya-form-element" type="text" name="dublincore.creator" value="${usecase.getParameter('dublincore.creator')}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption">
- <label for="dublincore.subject"><i18n:text>Subject</i18n:text>:</label></td>
- <td>
- <input class="lenya-form-element" type="text" name="dublincore.subject" value="${usecase.getParameter('dublincore.subject')}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption">
- <label for="dublincore.publisher"><i18n:text>Publisher</i18n:text>:</label></td>
- <td>
- <input class="lenya-form-element" type="text" name="dublincore.publisher" value="${usecase.getParameter('dublincore.publisher')}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption">
- <i18n:text>Date</i18n:text>:</td>
- <td>
- <jx:out value="${usecase.getParameter('dublincore.date')}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption">
- <label for="dublincore.rights"><i18n:text>Rights</i18n:text>:</label></td>
- <td>
- <input class="lenya-form-element" type="text" name="dublincore.rights" value="${usecase.getParameter('dublincore.rights')}"/>
- </td>
- </tr>
- <jx:set var="resourceTypes" value="${usecase.getParameter('resourceTypes')}"/>
- <jx:if test="${resourceTypes.size() > 0}">
- <tr>
- <td class="lenya-entry-caption">
- <label for="sample"><i18n:text>Resource Type</i18n:text>:</label></td>
- <td>
- <select name="doctype">
- <jx:forEach var="item" items="${resourceTypes}">
- <jx:choose>
- <jx:when test="${usecase.getParameter('doctype').equals(item)}">
- <option value="${item}" selected="selected">${item}</option>
- </jx:when>
- <jx:otherwise>
- <option value="${item}">${item}</option>
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </select>
- </td>
- </tr>
- </jx:if>
- <jx:set var="samples" value="${usecase.getParameter('samples')}"/>
- <jx:if test="${samples.size() > 0 && !newLanguageVersion}">
- <tr>
- <td class="lenya-entry-caption" style="vertical-align: top">
- <label for="sample"><i18n:text>Page Layout</i18n:text>:</label></td>
- <td>
- <jx:forEach var="item" items="${samples}">
- <jx:choose>
- <jx:when test="${usecase.getParameter('sample').equals(item)}">
- <input type="radio" name="sample" value="${item}" checked="checked"/>${item}<br />
- </jx:when>
- <jx:otherwise>
- <input type="radio" name="sample" value="${item}"/>${item}<br />
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </td>
- </tr>
- </jx:if>
- <tr>
- <td class="lenya-entry-caption">* <i18n:text>required fields</i18n:text>
- </td>
- </tr>
-
-</jx:template>
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/createLanguage.jx b/trunk/src/modules-core/sitemanagement/usecases/site/createLanguage.jx
deleted file mode 100644
index 501c828..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/createLanguage.jx
+++ /dev/null
@@ -1,54 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
-
- <page:title><i18n:text>New Language Version</i18n:text></page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:text>New Language Version</i18n:text>
- </div>
-
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
-
- <div class="lenya-box-body">
- <form method="post" id="form-create_language">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <table class="lenya-table-noborder">
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/site/createFields.jx"/>
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Create"/>
-  
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/cut.jx b/trunk/src/modules-core/sitemanagement/usecases/site/cut.jx
deleted file mode 100644
index 6dab595..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/cut.jx
+++ /dev/null
@@ -1,66 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-<page:page xmlns:c="http://apache.org/cocoon/templates/jx/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- >
-
- <page:title>
- <i18n:text>Cut Document</i18n:text>
- </page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:text>Cut Document</i18n:text>
- </div>
- <div class="lenya-box-body">
- <form method="get" action="" id="form-cut_document">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <table class="lenya-table-noborder">
- <tr>
- <td>
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td>
- <br/>
- <i18n:translate>
- <i18n:text key="cut-doc-to-clip?"/>
- <i18n:param>${usecase.getParameter('document').getLink().getLabel()}</i18n:param>
- </i18n:translate>
- </td>
- </tr>
- <tr>
- <td>
- <br/>
- <input i18n:attr="value" type="submit" name="submit" value="Cut"/>
-  
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/deactivate.jx b/trunk/src/modules-core/sitemanagement/usecases/site/deactivate.jx
deleted file mode 100644
index 8f46eca..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/deactivate.jx
+++ /dev/null
@@ -1,110 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-<page:page xmlns:c="http://apache.org/cocoon/templates/jx/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0" >
-
- <page:title>
- <i18n:text>Deactivate Document</i18n:text>
- </page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:translate>
- <i18n:text key="deactivate-doc"/>
- <i18n:param>
- <q>
- <jx:out value="${usecase.getParameter('documentid')}"/>
- </q>
- </i18n:param>
- </i18n:translate>
- </div>
- <div class="lenya-box-body">
- <jx:choose>
- <jx:when test="${not(empty(usecase.getParameter('message')))}"> <!-- there is a warning -->
- <form method="get" id="form-deactivate">
- <div class="lenya-box">
- <div class="lenya-box-title"><i18n:text>Deactivate Document</i18n:text></div>
- <div class="lenya-box-body">
- <table class="lenya-table-noborder">
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Document</i18n:text>:</td>
- <td><jx:out value="${usecase.getParameter('documentid')}"/> [<jx:out value="${usecase.getParameter('language')}"/>]</td>
- </tr>
- <tr>
- <td valign="top" class="lenya-entry-caption"><i18n:text>Problem</i18n:text>:</td>
- <td>
- <span class="lenya-form-error"><i18n:text key="cannot-deactivate-unless-children-deactivated"/>:</span>
- <ul>
- <jx:forEach var="item" items="${usecase.getParameter('livechildren')}">
- <li><a href="{@href}"><jx:out value="${item.id}"/> [<jx:out value="${item.language}"/>]</a></li>
- </jx:forEach>
- </ul>
- </td>
- </tr>
- </table>
- </div>
- </div>
- <input onClick="location.href='{$request-uri}';" type="button" value="Cancel" name="input-cancel"/>
- </form>
- </jx:when>
- <jx:otherwise> <!-- no warning -->
- <form method="get" action="">
- <input type="hidden" name="lenya.usecase" value="deactivate"/>
- <table class="lenya-table-noborder">
- <tr>
- <td>
- <br/>
- <i18n:translate>
- <i18n:text key="deactivate-doc?"/>
- <i18n:param>
- <strong>
- <jx:out value="${usecase.getParameter('documentid')}"/>
- </strong>
- </i18n:param>
- </i18n:translate>
- </td>
- </tr>
- <tr>
- <jx:if test="${not(empty(usecase.getParameter('inconsistentdocument')))}">
- <td class="lenya-entry-caption">
- <span class="lenya-form-message-error"><i18n:text key="docs-have-links-to-doc"/>:</span>
- </td>
- <td valign="top">
- <jx:forEach var="item" items="${usecase.getParameter('inconsistentdocument')}">
- <a target="_blank" href="{@href}"><jx:out value="${item.id}"/><jx:out value="."/></a><br/>
- </jx:forEach>
- </td>
- </jx:if>
- </tr>
- <tr>
- <td>
- <br/><input i18n:attr="value" type="submit" value="Deactivate" name="input-deactivate"/> 
- <input i18n:attr="value" type="button" onClick="location.href='${requesturi}';" value="Cancel" name="input-cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </jx:otherwise>
- </jx:choose>
- </div>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/delete.jx b/trunk/src/modules-core/sitemanagement/usecases/site/delete.jx
deleted file mode 100644
index bed2f78..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/delete.jx
+++ /dev/null
@@ -1,96 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
-
- <page:title><i18n:text>Delete Document</i18n:text></page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:translate>
- <i18n:text key="delete-doc"/>
- <jx:set var="document" value="${usecase.getParameter('document')}"/>
- <jx:choose>
- <jx:when test="${document.hasLink()}">
- <i18n:param><q><jx:out value="${document.getLink().getLabel()}"/></q></i18n:param>
- </jx:when>
- <jx:otherwise>
- <i18n:param>(not available)</i18n:param>
- </jx:otherwise>
- </jx:choose>
- </i18n:translate>
- </div>
- <div class="lenya-box-body">
- <form method="post" id="form-delete">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <table class="lenya-table-noborder">
- <tr>
- <td>
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <jx:choose>
- <jx:when test="${usecase.hasErrors()}">
- <tr>
- <td>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </jx:when>
- <jx:otherwise>
- <tr>
- <td>
- <i18n:translate>
- <i18n:text key="delete-language-versions?"/>
- <i18n:param><strong><jx:out value="${usecase.getParameter('document').getLink().getLabel()}"/></strong></i18n:param>
- </i18n:translate><br/><br/>
- </td>
- </tr>
- <tr>
- <jx:if test="${not(empty(usecase.getParameter('inconsistentdocument')))}">
- <td class="lenya-entry-caption">
- <span class="lenya-form-message-error"><i18n:text key="docs-have-links-to-doc"/>:</span>
- </td>
- <td valign="top">
- <jx:forEach var="item" items="${usecase.getParameter('inconsistentdocument')}">
- <a target="_blank" href="{@href}"><jx:out value="${item.id}"/><jx:out value="."/></a><br/>
- </jx:forEach>
- </td>
- </jx:if>
- </tr>
- <tr>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Delete"/>
-  
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </jx:otherwise>
- </jx:choose>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/deleteLanguage.jx b/trunk/src/modules-core/sitemanagement/usecases/site/deleteLanguage.jx
deleted file mode 100644
index e574b2c..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/deleteLanguage.jx
+++ /dev/null
@@ -1,69 +0,0 @@
-<?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.
--->
-
-<!-- $Id: login.jx 123986 2005-01-03 15:23:11Z andreas $ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
-
- <page:title><i18n:text>Remove Language Version</i18n:text></page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:text>Remove Language Version</i18n:text>
- </div>
- <div class="lenya-box-body">
- <form method="post" id="form-delete_language">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption">
- <i18n:text>Document</i18n:text>: </td>
- <td>
- <jx:out value="${usecase.getParameter('document').getLink().getLabel()}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption">
- <i18n:text>Language</i18n:text>*: </td>
- <td>
- <jx:out value="${usecase.getParameter('document').getLanguage()}"/>
- </td>
- </tr>
- <tr>
- <td/>
- <td>
- <input i18n:attr="value" type="submit" name="submit" value="Delete"/>
-  
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/forceCheckIn.jx b/trunk/src/modules-core/sitemanagement/usecases/site/forceCheckIn.jx
deleted file mode 100644
index e801166..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/forceCheckIn.jx
+++ /dev/null
@@ -1,51 +0,0 @@
-<?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.
--->
-
-<!-- $Id: delete.jx 499060 2007-01-23 15:50:56Z andreas $ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
-
- <page:title><i18n:text>force-checkin</i18n:text></page:title>
- <page:body>
- <p>
- <i18n:translate>
- <i18n:text key="force-checkin-question"/>
- <jx:set var="document" value="${usecase.getParameter('document')}"/>
- <i18n:param><jx:out value="${document.getMetaData('http://purl.org/dc/elements/1.1/').getFirstValue('title')}"/></i18n:param>
- </i18n:translate>
- </p>
-
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
-
- <form method="post" action="" id="form-force_checkin">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
-
- <p>
- <jx:if test="${!usecase.hasErrors()}">
- <input i18n:attr="value" type="submit" name="submit" value="Submit"/>
-  
- </jx:if>
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </p>
- </form>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/paste.jx b/trunk/src/modules-core/sitemanagement/usecases/site/paste.jx
deleted file mode 100644
index cd7c915..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/paste.jx
+++ /dev/null
@@ -1,66 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-<page:page xmlns:c="http://apache.org/cocoon/templates/jx/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- >
-
- <page:title>
- <i18n:text>Paste Document</i18n:text>
- </page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:text>Paste Document</i18n:text>
- </div>
- <div class="lenya-box-body">
- <form method="post" action="" id="form-paste">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <table class="lenya-table-noborder">
- <tr>
- <td>
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td>
- <br/>
- <i18n:translate>
- <i18n:text key="paste-doc-from-clip?"/>
- <i18n:param>${usecase.getParameter('clipboardLabel')}</i18n:param>
- </i18n:translate>
- </td>
- </tr>
- <tr>
- <td>
- <br/>
- <input i18n:attr="value" type="submit" name="submit" value="Paste"/>
-  
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/site/restore.jx b/trunk/src/modules-core/sitemanagement/usecases/site/restore.jx
deleted file mode 100644
index d29aae1..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/site/restore.jx
+++ /dev/null
@@ -1,67 +0,0 @@
-<?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.
--->
-<!-- $Id$ -->
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0" >
-
- <page:title>
- <i18n:text>Restore Document</i18n:text>
- </page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:translate>
- <i18n:text key="restore-doc"/>
- <i18n:param>
- <q>
- <jx:out value="${usecase.getParameter('document').getLink().getLabel()}"/>
- </q>
- </i18n:param>
- </i18n:translate>
- </div>
- <div class="lenya-box-body">
- <jx:choose>
- <jx:when test="${usecase.hasErrors()}">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- <input type="button" class="lenya-form-element" onClick="location.href='${requesturi}';" value="Back"/>
- </jx:when>
- <jx:otherwise>
- <form method="post" id="form-restore">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <i18n:translate>
- <i18n:text key="restore-doc?"/>
- <i18n:param>
- <strong>
- <jx:out value="${usecase.getParameter('document').getLink().getLabel()}"/>
- </strong>
- </i18n:param>
- </i18n:translate>
- <br/><br/>
- <input i18n:attr="value" type="submit" name="submit" value="Restore"/>
-  
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </form>
- </jx:otherwise>
- </jx:choose>
- </div>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/ac/ac.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/ac/ac.jx
deleted file mode 100644
index 4b4f002..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/ac/ac.jx
+++ /dev/null
@@ -1,315 +0,0 @@
-<?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.
--->
-
-<!-- $Id: ac.jx 156161 2005-03-04 15:23:21Z andreas $ -->
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
-
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/head.jx"/>
- <page:body>
- <jx:import
- uri="fallback://lenya/modules/sitemanagement/usecases/tab/sitetree.jx"/>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
-
- <jx:set var="area" value="${usecase.getParameter('acArea')}"/>
-
- <div id="contentblock1" class="lenya-tab-sitetree">
-
- <h1><i18n:text><jx:out value="${usecase.getView().getTab().getLabel()}"/></i18n:text></h1>
-
- <!--
- <div class="lenya-box-toggled">
- <div class="lenya-box-title"><i18n:text>Help</i18n:text></div>
- <div class="lenya-box-body">
- I guess a help text would be necessary for this page.
- Would someone mind adding some hints? Or maybe we should add a
- link to the documentation.
- </div>
- </div>
- -->
-
- <table class="lenya-table-list-noborder">
- <tr>
- <td colspan="5" style="border-left: 0; border-right: 0; border-top: 0px;">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td colspan="5">
- <jx:import
- uri="fallback://lenya/modules/sitemanagement/usecases/tab/ac/ssl-form.jx"/>
- </td>
- </tr>
- <tr>
- <td colspan="5" style="border-left: 0; border-right: 0;">
- <h4 style="margin: 30px 0 0 0;">
- <i18n:text>Inherited credentials</i18n:text>
- </h4>
- </td>
- </tr>
- <tr>
- <th><i18n:text>Type</i18n:text></th>
- <th><i18n:text>ID</i18n:text></th>
- <th><i18n:text>Role</i18n:text></th>
- <th colspan="2"><i18n:text>Method</i18n:text></th>
- </tr>
- <jx:forEach var="credential"
- items="${usecase.getParameter('parentCredentials')}">
- <tr>
- <td>
- <i18n:text><jx:out value="${credential.getType()}"/></i18n:text>
- </td>
- <td>
- <jx:out value="${credential.getAccreditableId()}"/>
- </td>
- <td>
- <jx:out value="${credential.getRoleId()}"/>
- </td>
- <td colspan="2">
- <i18n:text><jx:out value="${credential.getMethod()}"/></i18n:text>
- </td>
- </tr>
- </jx:forEach>
-
-
- <tr>
- <td colspan="5" style="border-left: 0; border-right: 0;">
- <h4 style="margin: 30px 0 0 0;">
- <i18n:text>Subtree credentials</i18n:text>
- </h4>
- </td>
- </tr>
- <tr>
- <th><i18n:text>Type</i18n:text></th>
- <th><i18n:text>ID</i18n:text></th>
- <th><i18n:text>Role</i18n:text></th>
- <th><i18n:text>Method</i18n:text></th>
- <th> 
- </th>
- </tr>
- <jx:forEach var="credential" varStatus="status"
- items="${usecase.getParameter('subCredentials')}">
- <form method="post" id="form-deleteSubCredential">
- <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="submit" value="Submit"/>
- <tr>
- <td>
- <i18n:text><jx:out value="${credential.getType()}"/></i18n:text>
- </td>
- <td>
- <input type="hidden" name="${credential.getType()}" value="${credential.getAccreditableId()}"/>
- <jx:out value="${credential.getAccreditableId()}"/>
- </td>
- <td>
- <input type="hidden" name="role" value="${credential.getRoleId()}"/>
- <jx:out value="${credential.getRoleId()}"/>
- </td>
- <td>
- <input type="hidden" name="method" value="${credential.getMethod()}"/>
- <i18n:text><jx:out value="${credential.getMethod()}"/></i18n:text>
- </td>
- <td>
- <input type="submit"
- name="deleteCredential_${credential.getType()}"
- i18n:attr="value" value="Delete"/>
- <jx:if test="${status.count>1}">
- <input type="submit"
- name="upCredential_${credential.getType()}"
- i18n:attr="value" value="Move Up"/>
- </jx:if>
- <jx:if test="${!status.last}">
- <input type="submit"
- name="downCredential_${credential.getType()}"
- i18n:attr="value" value="Move Down"/>
- </jx:if>
- </td>
- </tr>
- </form>
- </jx:forEach>
-
- <tr>
- <td colspan="5" style="border-left: 0; border-right: 0; border-top: 0px;">
- <h4 style="margin: 30px 0 0 0;">
- <i18n:text>New subtree credential</i18n:text>
- </h4>
- </td>
- </tr>
- <tr>
- <th><i18n:text>Type</i18n:text></th>
- <th><i18n:text>ID</i18n:text></th>
- <th><i18n:text>Role</i18n:text></th>
- <th><i18n:text>Method</i18n:text></th>
- <th> 
- </th>
- </tr>
- <tr>
-
- <form method="post" id="form-addCredential_user">
- <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="submit" value="Submit"/>
- <td>
- <i18n:text>user</i18n:text>
- </td>
- <td>
- <select name="user" class="lenya-form-element-verynarrow">
- <jx:forEach var="user" items="${usecase.getParameter('users')}">
- <option value="${user}">
- <jx:out value="${user}"/>
- </option>
- </jx:forEach>
- </select>
- </td>
- <td>
- <select name="role" class="lenya-form-element-verynarrow">
- <jx:forEach var="role" items="${usecase.getParameter('roles')}">
- <option value="${role}">
- <jx:out value="${role}"/>
- </option>
- </jx:forEach>
- </select>
- </td>
- <td>
- <select name="method" class="lenya-form-element-verynarrow">
- <option value="deny"><i18n:text>deny</i18n:text></option>
- <option value="grant"><i18n:text>grant</i18n:text></option>
- </select>
- </td>
- <td>
- <input i18n:attr="value" type="submit" name="addCredential_user"
- value="Add"/>
- </td>
- </form>
-
- </tr>
- <tr>
- <form method="post" id="form-addCredential_group">
- <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="submit" value="Submit"/>
- <td>
- <i18n:text>group</i18n:text>
- </td>
- <td>
- <select name="group" class="lenya-form-element-verynarrow">
- <jx:forEach var="group" items="${usecase.getParameter('groups')}">
- <option value="${group}">
- <jx:out value="${group}"/>
- </option>
- </jx:forEach>
- </select>
- </td>
- <td>
- <select name="role" class="lenya-form-element-verynarrow">
- <jx:forEach var="role" items="${usecase.getParameter('roles')}">
- <option value="${role}">
- <jx:out value="${role}"/>
- </option>
- </jx:forEach>
- </select>
- </td>
- <td>
- <select name="method" class="lenya-form-element-verynarrow">
- <option value="deny"><i18n:text>deny</i18n:text></option>
- <option value="grant"><i18n:text>grant</i18n:text></option>
- </select>
- </td>
- <td>
- <input i18n:attr="value" type="submit" name="addCredential_group"
- value="Add"/>
- </td>
- </form>
- </tr>
-
- <tr>
- <form method="post" id="form-addCredential_ipRange">
- <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="submit" value="Submit"/>
- <td>
- <i18n:text>IP Range</i18n:text>
- </td>
- <td>
- <select name="ipRange" class="lenya-form-element-verynarrow">
- <jx:forEach var="ipRange" items="${usecase.getParameter('ipRanges')}">
- <option value="${ipRange}">
- <jx:out value="${ipRange}"/>
- </option>
- </jx:forEach>
- </select>
- </td>
- <td>
- <select name="role" class="lenya-form-element-verynarrow">
- <jx:forEach var="role" items="${usecase.getParameter('roles')}">
- <option value="${role}">
- <jx:out value="${role}"/>
- </option>
- </jx:forEach>
- </select>
- </td>
- <td>
- <select name="method" class="lenya-form-element-verynarrow">
- <option value="deny"><i18n:text>deny</i18n:text></option>
- <option value="grant"><i18n:text>grant</i18n:text></option>
- </select>
- </td>
- <td>
- <input i18n:attr="value" type="submit" name="addCredential_ipRange"
- value="Add"/>
- </td>
- </form>
- </tr>
-
- <tr>
- <form method="post" id="form-addCredential_world">
- <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="submit" value="Submit"/>
- <td>
- <i18n:text>world</i18n:text>
- </td>
- <td/>
- <td>
- <select name="role" class="lenya-form-element-verynarrow">
- <jx:forEach var="role" items="${usecase.getParameter('roles')}">
- <option value="${role}">
- <jx:out value="${role}"/>
- </option>
- </jx:forEach>
- </select>
- </td>
- <td>
- <select name="method" class="lenya-form-element-verynarrow">
- <option value="deny"><i18n:text>deny</i18n:text></option>
- <option value="grant"><i18n:text>grant</i18n:text></option>
- </select>
- </td>
- <td>
- <input i18n:attr="value" type="submit" name="addCredential_world"
- value="Add"/>
- </td>
- </form>
- </tr>
-
- </table>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/ac/ssl-form.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/ac/ssl-form.jx
deleted file mode 100644
index 2d1fb95..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/ac/ssl-form.jx
+++ /dev/null
@@ -1,64 +0,0 @@
-<?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.
--->
-
-<!-- $Id: ac.jx 156161 2005-03-04 15:23:21Z andreas $ -->
-<jx:template
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns="http://www.w3.org/1999/xhtml"
- name="">
-<jx:set var="area" value="${usecase.getParameter('document').getArea()}"/>
-<form method="POST" name="form_ssl_${area}" id="form_ssl_${area}">
- <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.submit" value="ok"/>
- <input type="hidden" name="change_ssl" value="true"/>
- <jx:set var="ssl" value="${usecase.getParameter('ssl')}"/>
- <jx:set var="ancestorSsl" value="${usecase.getParameter('ancestorSsl')}"/>
- <jx:choose>
- <jx:when test="${ssl.equals('true') || ancestorSsl.equals('true')}">
- <jx:choose>
- <jx:when test="${ancestorSsl.equals('true')}">
- <input type="checkbox" name="ssl" checked="checked" disabled="disabled">
- <i18n:text>SSL Encryption</i18n:text>
- </input>
- </jx:when>
- <jx:otherwise>
- <input type="checkbox" name="ssl" onchange="document.forms.form_ssl_${area}.submit()" checked="checked">
- <i18n:text>SSL Encryption</i18n:text>
- </input>
- </jx:otherwise>
- </jx:choose>
- </jx:when>
- <jx:otherwise>
- <jx:choose>
- <jx:when test="${ancestorSsl.equals('true')}">
- <input type="checkbox" name="ssl" disabled="disabled">
- <i18n:text>SSL Encryption</i18n:text>
- </input>
- </jx:when>
- <jx:otherwise>
- <input type="checkbox" name="ssl" onchange="document.forms.form_ssl_${area}.submit()">
- <i18n:text>SSL Encryption</i18n:text>
- </input>
- </jx:otherwise>
- </jx:choose>
- </jx:otherwise>
- </jx:choose>
-</form>
-</jx:template>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/acArchive.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/acArchive.jx
deleted file mode 100644
index 421d63b..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/acArchive.jx
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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.
--->
-
-<!-- $Id: ac.jx 156161 2005-03-04 15:23:21Z andreas $ -->
-<jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/ac/ac.jx"
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"/>
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/acAuthoring.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/acAuthoring.jx
deleted file mode 100644
index 421d63b..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/acAuthoring.jx
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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.
--->
-
-<!-- $Id: ac.jx 156161 2005-03-04 15:23:21Z andreas $ -->
-<jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/ac/ac.jx"
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"/>
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/acLive.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/acLive.jx
deleted file mode 100644
index 421d63b..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/acLive.jx
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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.
--->
-
-<!-- $Id: ac.jx 156161 2005-03-04 15:23:21Z andreas $ -->
-<jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/ac/ac.jx"
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"/>
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/acTrash.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/acTrash.jx
deleted file mode 100644
index 421d63b..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/acTrash.jx
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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.
--->
-
-<!-- $Id: ac.jx 156161 2005-03-04 15:23:21Z andreas $ -->
-<jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/ac/ac.jx"
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"/>
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/assets.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/assets.jx
deleted file mode 100644
index 9b3ab4f..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/assets.jx
+++ /dev/null
@@ -1,88 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
-
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/head.jx"/>
- <page:body>
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/sitetree.jx"/>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab-sitetree">
-
- <h1><i18n:text>Assets</i18n:text></h1>
-
- <jx:choose>
- <jx:when test="${usecase.getParameter('resourceDocuments').size() == 0}">
- <i18n:text>no-assets</i18n:text>
- </jx:when>
- <jx:otherwise>
- <table class="lenya-table-list-noborder">
- <tr>
- <th><i18n:text>Title</i18n:text></th>
- <th><i18n:text>Preview</i18n:text></th>
- <th><i18n:text>File Size</i18n:text></th>
- <th><i18n:text>Dimension (w x h)</i18n:text></th>
- <th><i18n:text>Creation Date</i18n:text></th>
- </tr>
- <jx:forEach var="doc" items="${usecase.getParameter('resourceDocuments')}">
- <tr>
- <jx:set var="title" value="${doc.getMetaData('http://purl.org/dc/elements/1.1/').getFirstValue('title')}"/>
- <td>
- <a href="${doc.getCanonicalWebappURL()}"><jx:out value="${title}"/></a>
- </td>
- <td>
- <jx:set var="mimeType" value="${doc.getMimeType()}"/>
- <jx:if test="${mimeType.startsWith('image/')}">
- <jx:set var="extension" value="${doc.getSourceExtension()}"/>
- <jx:set var="url" value="${doc.getCanonicalWebappURL()}"/>
- <jx:set var="imageUrl" value="${url.replaceFirst('\.html', '\.' + extension)}"/>
- <img src="${imageUrl}"
- style="height: 32px; vertical-align: middle;"/> 
- </jx:if>
- </td>
- <td align="right"><jx:out value="${doc.getContentLength() / 1000}"/> kB</td>
- <td align="right">
- <jx:if test="${mimeType.startsWith('image/')}">
- <jx:set var="mediaMeta" value="${doc.getMetaData('http://apache.org/lenya/metadata/media/1.0')}"/>
- <jx:out value="${mediaMeta.getFirstValue('width')}"/> x <jx:out value="${mediaMeta.getFirstValue('height')}"/>
- </jx:if>
- </td>
- <td align="right"><jx:out value="${java.text.DateFormat.getDateInstance().format(doc.getLastModified())}"/></td>
- </tr>
- </jx:forEach>
- </table>
- </jx:otherwise>
- </jx:choose>
-
- <jx:if test="${usecase.getParameter('document').getArea().equals('authoring')}">
- <form method="GET" id="form-add_asset" style="margin-top: 20px">
- <input type="hidden" name="lenya.usecase" value="resource.create"/>
- <input type="hidden" name="doctype" value="resource"/>
- <input type="hidden" name="lenya.exitUsecase" value="tab.assets"/>
- <input type="hidden" name="lenya.exitUri" value="${usecase.getParameter('document').getCanonicalWebappURL()}"/>
- <input i18n:attr="value" name="submit" type="submit" value="New Asset"/>
- </form>
- </jx:if>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/head.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/head.jx
deleted file mode 100644
index 5f63dbd..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/head.jx
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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.
--->
-
-<!-- $Id: overview.jx 123960 2005-01-03 12:39:05Z andreas $ -->
-
-<jx:template
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns="http://www.w3.org/1999/xhtml"
- name="">
-
- <page:head>
- <jx:set var="pubId" value="${usecase.getParameter('document').getPublication().getId()}"/>
- <jx:set var="area" value="${usecase.getParameter('document').getArea()}"/>
- <jx:set var="language" value="${usecase.getParameter('document').getLanguage()}"/>
- <script src="/modules/sitetree/javascript/tree.js"/>
- <script src="/modules/sitetree/javascript/lenyatree.js"/>
- <script src="/modules/sitetree/javascript/navtree.js"/>
- <script src="/modules/sitemanagement/javascript/lenyaTabs.js"/>
- </page:head>
-</jx:template>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/meta.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/meta.jx
deleted file mode 100644
index 06a0ad3..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/meta.jx
+++ /dev/null
@@ -1,104 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/head.jx"/>
-
- <jx:set var="count" value="${usecase.getParameter('numbers').size()}"/>
- <page:body onload="lenyaInitTabs(${count})">
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/sitetree.jx"/>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab-sitetree">
- <h1 id="form-meta" style="width: 600px"><i18n:text>Meta Data</i18n:text></h1>
- <form>
-
- <jx:set var="num2namespace" value="${usecase.getParameter('namespaces')}"/>
-
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
-
- <jx:set var="count" value="${usecase.getParameter('numbers').size()}"/>
- <jx:forEach var="num" items="${usecase.getParameter('numbers')}">
- <div class="lenyaTabTitle" id="lenyaTabTitle${num}" onclick="lenyaToggleTab(${count}, ${num})">
- <!--<i18n:text>Namespace</i18n:text>:-->
- <a><i18n:text><jx:out value="${num2namespace.get(num)}"/></i18n:text></a>
- </div>
- </jx:forEach>
- <jx:forEach var="num" items="${usecase.getParameter('numbers')}">
- <div class="lenyaTabBody" id="lenyaTabBody${num}">
- <table class="lenya-table-list-noborder">
- <jx:forEach var="key" items="${usecase.getParameter('keys')}">
- <jx:if test="${key.startsWith('ns' + num + '.')}">
- <tr>
- <td class="lenya-entry-caption">
- <label for="${key}"><i18n:text><jx:out value="${key.substring(key.indexOf('.')).substring(1)}"/></i18n:text>:</label>
- </td>
- <td>
- <jx:set var="wrapper" value="${usecase.getParameter(key)}"/>
- <jx:set var="values" value="${wrapper.getValues()}"/>
- <jx:choose>
- <jx:when test="${wrapper.getElement().isEditable()}">
- <jx:choose>
- <jx:when test="${values.size() > 0}">
- <input type="text" id="${key}" name="${key}" class="lenya-form-element" value="${values[0]}"/>
- </jx:when>
- <jx:otherwise>
- <input type="text" id="${key}" name="${key}" class="lenya-form-element" value=""/>
- </jx:otherwise>
- </jx:choose>
- </jx:when>
- <jx:otherwise>
- <jx:set var="value" value="${wrapper.getValue()}"/>
- <jx:choose>
- <jx:when test="${values.size() == 0}"><em><i18n:text>value-not-set</i18n:text></em></jx:when>
- <jx:otherwise>
- <jx:forEach var="value" items="${values}">
- ${value}<br/>
- </jx:forEach>
- </jx:otherwise>
- </jx:choose>
- </jx:otherwise>
- </jx:choose>
- </td>
- </tr>
- </jx:if>
- </jx:forEach>
- </table>
- </div>
- </jx:forEach>
-
- <jx:choose>
- <jx:when
- test="${usecase.getParameter('document').getArea().equals('authoring') && ! usecase.hasErrors()}">
- <input i18n:attr="value" name="submit" type="submit" value="Save"/>
- </jx:when>
- <jx:otherwise>
- <input i18n:attr="value" name="submit" type="submit" disabled="disabled" value="Save"/>
- </jx:otherwise>
- </jx:choose>
-
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- </form>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/overview.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/overview.jx
deleted file mode 100644
index 224d397..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/overview.jx
+++ /dev/null
@@ -1,153 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/head.jx"/>
- <page:body>
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/sitetree.jx"/>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab-sitetree">
- <h1><i18n:text>Overview</i18n:text></h1>
- <jx:choose>
- <jx:when test="${not(empty(usecase.getParameter('title')))}">
- <jx:set var="document" value="${usecase.getParameter('document')}"/>
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Title</i18n:text>:</td>
- <td>
- <jx:out value="${usecase.getParameter('title')}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Description</i18n:text>:</td>
- <td>
- <jx:out value="${usecase.getParameter('description')}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Workflow State</i18n:text>:</td>
- <td>
- <jx:choose>
- <jx:when test="${not(empty(usecase.getParameter('state')))}">
- <i18n:text><jx:out value="${usecase.getParameter('state')}"/></i18n:text>
- </jx:when>
- <jx:otherwise><span style="color: #999999;"><i18n:text>[no workflow]</i18n:text></span></jx:otherwise>
- </jx:choose>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Live</i18n:text>:</td>
- <td>
- <i18n:text><jx:out value="${usecase.getParameter('isLive')}"/></i18n:text>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Available Languages</i18n:text>:</td>
- <td>
- <jx:forEach var="language" items="${usecase.getParameter('languages')}">
- <jx:choose>
- <jx:when test="${language.equals(document.getLanguage())}">
- <jx:out value="${language}"/>
- </jx:when>
- <jx:otherwise>
- <jx:set var="translation" value="${document.getTranslation(language)}"/>
- <a href="${translation.getCanonicalWebappURL()}?lenya.usecase=tab.overview">
- <jx:out value="${language}"/></a>
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </td>
- </tr>
- <jx:set var="docLanguages" value="${document.getLanguages().size()}"/>
- <jx:set var="pubLanguages" value="${document.getPublication().getLanguages().size()}"/>
- <jx:if test="${docLanguages lt pubLanguages}">
- <tr>
- <td class="lenya-entry-caption"><i18n:text>missing-languages</i18n:text>:</td>
- <td>
- <jx:forEach var="language" items="${document.getPublication().getLanguages()}">
- <jx:if test="${!document.existsTranslation(language)}">
- <a href="?lenya.usecase=sitemanagement.createLanguage&lenya.exitUsecase=tab.overview&language=${language}">
- <jx:out value="${language}"/></a>
- </jx:if>
- </jx:forEach>
- </td>
- </tr>
- </jx:if>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Last modified</i18n:text>:</td>
- <td>
- <jx:out value="${usecase.getParameter('lastmodified')}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>UUID</i18n:text>:</td>
- <td>
- <jx:out value="${document.getUUID()}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Path</i18n:text>:</td>
- <td>
- <jx:out value="${document.getPath()}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Resource Type</i18n:text>:</td>
- <td>
- <i18n:text>resourceType-<jx:out value="${document.getResourceType().getName()}"/></i18n:text>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Mime Type</i18n:text>:</td>
- <td>
- <jx:out value="${document.getMimeType()}"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Document Size</i18n:text>:</td>
- <td>
- <jx:out value="${document.getContentLength()}"/> B
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><i18n:text>Visible in Navigation</i18n:text>:</td>
- <td>
- <i18n:text><jx:out value="${usecase.getParameter('visibleInNav')}"/></i18n:text>
- </td>
- </tr>
- </table>
- </jx:when>
- <jx:when test="${usecase.getParameter('languageexists').equals('false')}">
- <i18n:text>This document is not available in this language.</i18n:text><br/><br/>
- <i18n:text>Available Languages</i18n:text>: <jx:out value="${usecase.getParameter('languages')}"/>
- </jx:when>
- <jx:otherwise><i18n:text>No overview available.</i18n:text></jx:otherwise>
- </jx:choose>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/revisions.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/revisions.jx
deleted file mode 100644
index 21bb6e4..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/revisions.jx
+++ /dev/null
@@ -1,140 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
-
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/head.jx"/>
-
- <!-- if the usecase cannot be invoked, find the cause: -->
- <jx:choose>
- <jx:when test="${usecase.getParameter('canRollback') == 'true'}">
- <jx:set var="rollbackMessage" value="rollback-ok"/>
- </jx:when>
- <jx:otherwise>
- <jx:choose>
- <jx:when test="${usecase.getParameter('workflowState') == 'review'}">
- <jx:set var="rollbackMessage" value="no-rollback-in-review"/>
- </jx:when>
- <jx:otherwise>
- <jx:set var="rollbackMessage" value="no-rollback-no-privileges"/>
- </jx:otherwise>
- </jx:choose>
- </jx:otherwise>
- </jx:choose>
-
- <page:head>
- <script type="text/javascript">
-
- function showRevision(revision) {
- window.open(
- '?lenya.revision=' + revision,
- 'Lenya_ViewRevision',
- 'menubar=no,addressbar=no,toolbar=no,statusbar=no'
- );
- }
-
- function rollback(toRevision) {
- window.location.href="?lenya.usecase=sitemanagement.rollback"
- + String.fromCharCode(38) // an & does not work, since it's not being decoded
- + "rollbackRevision=" + toRevision;
- }
-
- </script>
- </page:head>
- <page:body>
-
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/sitetree.jx"/>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
-
- <div id="contentblock1" class="lenya-tab-sitetree">
- <h1><i18n:text>Revisions</i18n:text></h1>
-
- <form name="revisions">
-
- <table class="lenya-table-list-noborder">
-
- <tr>
- <th><i18n:text>No.</i18n:text></th>
- <th><i18n:text>Time</i18n:text></th>
- <th><i18n:text>Editor</i18n:text></th>
- <th><i18n:text>Actions</i18n:text></th>
- </tr>
-
- <jx:set var="count" value="${usecase.getParameter('revisions').size()}"/>
- <jx:set var="isFirstItem" value="true"/>
- <jx:forEach var="revision" items="${usecase.getParameter('revisions')}" begin="0">
- <tr>
- <td align="right">
- <input
- type="button"
- i18n:attr="title"
- onclick="showRevision(${revision.getNumber()});"
- title="view-revision-in-new-window"
- value="${revision.getNumber()}"
- />
- </td>
- <td align="right"><i18n:date-time src-pattern="yyyy-MM-dd HH:mm:ss"><jx:formatDate value="${revision.getTime()}" pattern="yyyy-MM-dd HH:mm:ss"/></i18n:date-time></td>
- <td><jx:out value="${revision.getUserId()}"/></td>
- <td>
- <input
- type="button"
- i18n:attr="value title"
- onclick="showRevision(${revision.getNumber()});"
- title="view-revision-in-new-window"
- value="view-revision"
- />
- <jx:choose>
- <jx:when test="${isFirstItem == 'true'}">
- <jx:set var="isFirstItem" value="false"/>
- <i18n:text key="is-current-version"/>
- </jx:when>
- <jx:when test="${usecase.getParameter('canRollback') == 'true'}">
-  
- <input type="button" i18n:attr="value title" title="${rollbackMessage}" value="rollback"
- onclick="void rollback(${revision.getNumber()});"
- />
- </jx:when>
- <jx:otherwise>
- <input type="button" i18n:attr="value title" title="${rollbackMessage}" disabled="disabled" value="rollback"/>
- </jx:otherwise>
- </jx:choose>
- </td>
- </tr>
- </jx:forEach>
-
- <jx:if test="${usecase.getParameter('canRollback') != 'true'}">
- <tr>
- <td/>
- <td colspan="3">
- <strong><i18n:text key="${rollbackMessage}"/></strong>
- </td>
- </tr>
- </jx:if>
-
- </table>
-
- </form>
-
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/scheduler.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/scheduler.jx
deleted file mode 100644
index fa5d378..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/scheduler.jx
+++ /dev/null
@@ -1,70 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/head.jx"/>
- <page:body>
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/sitetree.jx"/>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab-sitetree">
-
- <h1><i18n:text>Scheduler</i18n:text></h1>
-
- <jx:choose>
- <jx:when test="${usecase.getParameter('jobs').size() == 0}">
- <i18n:text>no-jobs-scheduled</i18n:text>
- </jx:when>
- <jx:otherwise>
- <table class="lenya-table-list-noborder">
- <tr>
- <th><i18n:text>Job</i18n:text></th>
- <th><i18n:text>User</i18n:text></th>
- <th><i18n:text>Time</i18n:text></th>
- </tr>
- <jx:forEach var="job" items="${usecase.getParameter('jobs')}">
- <!-- see UsecaseSchedulerImpl for job name encoding -->
- <jx:set var="name" value="${job.getName()}"/>
- <jx:set var="parts" value="${name.split(':')}"/>
- <jx:set var="usecaseName" value="${parts[0]}"/>
- <jx:set var="userId" value="${parts[1]}"/>
- <tr>
- <td>
- <jx:out value="${usecaseName}"/>
- </td>
- <td>
- <a href="${usecase.getSourceURL()}?lenya.usecase=admin.user&userId=${userId}"><jx:out value="${userId}"/></a>
- </td>
- <td>
- <i18n:date-time src-pattern="yyyy-MM-dd HH:mm:ss Z">
- <jx:formatDate pattern="yyyy-MM-dd HH:mm:ss Z" value="${job.getNextTime()}"/>
- </i18n:date-time>
- </td>
- </tr>
- </jx:forEach>
- </table>
- </jx:otherwise>
- </jx:choose>
-
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/sitetree.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/sitetree.jx
deleted file mode 100644
index d6bc6ef..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/sitetree.jx
+++ /dev/null
@@ -1,123 +0,0 @@
-<?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.
--->
-
-<!-- $Id: overview.jx 123960 2005-01-03 12:39:05Z andreas $ -->
-
-<jx:template
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns:proxy="http://apache.org/lenya/proxy/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- name="">
-
- <jx:set var="url" value="${usecase.getParameter('private.sourceUrl')}"/>
- <jx:set var="steps" value="${url.split('/')}"/>
- <jx:set var="area" value="${steps[2]}"/>
- <jx:set var="publicationId" value="${steps[1]}"/>
- <jx:set var="factory" value="${usecase.getParameter('private.factory')}"/>
- <jx:set var="publication" value="${factory.getPublication(publicationId)}"/>
-
- <jx:set var="document" value="${usecase.getParameter('document')}"/>
- <jx:set var="docExists" value="${java.lang.Boolean.valueOf(document.getClass().getName().equals('org.apache.lenya.cms.publication.DocumentImpl'))}"/>
-
- <div id="lenya-info-treecanvas">
- <div class="lenya-tabs">
- <jx:forEach var="language" items="${publication.getLanguages()}">
- <jx:choose>
- <jx:when test="${!docExists.booleanValue() && url.endsWith('_' + language)}">
- <a id="${language}" class="lenya-tablink-active"><jx:out value="${language}"/></a>
- </jx:when>
- <jx:when test="${!docExists.booleanValue() && url.endsWith('/') && language.equals(publication.getDefaultLanguage())}">
- <a id="${language}" class="lenya-tablink-active"><jx:out value="${language}"/></a>
- </jx:when>
- <jx:when test="${document != null && document.existsTranslation(language)}">
- <jx:set var="languageVersion" value="${document.getFactory().getLanguageVersion(document, language)}"/>
- <jx:set var="languageUrl" value="${'/' + publicationId + '/' + area + languageVersion.getCanonicalDocumentURL()}"/>
- <jx:choose>
- <jx:when test="${language.equals(document.getLanguage())}">
- <a id="${language}" class="lenya-tablink-active" href="${languageUrl}?lenya.usecase=${usecase.getName()}"><jx:out value="${language}"/></a>
- </jx:when>
- <jx:otherwise>
- <a id="${language}" class="lenya-tablink" href="${languageUrl}?lenya.usecase=${usecase.getName()}"><jx:out value="${language}"/></a>
- </jx:otherwise>
- </jx:choose>
- </jx:when>
- <jx:otherwise>
- <a id="${language}" class="lenya-tablink" title="This language version doesn't exist.">
- <jx:out value="${language}"/>
- </a>
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </div>
-
- <div id="lenya-info-tree">
- <div id="tree">
- <script type="text/javascript">
- WEBAPP_BASE_PATH = '<proxy:url href="/"/>';
- AREA_BASE_PATH = '<proxy:url href="/${publicationId}/${area}"/>';
-
- PUBLICATION_ID = '<jx:out value="${publicationId}"/>';
- <jx:choose>
- <jx:when test="${docExists.booleanValue()}">
- CHOSEN_LANGUAGE = '<jx:out value="${document.getLanguage()}"/>';
- </jx:when>
- <jx:otherwise>
- CHOSEN_LANGUAGE = '<jx:out value="${publication.getDefaultLanguage()}"/>';
- </jx:otherwise>
- </jx:choose>
- DEFAULT_LANGUAGE = '<jx:out value="${publication.getDefaultLanguage()}"/>';
- IMAGE_PATH = '<proxy:url href="/lenya/images/tree/"/>';
-
-
- <jx:set var="clipboard" value="${request.getSession().getAttribute('org.apache.lenya.cms.site.usecases.Clipboard')}"/>
- <jx:choose>
- <jx:when test="${clipboard != null && clipboard.getMethod() == Packages.org.apache.lenya.cms.site.usecases.Clipboard.METHOD_CUT}">
- <jx:set var="cutDocument" value="${clipboard.getDocument(publication.getFactory(), publication)}"/>
- CUT_DOCUMENT_ID = '<jx:out value="${cutDocument.getPath()}"/>';
- </jx:when>
- <jx:otherwise>
- CUT_DOCUMENT_ID = '';
- </jx:otherwise>
- </jx:choose>
-
- ALL_AREAS = 'authoring,trash,archive';
- PIPELINE_PATH = '/sitetree-fragment.xml';
- SHOW_LOADING_HINT = true;
- SHOW_ICONS = true;
-
- <jx:set var="pubName" value="${publication.getName()}"/>
- var pubName = '<i18n:translate><i18n:text>... Publication</i18n:text><i18n:param><jx:out value="${pubName}"/></i18n:param></i18n:translate>';
-
- var tree = new NavTree(document, document.getElementById('tree'));
-
- tree.init(PUBLICATION_ID, pubName);
- tree.render();
- <jx:choose>
- <jx:when test="${docExists.booleanValue()}">
- tree.loadInitialTree('<jx:out value="${area}"/>', '<jx:out value="${document.getPath()}"/>');
- </jx:when>
- <jx:otherwise>
- tree.loadInitialTree('<jx:out value="${area}"/>', '');
- </jx:otherwise>
- </jx:choose>
- </script>
- </div>
- </div>
- </div>
-</jx:template>
\ No newline at end of file
diff --git a/trunk/src/modules-core/sitemanagement/usecases/tab/workflow.jx b/trunk/src/modules-core/sitemanagement/usecases/tab/workflow.jx
deleted file mode 100644
index 4165c52..0000000
--- a/trunk/src/modules-core/sitemanagement/usecases/tab/workflow.jx
+++ /dev/null
@@ -1,72 +0,0 @@
-<?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.
--->
-
-<!-- $Id$ -->
-
-<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/head.jx"/>
- <page:body>
- <jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/sitetree.jx"/>
- <jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
- <div id="contentblock1" class="lenya-tab-sitetree">
- <h1><i18n:text>Workflow</i18n:text></h1>
- <!--
- <table class="lenya-table-list-noborder">
- <tr><th><i18n:text>Name</i18n:text></th><th><i18n:text>Value</i18n:text></th></tr>
- <jx:forEach var="item" items="${usecase.getParameter('variables')}">
- <tr>
- <td>
- <jx:out value="${item.name}"/>
- </td>
- <td>
- <jx:out value="${item.value}"/>
- </td>
- </tr>
- </jx:forEach>
- </table>
- -->
- <table class="lenya-table-list-noborder">
- <tr>
- <th><i18n:text>Date</i18n:text></th>
- <th><i18n:text>Event</i18n:text></th>
- <th><i18n:text>State</i18n:text></th>
- <th><i18n:text>User</i18n:text></th>
- <th><i18n:text>IP Address</i18n:text></th>
- </tr>
- <jx:forEach var="item" items="${usecase.getParameter('versions')}" varStatus="status">
- <tr>
- <td><jx:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${item.getDate()}"/></td>
- <td><i18n:text><jx:out value="${item.event}"/></i18n:text></td>
- <td><i18n:text><jx:out value="${item.state}"/></i18n:text></td>
- <td>
- <span style="white-space: nobreak">
- <jx:out value="${item.userId}"/>
- </span>
- </td>
- <td>
- <jx:out value="${item.iPAddress}"/>
- </td>
- </tr>
- </jx:forEach>
- </table>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/templating/config/cocoon-xconf/template-manager.xconf b/trunk/src/modules-core/templating/config/cocoon-xconf/template-manager.xconf
deleted file mode 100644
index 7d80353..0000000
--- a/trunk/src/modules-core/templating/config/cocoon-xconf/template-manager.xconf
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon"
- unless="/cocoon/component[@role = 'org.apache.lenya.cms.publication.templating.PublicationTemplateManager']">
- <component logger="lenya.publication.templatemanager"
- class="org.apache.lenya.cms.publication.templating.PublicationTemplateManagerImpl"
- role="org.apache.lenya.cms.publication.templating.PublicationTemplateManager"/>
- </xconf>
diff --git a/trunk/src/modules-core/templating/config/cocoon-xconf/usecase-createPulicationFromTemplate.xconf b/trunk/src/modules-core/templating/config/cocoon-xconf/usecase-createPulicationFromTemplate.xconf
deleted file mode 100644
index f1c351b..0000000
--- a/trunk/src/modules-core/templating/config/cocoon-xconf/usecase-createPulicationFromTemplate.xconf
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'templating.createPublicationFromTemplate']">
- <component-instance name="templating.createPublicationFromTemplate" logger="lenya.publication"
- class="org.apache.lenya.cms.publication.usecases.CreatePublicationFromTemplate">
- <view uri="modules/templating/usecases/createPublicationFromTemplate.jx"/>
- </component-instance>
- </xconf>
diff --git a/trunk/src/modules-core/templating/config/module.xml b/trunk/src/modules-core/templating/config/module.xml
deleted file mode 100644
index 00ad022..0000000
--- a/trunk/src/modules-core/templating/config/module.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.templating</id>
- <depends module="org.apache.lenya.modules.usecase"/>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>Publication templating implementation</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>Publication templating implementation</description>
-</module>
diff --git a/trunk/src/modules-core/templating/java/src/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java b/trunk/src/modules-core/templating/java/src/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java
deleted file mode 100644
index 21b2773..0000000
--- a/trunk/src/modules-core/templating/java/src/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java
+++ /dev/null
@@ -1,251 +0,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.
- *
- */
-
-package org.apache.lenya.cms.publication.templating;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-
-/**
- * Manager for publication templates.
- *
- * @version $Id: PublicationTemplateManagerImpl.java 474729 2006-11-14 11:07:44Z
- * andreas $
- */
-public class PublicationTemplateManagerImpl extends AbstractLogEnabled implements
- PublicationTemplateManager, Serviceable {
-
- /**
- * Ctor.
- */
- public PublicationTemplateManagerImpl() {
- }
-
- /**
- * @see org.apache.lenya.cms.publication.templating.PublicationTemplateManager#visit(org.apache.lenya.cms.publication.Publication,
- * java.lang.String,
- * org.apache.lenya.cms.publication.templating.SourceVisitor)
- */
- public void visit(Publication publication, String path, SourceVisitor visitor) {
-
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
-
- String[] baseUris = getBaseURIs(publication);
- for (int i = 0; i < baseUris.length; i++) {
- String uri = baseUris[i] + "/" + path;
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Trying to resolve URI [" + uri + "]");
- }
-
- visitor.visit(resolver, uri);
- }
-
- } catch (Exception e) {
- throw new TemplatingException("Visiting path [" + path + "] failed: ", e);
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- }
-
- }
-
- private ServiceManager manager;
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager _manager) throws ServiceException {
- this.manager = _manager;
- }
-
- /**
- * Returns the publication.
- * @return A publication. protected Publication getPublication1() { return
- * this.publication; }
- */
-
- /**
- * Returns the base URIs in traversing order.
- * @param publication The original publication.
- * @return An array of strings.
- */
- protected String[] getBaseURIs(Publication publication) {
-
- List uris = new ArrayList();
-
- Publication[] publications = getPublications(publication);
- for (int i = 0; i < publications.length; i++) {
- uris.add(getBaseURI(publications[i]));
- }
-
- String coreBaseURI = publication.getServletContext().getAbsolutePath() + "/";
- uris.add(coreBaseURI);
-
- return (String[]) uris.toArray(new String[uris.size()]);
- }
-
- /**
- * Returns the base URI for a certain publication.
- * @param publication The publication.
- * @return A string.
- */
- public static String getBaseURI(Publication publication) {
- return publication.getDirectory().getAbsolutePath() + "/";
- }
-
- /**
- * @see org.apache.lenya.cms.publication.templating.PublicationTemplateManager#visit(org.apache.lenya.cms.publication.Publication,
- * org.apache.lenya.cms.publication.templating.PublicationVisitor)
- */
- public void visit(Publication publication, PublicationVisitor visitor) {
- SourceResolver resolver = null;
- try {
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
-
- Publication[] publications = getPublications(publication);
- for (int i = 0; i < publications.length; i++) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Visiting publication [" + publications[i] + "]");
- }
- visitor.visit(publications[i]);
- }
-
- } catch (Exception e) {
- throw new TemplatingException("Visiting publications failed: ", e);
- } finally {
- if (resolver != null) {
- this.manager.release(resolver);
- }
- }
-
- }
-
- /**
- * Returns the publications in traversing order.
- * @param publication The original publication.
- * @return An array of strings.
- */
- protected Publication[] getPublications(Publication publication) {
-
- List publications = new ArrayList();
-
- publications.add(publication);
-
- String[] templateIds = publication.getTemplateIds();
- for (int i = 0; i < templateIds.length; i++) {
- try {
- Publication template = publication.getFactory().getPublication(templateIds[i]);
- Publication[] templateTemplates = getPublications(template);
- publications.addAll(Arrays.asList(templateTemplates));
- } catch (PublicationException e) {
- throw new RuntimeException(e);
- }
- }
-
- return (Publication[]) publications.toArray(new Publication[publications.size()]);
- }
-
- /**
- * @see org.apache.lenya.cms.publication.templating.PublicationTemplateManager#getSelectableHint(org.apache.lenya.cms.publication.Publication,
- * org.apache.avalon.framework.service.ServiceSelector,
- * java.lang.String)
- */
- public Object getSelectableHint(Publication publication, ServiceSelector selector,
- final String originalHint) throws ServiceException {
- Object selectableHint = null;
-
- try {
- ExistingServiceVisitor resolver = new ExistingServiceVisitor(selector, originalHint,
- getLogger());
- visit(publication, resolver);
- selectableHint = resolver.getSelectableHint();
- if (selectableHint == null) {
- selectableHint = originalHint;
- }
-
- } catch (Exception e) {
- String message = "Resolving hint [" + originalHint + "] failed: ";
- getLogger().error(message, e);
- throw new RuntimeException(message, e);
- }
- return selectableHint;
- }
-
- /**
- * Searches for a declared service of the form "publicationId/service".
- */
- public class ExistingServiceVisitor implements PublicationVisitor {
-
- /**
- * Ctor.
- * @param selector The service selector to use.
- * @param hint The hint to check.
- * @param logger The logger.
- */
- public ExistingServiceVisitor(ServiceSelector selector, Object hint, Logger logger) {
- this.selector = selector;
- this.hint = hint;
- this.logger = logger;
- }
-
- private ServiceSelector selector;
- private Object hint;
- private Object selectableHint = null;
- private Logger logger;
-
- /**
- * @see org.apache.lenya.cms.publication.templating.PublicationVisitor#visit(org.apache.lenya.cms.publication.Publication)
- */
- public void visit(Publication publication) {
- String publicationHint = publication.getId() + "/" + this.hint;
- boolean success = false;
- if (this.selector.isSelectable(publicationHint)) {
- this.selectableHint = publicationHint;
- success = true;
- }
- if (this.logger.isDebugEnabled()) {
- this.logger.debug("Checking hint [" + publicationHint + "]: " + success);
- }
- }
-
- /**
- * @return The publication hint that could be selected or
- * <code>null</code> if no hint could be selected.
- */
- public Object getSelectableHint() {
- return this.selectableHint;
- }
-
- }
-
-}
diff --git a/trunk/src/modules-core/templating/java/src/org/apache/lenya/cms/publication/usecases/CreatePublicationFromTemplate.java b/trunk/src/modules-core/templating/java/src/org/apache/lenya/cms/publication/usecases/CreatePublicationFromTemplate.java
deleted file mode 100644
index e221d3a..0000000
--- a/trunk/src/modules-core/templating/java/src/org/apache/lenya/cms/publication/usecases/CreatePublicationFromTemplate.java
+++ /dev/null
@@ -1,108 +0,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.
- *
- */
-package org.apache.lenya.cms.publication.usecases;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationUtil;
-import org.apache.lenya.cms.publication.templating.Instantiator;
-import org.apache.lenya.cms.usecase.AbstractUsecase;
-
-/**
- * Create a new publication based on a template publication.
- *
- * @version $Id$
- */
-public class CreatePublicationFromTemplate extends AbstractUsecase {
-
- protected static final String AVAILABLE_TEMPLATES = "availableTemplates";
- protected static final String PUBLICATION_ID = "publicationId";
- protected static final String PUBLICATION_NAME = "publicationName";
- protected static final String TEMPLATE = "template";
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
- */
- protected void initParameters() {
- super.initParameters();
-
- Publication[] pubs = getDocumentFactory().getPublications();
- List templates = new ArrayList();
- for (int i = 0; i < pubs.length; i++) {
- if (pubs[i].getInstantiatorHint() != null) {
- templates.add(pubs[i].getId());
- }
- }
- Collections.sort(templates);
- setParameter(AVAILABLE_TEMPLATES, templates);
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
- */
- protected void doCheckExecutionConditions() throws Exception {
- super.doCheckExecutionConditions();
-
- String publicationId = getParameterAsString(PUBLICATION_ID).trim();
-
- if (!PublicationUtil.isValidPublicationID(publicationId)) {
- addErrorMessage("Please enter a valid publication ID!");
- } else {
- if (getDocumentFactory().existsPublication(publicationId)) {
- addErrorMessage("A publication with this ID already exists.");
- }
- }
- }
-
- /**
- * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
- */
- protected void doExecute() throws Exception {
- super.doExecute();
-
- String templateId = getParameterAsString(TEMPLATE);
-
- ServiceSelector selector = null;
- Instantiator instantiator = null;
-
- try {
-
- Publication template = getDocumentFactory().getPublication(templateId);
- String name = getParameterAsString(PUBLICATION_NAME);
-
- selector = (ServiceSelector) this.manager.lookup(Instantiator.ROLE + "Selector");
- instantiator = (Instantiator) selector.select(template.getInstantiatorHint());
-
- instantiator.instantiate(template, getParameterAsString(PUBLICATION_ID), name);
-
- } finally {
- if (selector != null) {
- if (instantiator != null) {
- selector.release(instantiator);
- }
- this.manager.release(selector);
- }
- }
-
- }
-
-}
diff --git a/trunk/src/modules-core/templating/usecases/createPublicationFromTemplate.jx b/trunk/src/modules-core/templating/usecases/createPublicationFromTemplate.jx
deleted file mode 100644
index 79d1c54..0000000
--- a/trunk/src/modules-core/templating/usecases/createPublicationFromTemplate.jx
+++ /dev/null
@@ -1,83 +0,0 @@
-<?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.
--->
-<!-- $Id: renameLabel.jx 123364 2004-12-26 16:11:27Z gregor $ -->
-<page:page xmlns:c="http://apache.org/cocoon/templates/jx/1.0"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
- xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
- xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
- >
-
- <page:title>
- <i18n:text>Create Publication from Template</i18n:text>
- </page:title>
- <page:body>
- <div class="lenya-box">
- <div class="lenya-box-title">
- <i18n:text>Create Publication from Template</i18n:text>
- </div>
- <div class="lenya-box-body">
- <form method="get" action="" id="form-create_pub_from_template">
- <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
- <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
- <table class="lenya-table-noborder">
- <tr>
- <td colspan="2">
- <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
- </td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="publicationId"><i18n:text>Publication ID</i18n:text>:</label></td>
- <td><input type="text" class="lenya-form-element" name="publicationId" value="${usecase.getParameter('publicationId')}"/></td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="publicationName"><i18n:text>Publication Name</i18n:text>:</label></td>
- <td><input type="text" class="lenya-form-element" name="publicationName" value="${usecase.getParameter('publicationName')}"/></td>
- </tr>
- <tr>
- <td class="lenya-entry-caption"><label for="template"><i18n:text>Template</i18n:text>:</label></td>
- <td>
- <select name="template" class="lenya-form-element">
- <jx:forEach var="template" items="${usecase.getParameter('availableTemplates')}">
- <jx:choose>
- <jx:when test="${template.equals(usecase.getParameter('template'))}">
- <option value="${template}" selected="selected"><jx:out value="${template}"/></option>
- </jx:when>
- <jx:otherwise>
- <option value="${template}"><jx:out value="${template}"/></option>
- </jx:otherwise>
- </jx:choose>
- </jx:forEach>
- </select>
- </td>
- </tr>
- <tr>
- <td/>
- <td>
- <br/>
- <input i18n:attr="value" type="submit" name="submit" value="Create"/>
-  
- <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </page:body>
-</page:page>
\ No newline at end of file
diff --git a/trunk/src/modules-core/usecase/config/cocoon-xconf/gui-manager.xconf b/trunk/src/modules-core/usecase/config/cocoon-xconf/gui-manager.xconf
deleted file mode 100644
index e6e0ad9..0000000
--- a/trunk/src/modules-core/usecase/config/cocoon-xconf/gui-manager.xconf
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-
- <xconf xpath="/cocoon" unless="/cocoon/gui-manager">
- <gui-manager/>
- </xconf>
diff --git a/trunk/src/modules-core/usecase/config/cocoon-xconf/test-usecase-invoker.xconf b/trunk/src/modules-core/usecase/config/cocoon-xconf/test-usecase-invoker.xconf
deleted file mode 100644
index 628ae54..0000000
--- a/trunk/src/modules-core/usecase/config/cocoon-xconf/test-usecase-invoker.xconf
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon"
- unless="/cocoon/component[@role = 'org.apache.lenya.cms.usecase.impl.TestUsecaseInvoker']">
- <component logger="lenya.usecase.invoker"
- class="org.apache.lenya.cms.usecase.impl.TestUsecaseInvoker"
- role="org.apache.lenya.cms.usecase.impl.TestUsecaseInvoker"/>
- </xconf>
diff --git a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecase-authorizer.xconf b/trunk/src/modules-core/usecase/config/cocoon-xconf/usecase-authorizer.xconf
deleted file mode 100644
index f7e913d..0000000
--- a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecase-authorizer.xconf
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon/authorizers" unless="/cocoon/authorizers/component-instance[@name = 'usecase']">
- <component-instance name="usecase"
- class="org.apache.lenya.cms.ac.usecase.impl.UsecaseAuthorizerImpl"
- logger="lenya.ac.authorizer.usecase"/>
- </xconf>
-
diff --git a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasecronjob.xconf b/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasecronjob.xconf
deleted file mode 100644
index 14cd8f8..0000000
--- a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasecronjob.xconf
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.cocoon.components.cron.CronJob/usecase']">
- <component role="org.apache.cocoon.components.cron.CronJob/usecase"
- class="org.apache.lenya.cms.usecase.scheduling.impl.UsecaseCronJob"
- logger="cron.usecase"/>
-
- </xconf>
diff --git a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecaseinvoker.xconf b/trunk/src/modules-core/usecase/config/cocoon-xconf/usecaseinvoker.xconf
deleted file mode 100644
index 4f172f2..0000000
--- a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecaseinvoker.xconf
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.cms.usecase.UsecaseInvoker']">
- <component
- role="org.apache.lenya.cms.usecase.UsecaseInvoker"
- class="org.apache.lenya.cms.usecase.impl.UsecaseInvokerImpl"
- logger="lenya.usecase"/>
- </xconf>
-
diff --git a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasemodule.xconf b/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasemodule.xconf
deleted file mode 100644
index 7007dfe..0000000
--- a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasemodule.xconf
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-
-<!-- $Id: doctypes.xconf 164635 2005-04-25 20:01:43Z tschlabach $ -->
-
-<xconf xpath="/cocoon/input-modules" unless="/cocoon/input-modules/component-instance[@name = 'usecase']">
-
- <component-instance logger="core.modules.input.usecase" name="usecase"
- class="org.apache.lenya.cms.usecase.cocoon.UsecaseModule"/>
-
-</xconf>
diff --git a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecaseresolver.xconf b/trunk/src/modules-core/usecase/config/cocoon-xconf/usecaseresolver.xconf
deleted file mode 100644
index 2c64a78..0000000
--- a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecaseresolver.xconf
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.cms.usecase.UsecaseResolver']">
- <component
- role="org.apache.lenya.cms.usecase.UsecaseResolver"
- class="org.apache.lenya.cms.usecase.impl.UsecaseResolverImpl"
- logger="lenya.usecase"/>
- </xconf>
-
diff --git a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecases.xconf b/trunk/src/modules-core/usecase/config/cocoon-xconf/usecases.xconf
deleted file mode 100644
index d6325e6..0000000
--- a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecases.xconf
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-
- <xconf xpath="/cocoon" unless="/cocoon/usecases">
- <usecases/>
- </xconf>
diff --git a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasescheduler.xconf b/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasescheduler.xconf
deleted file mode 100644
index 043f9e7..0000000
--- a/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasescheduler.xconf
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-
-<!-- $Id: usecases-workflow-deactivate.xconf 348547 2005-11-23 20:13:01Z chestnut $ -->
-<!--
- This file defines the publication specific use-cases
--->
-
- <xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.cms.usecase.scheduling.UsecaseScheduler']">
- <component
- role="org.apache.lenya.cms.usecase.scheduling.UsecaseScheduler"
- class="org.apache.lenya.cms.usecase.scheduling.impl.UsecaseSchedulerImpl"
- logger="lenya.usecase"/>
- </xconf>
-
diff --git a/trunk/src/modules-core/usecase/config/module.xml b/trunk/src/modules-core/usecase/config/module.xml
deleted file mode 100644
index 683193e..0000000
--- a/trunk/src/modules-core/usecase/config/module.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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.
--->
-
-<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
-
-<module xmlns="http://apache.org/lenya/module/1.0">
- <id>org.apache.lenya.modules.usecase</id>
- <export package="org.apache.lenya.cms.ac.usecase"/>
- <export package="org.apache.lenya.cms.usecase"/>
- <export package="org.apache.lenya.cms.usecase.scheduling"/>
- <export package="org.apache.lenya.cms.usecase.xml"/>
- <depends module="org.apache.lenya.modules.ac"/>
- <depends module="org.apache.lenya.modules.cache"/>
- <package>org.apache.lenya.modules</package>
- <version>0.1-dev</version>
- <name>Usecase framework API</name>
- <lenya-version>@lenya.version@</lenya-version>
- <description>Usecase framework API</description>
-</module>
diff --git a/trunk/src/modules-core/usecase/config/sitemap/transformers.xmap b/trunk/src/modules-core/usecase/config/sitemap/transformers.xmap
deleted file mode 100644
index 7f42bfe..0000000
--- a/trunk/src/modules-core/usecase/config/sitemap/transformers.xmap
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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.
--->
-
-<xmap xpath="/sitemap/components/transformers"
- unless="/sitemap/components/transformers/transformer[@name = 'usecasemenu']"
- xmlns:map="http://apache.org/cocoon/sitemap/1.0">
- <map:transformer name="usecasemenu" logger="lenya.sitemap.transformer.usecasemenu" src="org.apache.lenya.cms.cocoon.transformation.UsecaseMenuTransformer"/>
-</xmap>
diff --git a/trunk/src/modules-core/usecase/edit-document.js b/trunk/src/modules-core/usecase/edit-document.js
deleted file mode 100644
index 8b86940..0000000
--- a/trunk/src/modules-core/usecase/edit-document.js
+++ /dev/null
@@ -1,125 +0,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.
- *
- */
-
-/*
- This file is deprecated. You should not base new code on it.
- It's still used by Kupu and BXE, that's why it remains for now.
- In the future, generic editor functionality and document handling
- helpers should be provided by the editors module only.
-*/
-
-importClass(Packages.org.apache.lenya.cms.cocoon.flow.FlowHelper);
-importClass(Packages.org.apache.excalibur.source.SourceResolver);
-importClass(Packages.org.apache.lenya.cms.cocoon.source.SourceUtil);
-
-/**
- * Provides general flow functions for document editing.
- * @version $Id$
- */
-
-function checkoutDocument() {
-}
-
-function checkinDocument() {
-}
-
-/**
- * Saves a Source to the document in the current PageEnvelope.
- * TODO: Use nobby's new usecase fw in 2.0 branch. Exception handling e.g. display appropriate error pages.
- * @param sourceUri An URI of a Source providing the edited document data
- * @param useBuffer If "true", the source Source is read into a buffer before it is written to its final destination.
- * @param workflowEvent Name of the workflow event to trigger. Default is "edit".
- * @param noWorkflow If true, no workflow event will be triggered. Default is false.
- * @param noCheckin If true, the current document is not checked in. Default is false.
- * @param backup If true, a new revision is created on checkin. Default is true.
- * @param status Default int value is 204. Used to set the response status.
- * @param noStatus If true, then no response status will be set.
- */
-function editDocument() {
- var usecaseName = cocoon.parameters["lenya.usecase"];
-
- var usecaseResolver;
- var usecase;
-
- try {
- var flowHelper = cocoon.getComponent("org.apache.lenya.cms.cocoon.flow.FlowHelper");
- var request = flowHelper.getRequest(cocoon);
- var sourceUrl = Packages.org.apache.lenya.util.ServletHelper.getWebappURI(request);
-
- usecaseResolver = cocoon.getComponent("org.apache.lenya.cms.usecase.UsecaseResolver");
- usecase = usecaseResolver.resolve(sourceUrl, usecaseName);
-
- if (cocoon.log.isDebugEnabled()) {
- cocoon.log.debug("edit-document.js::editDocument() calling usecase methods, usecaseName [" + usecaseName + "], sourceUrl [" + sourceUrl + "]");
- }
-
- usecase.setSourceURL(sourceUrl);
- usecase.setName(usecaseName);
-
- usecase.checkPreconditions();
- usecase.lockInvolvedObjects();
- if (!usecase.getErrorMessages().isEmpty()) {
- throw new Exception("Checking pre-conditions or locking failed!");
- }
- else {
- usecase.execute();
- if (!usecase.getErrorMessages().isEmpty()) {
- throw new Exception("Saving failed!");
- }
- }
-
- if (cocoon.log.isDebugEnabled()) {
- cocoon.log.debug("edit-document.js::editDocument() after usecase.execute(), hasErrors ? " + usecase.hasErrors());
- }
-
- // FIXME: handle error messages
- //if (usecase.hasErrors()) {
- //}
-
- if(_getParameter("noStatus", "false") == "false")
- cocoon.sendStatus(_getParameter("status", 204));
- else
- cocoon.redirectTo(_getParameter("redirectUrl", "FIXME"));
-
- } catch (exception) {
-
- /* FIXME: This is unclean because the flow will not return a value
- if there is an exception */
- cocoon.log.error("Can not edit document.", exception);
-
- }
- finally {
- /* done with usecase component, tell usecaseResolver to release it */
- if (usecaseResolver != null) {
- if (usecase != null) {
- usecaseResolver.release(usecase);
- usecase = undefined;
- }
- cocoon.releaseComponent(usecaseResolver);
- }
- }
-
-}
-
-function _getParameter(name, defaultValue) {
- if(cocoon.parameters[name])
- return cocoon.parameters[name];
- else
- return defaultValue;
-}
-
diff --git a/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/UsecaseAuthorizer.java b/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/UsecaseAuthorizer.java
deleted file mode 100644
index 7f8965e..0000000
--- a/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/UsecaseAuthorizer.java
+++ /dev/null
@@ -1,68 +0,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.
- *
- */
-
-package org.apache.lenya.cms.ac.usecase;
-
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Authorizer;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.cms.publication.Publication;
-
-/**
- * Authorizer for usecases.
- * @version $Id: UsecaseAuthorizer.java 392449 2006-04-07 23:20:38Z michi $
- */
-public interface UsecaseAuthorizer extends Authorizer {
-
- /**
- * Authorizes a usecase by considering all roles of the current identity
- *
- * @param usecase The usecase ID.
- * @param roles The roles of the current identity.
- * @param publication The publication.
- * @return A boolean value.
- * @throws AccessControlException when something went wrong.
- */
- boolean authorizeUsecase(String usecase, Role[] roles, Publication publication)
- throws AccessControlException;
-
- /**
- * Grants or denies a usecase to a role
- *
- * @param usecase The usecase.
- * @param publication The publication.
- * @param role The role.
- * @param granted If the usecase shall be permitted.
- * @throws AccessControlException if an error occurs.
- */
- void setPermission(String usecase, Publication publication, Role role, boolean granted)
- throws AccessControlException;
-
- /**
- * Checks whether the specified role is permitted to invoke a given usecase
- *
- * @param usecase The usecase.
- * @param publication The publication.
- * @param role The role.
- * @return A boolean value.
- * @throws AccessControlException if an error occurs.
- */
- boolean isPermitted(String usecase, Publication publication, Role role)
- throws AccessControlException;
-
-}
diff --git a/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/impl/UsecaseAuthorizerImpl.java b/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/impl/UsecaseAuthorizerImpl.java
deleted file mode 100644
index 7632dc6..0000000
--- a/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/impl/UsecaseAuthorizerImpl.java
+++ /dev/null
@@ -1,309 +0,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.
- *
- */
-
-package org.apache.lenya.cms.ac.usecase.impl;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-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.environment.Request;
-import org.apache.lenya.ac.AccessControlException;
-import org.apache.lenya.ac.Role;
-import org.apache.lenya.ac.cache.BuildException;
-import org.apache.lenya.ac.cache.CachingException;
-import org.apache.lenya.ac.cache.SourceCache;
-import org.apache.lenya.cms.ac.PolicyUtil;
-import org.apache.lenya.cms.ac.usecase.UsecaseAuthorizer;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
-import org.apache.lenya.cms.publication.PublicationUtil;
-
-/**
- * Authorizer for usecases.
- * <p>
- * Supported parameters via {@link Parameterizable}:
- * </p>
- * <ul>
- * <li> {@link #PARAMETER_CONFIGURATION} - location of the usecase policies file
- * (parameterizable for testing purposes) </li>
- * </ul>
- * @version $Id: UsecaseAuthorizer.java 392449 2006-04-07 23:20:38Z michi $
- */
-public class UsecaseAuthorizerImpl extends AbstractLogEnabled implements UsecaseAuthorizer,
- Serviceable, Disposable, Parameterizable {
-
- /**
- * The name of the pseudo-usecase that governs access to pages.
- */
- public static final String VISIT_USECASE = "ac.visit";
-
- protected static final String PARAMETER_CONFIGURATION = "configuration";
- protected static final String TYPE = "usecase";
- protected static final String USECASE_PARAMETER = "lenya.usecase";
- private static final String AC_CONFIGURATION_FILE = "config/access-control/access-control.xml"
- .replace('/', File.separatorChar);
-
- private SourceCache cache;
- /**
- * the configuration URI for this component
- */
- private String configurationUri;
- private ServiceManager manager;
-
- /**
- * Maps publication IDs to their configuration URIs. This is a persistent
- * map to avoid unnecessary publication lookups. Whenever an authorization
- * request for a new publication is dealt with, the publication's
- * configuration URI is stored, to be re-used on later occasions (for the
- * lifetime of the component).
- */
- private Map pubId2configUri = new HashMap();
-
- /**
- * @see org.apache.lenya.cms.ac.usecase.UsecaseAuthorizer#authorizeUsecase(java.lang.String,
- * org.apache.lenya.ac.Role[],
- * org.apache.lenya.cms.publication.Publication)
- */
- public boolean authorizeUsecase(String usecase, Role[] roles, Publication publication)
- throws AccessControlException {
- return authorizeUsecase(usecase, roles, getConfigurationURI(publication));
- }
-
- private boolean authorizeUsecase(String usecase, Role[] roles, String _configurationUri)
- throws AccessControlException {
- getLogger().debug("Authorizing usecase [" + usecase + "]");
- boolean authorized = false;
-
- UsecaseRoles usecaseRoles = getUsecaseRoles(_configurationUri);
-
- if (usecaseRoles == null) {
- throw new AccessControlException("Usecase policies configuration not found at ["
- + _configurationUri + "]");
- }
-
- if (usecaseRoles.hasRoles(usecase)) {
- getLogger().debug("Roles for usecase found.");
-
- List usecaseRoleIds = Arrays.asList(usecaseRoles.getRoles(usecase));
-
- int i = 0;
- while (!authorized && i < roles.length) {
- authorized = usecaseRoleIds.contains(roles[i].getId());
- getLogger()
- .debug(
- "Authorization for role [" + roles[i].getId() + "] is ["
- + authorized + "]");
- i++;
- }
- } else {
- getLogger().debug("No roles for usecase [" + usecase + "] found. Denying access.");
- }
- return authorized;
- }
-
- /**
- * @see org.apache.lenya.cms.ac.usecase.UsecaseAuthorizer#isPermitted(java.lang.String,
- * org.apache.lenya.cms.publication.Publication,
- * org.apache.lenya.ac.Role)
- */
- public boolean isPermitted(String usecase, Publication publication, Role role)
- throws AccessControlException {
- String configUri = getConfigurationURI(publication);
- UsecaseRoles usecaseRoles = getUsecaseRoles(configUri);
- String[] roles = usecaseRoles.getRoles(usecase);
- return Arrays.asList(roles).contains(role.getId());
- }
-
- /**
- * @see org.apache.lenya.cms.ac.usecase.UsecaseAuthorizer#setPermission(java.lang.String,
- * org.apache.lenya.cms.publication.Publication,
- * org.apache.lenya.ac.Role, boolean)
- */
- public void setPermission(String usecase, Publication publication, Role role, boolean granted)
- throws AccessControlException {
- String configUri = getConfigurationURI(publication);
- if (configUri.startsWith("aggregate-")) {
- configUri = configUri.substring("aggregate-".length());
- }
- UsecaseRoles usecaseRoles = getUsecaseRoles(configUri);
- List roles = Arrays.asList(usecaseRoles.getRoles(usecase));
- String roleId = role.getId();
- if (granted) {
- if (!roles.contains(roleId)) {
- usecaseRoles.addRole(usecase, roleId);
- }
- } else {
- if (roles.contains(roleId)) {
- usecaseRoles.removeRole(usecase, roleId);
- }
- }
- UsecaseRolesBuilder builder = new UsecaseRolesBuilder();
- try {
- builder.save(usecaseRoles, configUri, this.manager);
- } catch (BuildException e) {
- throw new AccessControlException(e);
- }
- }
-
- /**
- * This method will substitute VISIT_USECASE if no USECASE_PARAMETER is set,
- * so that it can be used to authorize plain page access as well.
- * @see org.apache.lenya.ac.Authorizer#authorize(org.apache.cocoon.environment.Request)
- */
- public boolean authorize(Request request) throws AccessControlException {
-
- String usecase = request.getParameter(USECASE_PARAMETER);
- if (usecase == null || "".equals(usecase)) {
- usecase = VISIT_USECASE;
- }
-
- boolean authorized = false;
-
- try {
- String _configurationUri;
- // Check if the service has been parameterized with a
- // configuration URI. This can be used for testing purposes etc.
- if (getConfigurationURI() != null) {
- _configurationUri = getConfigurationURI();
- } else {
- Publication publication = PublicationUtil.getPublication(this.manager, request);
- _configurationUri = getConfigurationURI(publication);
- }
-
- Role[] roles = PolicyUtil.getRoles(request);
- authorized = authorizeUsecase(usecase, roles, _configurationUri);
- } catch (final PublicationException e) {
- throw new AccessControlException(e);
- } catch (final AccessControlException e) {
- throw new AccessControlException(e);
- }
-
- return authorized;
- }
-
- /**
- * Returns the configuration source cache.
- * @return A source cache.
- */
- private SourceCache getCache() {
- return this.cache;
- }
-
- /**
- * Returns the source URI of the usecase role configuration file for a
- * certain publication.
- *
- * @param publication The publication.
- * @return A string representing a URI.
- */
- protected String getConfigurationURI(Publication publication) {
-
- String configURI = (String) this.pubId2configUri.get(publication.getId());
- if (configURI == null) {
- try {
- Configuration config = getConfiguration(publication);
- Configuration[] authorizerConfigs = config.getChildren("authorizer");
- for (int i = 0; i < authorizerConfigs.length; i++) {
- if (authorizerConfigs[i].getAttribute("type").equals("usecase")) {
- Configuration paraConfig = authorizerConfigs[i].getChild("parameter");
- configURI = paraConfig.getAttribute("value");
- this.pubId2configUri.put(publication.getId(), configURI);
- }
- }
- } catch (Exception e) {
- getLogger().error(e.getMessage(), e);
- }
- }
- return configURI;
- }
-
- protected UsecaseRoles getUsecaseRoles(String _configurationUri) throws AccessControlException {
- UsecaseRolesBuilder builder = new UsecaseRolesBuilder();
- UsecaseRoles usecaseRoles;
- try {
- usecaseRoles = (UsecaseRoles) getCache().get(_configurationUri, builder);
- } catch (CachingException e) {
- throw new AccessControlException(e);
- }
- return usecaseRoles;
- }
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager _manager) throws ServiceException {
- getLogger().debug("Servicing [" + getClass().getName() + "]");
- this.manager = _manager;
- this.cache = (SourceCache) _manager.lookup(SourceCache.ROLE);
- }
-
- /**
- * @see org.apache.avalon.framework.activity.Disposable#dispose()
- */
- public void dispose() {
- if (getCache() != null) {
- this.manager.release(getCache());
- }
- }
-
- public void parameterize(Parameters parameters) throws ParameterException {
- if (parameters.isParameter(PARAMETER_CONFIGURATION)) {
- this.configurationUri = parameters.getParameter(PARAMETER_CONFIGURATION);
- }
- }
-
- private String getConfigurationURI() {
- return this.configurationUri;
- }
-
- /**
- * Retrieves access control configuration of a specific publication.
- * @param publication The publication.
- * @return Configuration
- * @throws AccessControlException when something went wrong.
- */
- private Configuration getConfiguration(Publication publication) throws AccessControlException {
- File configurationFile = new File(publication.getDirectory(), AC_CONFIGURATION_FILE);
-
- if (configurationFile.isFile()) {
- try {
- Configuration configuration = new DefaultConfigurationBuilder()
- .buildFromFile(configurationFile);
- return configuration;
- } catch (Exception e) {
- throw new AccessControlException(e);
- }
- } else {
- throw new AccessControlException("No such file or directory: " + configurationFile);
- }
- }
-
-}
diff --git a/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/impl/UsecaseRoles.java b/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/impl/UsecaseRoles.java
deleted file mode 100644
index 444c8fa..0000000
--- a/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/impl/UsecaseRoles.java
+++ /dev/null
@@ -1,115 +0,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.
- *
- */
-
-package org.apache.lenya.cms.ac.usecase.impl;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Class to manage roles for a usecase.
- *
- * @version $Id$
- */
-public class UsecaseRoles {
-
- private Map usecaseToRoles = new HashMap();
-
- /**
- * Ctor.
- */
- public UsecaseRoles() {
- // do nothing
- }
-
- /**
- * Sets the roles for a usecase.
- * @param usecaseId The usecase ID.
- * @param roleIds The role IDs.
- */
- public void setRoles(String usecaseId, String[] roleIds) {
- this.usecaseToRoles.put(usecaseId, roleIds);
- }
-
- /**
- * Returns the roles for a usecase. If no roles are defined for this
- * usecase, an array of size 0 is returned.
- * @param usecaseId The usecase ID.
- * @return A role array.
- */
- public String[] getRoles(String usecaseId) {
- String[] usecaseRoles;
- if (this.usecaseToRoles.containsKey(usecaseId)) {
- usecaseRoles = (String[]) this.usecaseToRoles.get(usecaseId);
- } else {
- usecaseRoles = new String[0];
- }
- return usecaseRoles;
- }
-
- /**
- * Checks if a usecase has roles.
- * @param usecaseId The usecase ID.
- * @return A boolean value.
- */
- public boolean hasRoles(String usecaseId) {
- return this.usecaseToRoles.containsKey(usecaseId);
- }
-
- /**
- * @return All available usecase names.
- */
- public String[] getUsecaseNames() {
- Set names = this.usecaseToRoles.keySet();
- return (String[]) names.toArray(new String[names.size()]);
- }
-
- /**
- * @param usecase The usecase name.
- * @param role The role ID.
- */
- public void addRole(String usecase, String role) {
- String[] usecaseRoles = getRoles(usecase);
- Set newRoles = new HashSet();
- newRoles.addAll(Arrays.asList(usecaseRoles));
- newRoles.add(role);
- this.usecaseToRoles.put(usecase, newRoles.toArray(new String[newRoles.size()]));
- }
-
- /**
- * @param usecase The usecase.
- * @param role The role.
- */
- public void removeRole(String usecase, String role) {
- String[] usecaseRoles = getRoles(usecase);
- Set newRoles = new HashSet();
- newRoles.addAll(Arrays.asList(usecaseRoles));
-
- if (!newRoles.contains(role)) {
- throw new RuntimeException("The role [" + role + "] is not set for usecase [" + usecase
- + "]");
- }
-
- newRoles.remove(role);
- this.usecaseToRoles.put(usecase, newRoles.toArray(new String[newRoles.size()]));
- }
-
-}
diff --git a/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/impl/UsecaseRolesBuilder.java b/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/impl/UsecaseRolesBuilder.java
deleted file mode 100644
index 55fdb63..0000000
--- a/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/ac/usecase/impl/UsecaseRolesBuilder.java
+++ /dev/null
@@ -1,116 +0,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.
- *
- */
-
-package org.apache.lenya.cms.ac.usecase.impl;
-
-import java.io.InputStream;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.lenya.ac.AccessController;
-import org.apache.lenya.ac.cache.BuildException;
-import org.apache.lenya.ac.cache.InputStreamBuilder;
-import org.apache.lenya.cms.cocoon.source.SourceUtil;
-import org.apache.lenya.util.Assert;
-import org.apache.lenya.xml.DocumentHelper;
-import org.apache.lenya.xml.NamespaceHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Builder for usecase roles.
- *
- * @version $Id$
- */
-public class UsecaseRolesBuilder implements InputStreamBuilder {
-
- protected static final String USECASES_ELEMENT = "usecases";
- protected static final String USECASE_ELEMENT = "usecase";
- protected static final String ROLE_ELEMENT = "role";
- protected static final String ID_ATTRIBUTE = "id";
-
- /**
- * @see org.apache.lenya.ac.cache.InputStreamBuilder#build(java.io.InputStream)
- */
- public Object build(InputStream stream) throws BuildException {
-
- UsecaseRoles usecaseRoles = new UsecaseRoles();
-
- Document document;
- try {
- document = DocumentHelper.readDocument(stream);
- } catch (Exception e) {
- throw new BuildException(e);
- }
- Assert.isTrue("Correct usecase policies XML", document.getDocumentElement().getLocalName()
- .equals(USECASES_ELEMENT));
-
- NamespaceHelper helper = new NamespaceHelper(AccessController.NAMESPACE,
- AccessController.DEFAULT_PREFIX, document);
-
- Element[] usecaseElements = helper.getChildren(document.getDocumentElement(),
- USECASE_ELEMENT);
- for (int i = 0; i < usecaseElements.length; i++) {
- String usecaseId = usecaseElements[i].getAttribute(ID_ATTRIBUTE);
-
- // add roles only if not overridden by child publication
- if (!usecaseRoles.hasRoles(usecaseId)) {
- Element[] roleElements = helper.getChildren(usecaseElements[i], ROLE_ELEMENT);
- Set roleIds = new HashSet();
- for (int j = 0; j < roleElements.length; j++) {
- String roleId = roleElements[j].getAttribute(ID_ATTRIBUTE);
- roleIds.add(roleId);
- }
- String[] roleIdArray = (String[]) roleIds.toArray(new String[roleIds.size()]);
- usecaseRoles.setRoles(usecaseId, roleIdArray);
- }
- }
- return usecaseRoles;
- }
-
- /**
- * Saves the usecase roles.
- * @param usecaseRoles The roles.
- * @param sourceUri The source to save to.
- * @param manager The service manager.
- * @throws BuildException if an error occurs.
- */
- public void save(UsecaseRoles usecaseRoles, String sourceUri, ServiceManager manager) throws BuildException {
- try {
- NamespaceHelper helper = new NamespaceHelper(AccessController.NAMESPACE,
- AccessController.DEFAULT_PREFIX, USECASES_ELEMENT);
- String[] usecaseNames = usecaseRoles.getUsecaseNames();
- for (int u = 0; u < usecaseNames.length; u++) {
- Element usecaseElement = helper.createElement(USECASE_ELEMENT);
- helper.getDocument().getDocumentElement().appendChild(usecaseElement);
- usecaseElement.setAttribute(ID_ATTRIBUTE, usecaseNames[u]);
- String[] roles = usecaseRoles.getRoles(usecaseNames[u]);
- for (int r = 0; r < roles.length; r++) {
- Element roleElement = helper.createElement(ROLE_ELEMENT);
- usecaseElement.appendChild(roleElement);
- roleElement.setAttribute(ID_ATTRIBUTE, roles[r]);
- }
- }
- SourceUtil.writeDOM(helper.getDocument(), sourceUri, manager);
- } catch (Exception e) {
- throw new BuildException(e);
- }
- }
-
-}
diff --git a/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/cocoon/matching/UsecaseRegistrationMatcher.java b/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/cocoon/matching/UsecaseRegistrationMatcher.java
deleted file mode 100644
index e296345..0000000
--- a/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/cocoon/matching/UsecaseRegistrationMatcher.java
+++ /dev/null
@@ -1,96 +0,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.
- *
- */
-
-/* $Id$ */
-
-package org.apache.lenya.cms.cocoon.matching;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.avalon.excalibur.pool.Poolable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-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.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.matching.Matcher;
-import org.apache.cocoon.sitemap.PatternException;
-import org.apache.lenya.cms.usecase.UsecaseResolver;
-import org.apache.lenya.util.ServletHelper;
-
-/**
- * Matches if the request calls a usecase which is registered for the Usecase Framework.
- */
-public class UsecaseRegistrationMatcher extends AbstractLogEnabled implements Matcher, Serviceable, Poolable {
-
- /**
- * @see org.apache.cocoon.matching.Matcher#match(java.lang.String,
- * java.util.Map, org.apache.avalon.framework.parameters.Parameters)
- */
- public Map match(String pattern, Map objectModel, Parameters parameters)
- throws PatternException {
-
- Request request = ObjectModelHelper.getRequest(objectModel);
- String usecaseName = request.getParameter("lenya.usecase");
-
- Map result = null;
-
- if (usecaseName == null) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("match() called, usecase parameter is empty - returning false");
- }
- }
- else {
- if (getLogger().isDebugEnabled()) {