You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by zo...@apache.org on 2011/02/27 19:39:37 UTC
svn commit: r1075111 [1/2] - in /aries/tags/web-0.1-incubating: ./
web-itests/ web-itests/src/ web-itests/src/main/ web-itests/src/main/java/
web-itests/src/main/resources/ web-itests/src/test/
web-itests/src/test/java/ web-itests/src/test/java/org/ we...
Author: zoe
Date: Sun Feb 27 18:39:35 2011
New Revision: 1075111
URL: http://svn.apache.org/viewvc?rev=1075111&view=rev
Log:
Restore web 0.1
Added:
aries/tags/web-0.1-incubating/
aries/tags/web-0.1-incubating/LICENSE
aries/tags/web-0.1-incubating/NOTICE
aries/tags/web-0.1-incubating/pom.xml
aries/tags/web-0.1-incubating/web-itests/
aries/tags/web-0.1-incubating/web-itests/pom.xml
aries/tags/web-0.1-incubating/web-itests/src/
aries/tags/web-0.1-incubating/web-itests/src/main/
aries/tags/web-0.1-incubating/web-itests/src/main/java/
aries/tags/web-0.1-incubating/web-itests/src/main/resources/
aries/tags/web-0.1-incubating/web-itests/src/test/
aries/tags/web-0.1-incubating/web-itests/src/test/java/
aries/tags/web-0.1-incubating/web-itests/src/test/java/org/
aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/
aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/
aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/
aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/converter/
aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/converter/itest/
aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/converter/itest/WabConverterITest.java
aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/test/
aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/test/TestClass.java
aries/tags/web-0.1-incubating/web-itests/src/test/resources/
aries/tags/web-0.1-incubating/web-urlhandler/
aries/tags/web-0.1-incubating/web-urlhandler/pom.xml
aries/tags/web-0.1-incubating/web-urlhandler/src/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/WarToWabConverter.java
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/CachedOutputStream.java
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/CaseInsensitiveMap.java
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/ClassPathBuilder.java
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/JSPImportParser.java
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/PackageFinder.java
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/WarToWabConverterImpl.java
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/WarToWabConverterService.java
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/url/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/url/WARConnection.java
aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/url/WAR_URLServiceHandler.java
aries/tags/web-0.1-incubating/web-urlhandler/src/main/resources/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/resources/OSGI-INF/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/resources/OSGI-INF/blueprint/
aries/tags/web-0.1-incubating/web-urlhandler/src/main/resources/OSGI-INF/blueprint/WARHandler.xml
aries/tags/web-0.1-incubating/web-urlhandler/src/test/
aries/tags/web-0.1-incubating/web-urlhandler/src/test/java/
aries/tags/web-0.1-incubating/web-urlhandler/src/test/java/org/
aries/tags/web-0.1-incubating/web-urlhandler/src/test/java/org/apache/
aries/tags/web-0.1-incubating/web-urlhandler/src/test/java/org/apache/aries/
aries/tags/web-0.1-incubating/web-urlhandler/src/test/java/org/apache/aries/web/
aries/tags/web-0.1-incubating/web-urlhandler/src/test/java/org/apache/aries/web/converter/
aries/tags/web-0.1-incubating/web-urlhandler/src/test/java/org/apache/aries/web/converter/impl/
aries/tags/web-0.1-incubating/web-urlhandler/src/test/java/org/apache/aries/web/converter/impl/JSPImportParserTest.java
aries/tags/web-0.1-incubating/web-urlhandler/src/test/java/org/apache/aries/web/converter/impl/WabConverterTest.java
aries/tags/web-0.1-incubating/web-urlhandler/src/test/resources/
aries/tags/web-0.1-incubating/web-urlhandler/src/test/resources/JSPs/
aries/tags/web-0.1-incubating/web-urlhandler/src/test/resources/JSPs/helloImport.jsp
Added: aries/tags/web-0.1-incubating/LICENSE
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/LICENSE?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/LICENSE (added)
+++ aries/tags/web-0.1-incubating/LICENSE Sun Feb 27 18:39:35 2011
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: aries/tags/web-0.1-incubating/NOTICE
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/NOTICE?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/NOTICE (added)
+++ aries/tags/web-0.1-incubating/NOTICE Sun Feb 27 18:39:35 2011
@@ -0,0 +1,8 @@
+
+Apache Aries
+Copyright 2009-2010 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+
Added: aries/tags/web-0.1-incubating/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/pom.xml?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/pom.xml (added)
+++ aries/tags/web-0.1-incubating/pom.xml Sun Feb 27 18:39:35 2011
@@ -0,0 +1,93 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>java5-parent</artifactId>
+ <groupId>org.apache.aries</groupId>
+ <version>0.1-incubating</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.aries.web</groupId>
+ <artifactId>web</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Aries Web Component</name>
+ <version>0.1-incubating</version>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/aries/tags/web-0.1-incubating</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/aries/tags/web-0.1-incubating</developerConnection>
+ <url>http://svn.apache.org/viewvc/incubator/aries/tags/web-0.1-incubating</url>
+ </scm>
+
+ <modules>
+ <module>web-urlhandler</module>
+ <module>web-itests</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- internal dependencies -->
+ <dependency>
+ <groupId>org.apache.aries.web</groupId>
+ <artifactId>org.apache.aries.web.itests</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.web</groupId>
+ <artifactId>org.apache.aries.web.urlhandler</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <!-- external dependencies -->
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-all</artifactId>
+ <version>3.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.testsupport</groupId>
+ <artifactId>org.apache.aries.testsupport.unit</artifactId>
+ <version>0.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.sample</artifactId>
+ <version>0.1-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries</groupId>
+ <artifactId>org.apache.aries.util</artifactId>
+ <version>0.1-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint</artifactId>
+ <version>0.1-incubating</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
Added: aries/tags/web-0.1-incubating/web-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/web-itests/pom.xml?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/web-itests/pom.xml (added)
+++ aries/tags/web-0.1-incubating/web-itests/pom.xml Sun Feb 27 18:39:35 2011
@@ -0,0 +1,159 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
+ OR CONDITIONS OF ANY KIND, either express or implied. See the
+ License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>web</artifactId>
+ <groupId>org.apache.aries.web</groupId>
+ <version>0.1-incubating</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>org.apache.aries.web.itests</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Aries Web integration tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.testsupport</groupId>
+ <artifactId>org.apache.aries.testsupport.unit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.sample</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries</groupId>
+ <artifactId>org.apache.aries.util</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-service</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-default</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.swissbox</groupId>
+ <artifactId>pax-swissbox-tinybundles</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-mvn</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.web</groupId>
+ <artifactId>org.apache.aries.web.urlhandler</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>generate-depends-file</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>ci-build-profile</id>
+ <activation>
+ <property>
+ <name>maven.repo.local</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!--
+ when the local repo location has been specified, we need
+ to pass on this information to PAX mvn url
+ -->
+ <argLine>-Dorg.ops4j.pax.url.mvn.localRepository=${maven.repo.local}
+ </argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Added: aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/converter/itest/WabConverterITest.java
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/converter/itest/WabConverterITest.java?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/converter/itest/WabConverterITest.java (added)
+++ aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/converter/itest/WabConverterITest.java Sun Feb 27 18:39:35 2011
@@ -0,0 +1,223 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.aries.web.converter.itest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Dictionary;
+
+import org.apache.aries.unittest.fixture.ArchiveFixture;
+import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.options.BootDelegationOption;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+import org.osgi.service.url.URLStreamHandlerService;
+import org.osgi.util.tracker.ServiceTracker;
+
+@RunWith(JUnit4TestRunner.class)
+public class WabConverterITest {
+ public static final long DEFAULT_TIMEOUT = 30000;
+
+ @Inject
+ protected BundleContext bundleContext;
+
+ @Before
+ public void setUp() throws Exception {
+ ZipFixture testWar = ArchiveFixture.newJar()
+ .binary("WEB-INF/classes/org/apache/aries/web/test/TestClass.class",
+ getClass().getClassLoader().getResourceAsStream("org/apache/aries/web/test/TestClass.class"));
+
+ FileOutputStream fout = new FileOutputStream("test.war");
+ testWar.writeOut(fout);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ new File("test.war").delete();
+ }
+
+
+ @Test
+ public void getStarted() throws Exception {
+ Bundle warConverter = getBundle("org.apache.aries.web.urlhandler");
+ assertEquals(Bundle.ACTIVE, warConverter.getState());
+
+ // wait for the blueprint container to do its work
+ int maxRepetition = 100;
+ while (maxRepetition-- > 0) {
+ ServiceReference[] ref = bundleContext.getServiceReferences(URLStreamHandlerService.class.getName(),
+ "(url.handler.protocol=webbundle)");
+ if (ref != null)
+ break;
+
+ Thread.sleep(100);
+ }
+
+ File testWar = new File("test.war");
+ Bundle converted = bundleContext.installBundle("webbundle:"+testWar.toURL().toExternalForm()
+ + "?Bundle-SymbolicName=test.war.bundle&Web-ContextPath=foo");
+
+ assertNotNull(converted);
+ Dictionary<String,String> man = converted.getHeaders();
+
+ assertEquals("test.war.bundle", man.get(Constants.BUNDLE_SYMBOLICNAME));
+ assertEquals("/foo", man.get("Web-ContextPath"));
+ assertTrue(man.get(Constants.IMPORT_PACKAGE).contains("javax.naming"));
+ }
+
+ @org.ops4j.pax.exam.junit.Configuration
+ public static Option[] configuration() {
+ Option[] options = options(
+ bootDelegation(),
+
+ // Log
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
+ // Felix Config Admin
+ mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
+ // Felix mvn url handler
+ mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
+
+ // this is how you set the default log level when using pax
+ // logging (logProfile)
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
+
+ // Bundles
+ mavenBundle("org.apache.aries.web","org.apache.aries.web.urlhandler"),
+ mavenBundle("org.apache.aries", "org.apache.aries.util"),
+ mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
+ mavenBundle("org.osgi", "org.osgi.compendium"),
+ mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit"),
+ mavenBundle("asm","asm-all"),
+
+ equinox().version("3.5.0"));
+ options = updateOptions(options);
+ return options;
+ }
+
+
+ protected Bundle getBundle(String symbolicName) {
+ return getBundle(symbolicName, null);
+ }
+
+ protected Bundle getBundle(String bundleSymbolicName, String version) {
+ Bundle result = null;
+ for (Bundle b : bundleContext.getBundles()) {
+ if (b.getSymbolicName().equals(bundleSymbolicName)) {
+ if (version == null
+ || b.getVersion().equals(Version.parseVersion(version))) {
+ result = b;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ public static BootDelegationOption bootDelegation() {
+ return new BootDelegationOption("org.apache.aries.unittest.fixture");
+ }
+
+ public static MavenArtifactProvisionOption mavenBundle(String groupId,
+ String artifactId) {
+ return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId)
+ .versionAsInProject();
+ }
+
+ protected static Option[] updateOptions(Option[] options) {
+ // We need to add pax-exam-junit here when running with the ibm
+ // jdk to avoid the following exception during the test run:
+ // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration
+ if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
+ Option[] ibmOptions = options(wrappedBundle(mavenBundle(
+ "org.ops4j.pax.exam", "pax-exam-junit")));
+ options = combine(ibmOptions, options);
+ }
+
+ return options;
+ }
+
+ protected <T> T getOsgiService(Class<T> type, long timeout) {
+ return getOsgiService(type, null, timeout);
+ }
+
+ protected <T> T getOsgiService(Class<T> type) {
+ return getOsgiService(type, null, DEFAULT_TIMEOUT);
+ }
+
+ protected <T> T getOsgiService(Class<T> type, String filter, long timeout) {
+ return getOsgiService(null, type, filter, timeout);
+ }
+
+ protected <T> T getOsgiService(BundleContext bc, Class<T> type,
+ String filter, long timeout) {
+ ServiceTracker tracker = null;
+ try {
+ String flt;
+ if (filter != null) {
+ if (filter.startsWith("(")) {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")"
+ + filter + ")";
+ } else {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")("
+ + filter + "))";
+ }
+ } else {
+ flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
+ }
+ Filter osgiFilter = FrameworkUtil.createFilter(flt);
+ tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter,
+ null);
+ tracker.open();
+ // Note that the tracker is not closed to keep the reference
+ // This is buggy, has the service reference may change i think
+ Object svc = type.cast(tracker.waitForService(timeout));
+ if (svc == null) {
+ throw new RuntimeException("Gave up waiting for service " + flt);
+ }
+ return type.cast(svc);
+ } catch (InvalidSyntaxException e) {
+ throw new IllegalArgumentException("Invalid filter", e);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/test/TestClass.java
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/test/TestClass.java?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/test/TestClass.java (added)
+++ aries/tags/web-0.1-incubating/web-itests/src/test/java/org/apache/aries/web/test/TestClass.java Sun Feb 27 18:39:35 2011
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.aries.web.test;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+public class TestClass {
+ private InitialContext ctx;
+
+ public TestClass() throws NamingException {
+ ctx = new InitialContext();
+ }
+}
Added: aries/tags/web-0.1-incubating/web-urlhandler/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/web-urlhandler/pom.xml?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/web-urlhandler/pom.xml (added)
+++ aries/tags/web-0.1-incubating/web-urlhandler/pom.xml Sun Feb 27 18:39:35 2011
@@ -0,0 +1,63 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>web</artifactId>
+ <groupId>org.apache.aries.web</groupId>
+ <version>0.1-incubating</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>org.apache.aries.web.urlhandler</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries Web Url handler</name>
+
+ <properties>
+ <aries.osgi.export.pkg>
+ org.apache.aries.web.converter
+ </aries.osgi.export.pkg>
+ <aries.osgi.private.pkg>
+ org.apache.aries.web.converter.impl,
+ org.apache.aries.web.url
+ </aries.osgi.private.pkg>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.testsupport</groupId>
+ <artifactId>org.apache.aries.testsupport.unit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/WarToWabConverter.java
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/WarToWabConverter.java?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/WarToWabConverter.java (added)
+++ aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/WarToWabConverter.java Sun Feb 27 18:39:35 2011
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.web.converter;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.jar.Manifest;
+
+/**
+ * Service interface for WAR to WAB conversion
+ */
+public interface WarToWabConverter {
+ /**
+ * Support class for WabConverter to allow multiple passes over an input war
+ * archive without requiring in-memory buffering.
+ */
+ public static interface InputStreamProvider {
+ InputStream getInputStream() throws IOException;
+ }
+
+ public static final String WEB_CONTEXT_PATH = "Web-ContextPath";
+
+
+ /**
+ * Generate the new manifest for the converted war file.
+ * @param input
+ * @param name The name of the war file
+ * @param properties Properties to influence the conversion as defined in RFC66 (see also {@link #convert} method)
+ * @return
+ */
+ Manifest generateManifest(InputStreamProvider input, String name, Properties properties) throws IOException;
+
+ /**
+ * Generate the converter WAB file. This file includes all the files from the input
+ * and has the new manifest.
+ * @param input
+ * @param name The name of the war file
+ * @param properties Properties to influence the conversion as defined in RFC66. The following
+ * properties are supported
+ * <ul>
+ * <li>Bundle-ClassPath</li>
+ * <li>Bundle-ManifestVersion</li>
+ * <li>Bundle-SymbolicName</li>
+ * <li>Bundle-Version</li>
+ * <li>Import-Package</li>
+ * <li>Web-ContextPath</li>
+ * <li>Web-JSPExtractLocation</li>
+ * </ul>
+ * Except for Bundle-ClassPath and Import-Package any supplied properties will
+ * overwrite values specified in an existing bundle manifest. For Bundle-ClassPath and Import-Package
+ * the supplied values will be joined to those specified in a bundle manifest
+ * (if it exists) and also the results of the scan of the WAR file.
+ * @return
+ */
+ InputStream convert(InputStreamProvider input, String name, Properties properties) throws IOException;
+}
Added: aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/CachedOutputStream.java
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/CachedOutputStream.java?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/CachedOutputStream.java (added)
+++ aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/CachedOutputStream.java Sun Feb 27 18:39:35 2011
@@ -0,0 +1,140 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.web.converter.impl;
+
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CachedOutputStream extends OutputStream {
+
+ private static final int DEFAULT_THRESHOLD = 64 * 1024;
+
+ private OutputStream currentStream;
+ private long threshold;
+ private int totalLength;
+ private boolean inmem;
+ private List<InputStream> streams;
+ private File tempFile;
+ private File outputDir;
+
+ public CachedOutputStream() {
+ this(DEFAULT_THRESHOLD, null);
+ }
+
+ public CachedOutputStream(long threshold, File outputDir) {
+ this.threshold = threshold;
+ this.outputDir = outputDir;
+ this.currentStream = new ByteArrayOutputStream(2048);
+ this.inmem = true;
+ this.streams = new ArrayList<InputStream>(1);
+ }
+
+ public void flush() throws IOException {
+ currentStream.flush();
+ }
+
+ public void close() throws IOException {
+ currentStream.flush();
+ currentStream.close();
+ }
+
+ public void write(byte[] b) throws IOException {
+ write(b, 0, b.length);
+ }
+
+ public void write(byte[] b, int off, int len) throws IOException {
+ totalLength += len;
+ if (inmem && totalLength > threshold) {
+ createFileOutputStream();
+ }
+ currentStream.write(b, off, len);
+ }
+
+ public void write(int b) throws IOException {
+ totalLength++;
+ if (inmem && totalLength > threshold) {
+ createFileOutputStream();
+ }
+ currentStream.write(b);
+ }
+
+ private void createFileOutputStream() throws IOException {
+ ByteArrayOutputStream bout = (ByteArrayOutputStream) currentStream;
+ if (outputDir == null) {
+ tempFile = File.createTempFile("cos", "tmp");
+ } else {
+ tempFile = File.createTempFile("cos", "tmp", outputDir);
+ }
+
+ currentStream = new BufferedOutputStream(new FileOutputStream(tempFile));
+ bout.writeTo(currentStream);
+ inmem = false;
+ }
+
+ public void destroy() {
+ streams.clear();
+ if (tempFile != null) {
+ tempFile.delete();
+ }
+ }
+
+ public int size() {
+ return totalLength;
+ }
+
+ public InputStream getInputStream() throws IOException {
+ close();
+ if (inmem) {
+ return new ByteArrayInputStream(((ByteArrayOutputStream) currentStream).toByteArray());
+ } else {
+ try {
+ FileInputStream fileInputStream = new FileInputStream(tempFile) {
+ public void close() throws IOException {
+ super.close();
+ maybeDeleteTempFile(this);
+ }
+ };
+ streams.add(fileInputStream);
+ return fileInputStream;
+ } catch (FileNotFoundException e) {
+ throw new IOException("Cached file was deleted, " + e.toString());
+ }
+ }
+ }
+
+ private void maybeDeleteTempFile(Object stream) {
+ streams.remove(stream);
+ if (tempFile != null && streams.isEmpty()) {
+ tempFile.delete();
+ tempFile = null;
+ }
+ }
+
+}
Added: aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/CaseInsensitiveMap.java
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/CaseInsensitiveMap.java?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/CaseInsensitiveMap.java (added)
+++ aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/CaseInsensitiveMap.java Sun Feb 27 18:39:35 2011
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.web.converter.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.aries.web.converter.WarToWabConverter;
+import org.osgi.framework.Constants;
+
+/**
+ * Simple key case-insensitive map where only selected set of keys are
+ * treated in case-insensitive way.
+ */
+public class CaseInsensitiveMap extends HashMap<String, String> {
+
+ private static final Map<String, String> DEFAULT_KEY_MAP = new HashMap<String, String>();
+ static {
+ addKeyMapping(DEFAULT_KEY_MAP, Constants.BUNDLE_SYMBOLICNAME);
+ addKeyMapping(DEFAULT_KEY_MAP, Constants.BUNDLE_VERSION);
+ addKeyMapping(DEFAULT_KEY_MAP, Constants.BUNDLE_MANIFESTVERSION);
+ addKeyMapping(DEFAULT_KEY_MAP, Constants.IMPORT_PACKAGE);
+ addKeyMapping(DEFAULT_KEY_MAP, Constants.BUNDLE_CLASSPATH);
+ addKeyMapping(DEFAULT_KEY_MAP, WarToWabConverter.WEB_CONTEXT_PATH);
+ }
+
+ private static void addKeyMapping(Map<String, String> mappings, String name) {
+ mappings.put(name.toLowerCase(), name);
+ }
+
+ private Map<String, String> keyMap;
+
+ public CaseInsensitiveMap() {
+ this.keyMap = new HashMap<String, String>(DEFAULT_KEY_MAP);
+ }
+
+ public CaseInsensitiveMap(Map<String, String> source) {
+ this();
+ putAll(source);
+ }
+
+ public CaseInsensitiveMap(Properties source) {
+ this();
+ for (Map.Entry<Object, Object> entry : source.entrySet()) {
+ String key = entry.getKey().toString();
+ String value = entry.getValue().toString();
+ put(key, value);
+ }
+ }
+
+ @Override
+ public String put(String name, String value) {
+ return super.put(getMappedName(name), value);
+ }
+
+ @Override
+ public String get(Object name) {
+ if (!(name instanceof String)) {
+ return null;
+ }
+ return super.get(getMappedName((String) name));
+ }
+
+ @Override
+ public boolean containsKey(Object name) {
+ if (!(name instanceof String)) {
+ return false;
+ }
+ return super.containsKey(getMappedName((String) name));
+ }
+
+ private String getMappedName(String name) {
+ String mappedName = keyMap.get(name.toLowerCase());
+ if (mappedName == null) {
+ mappedName = name;
+ }
+ return mappedName;
+ }
+}
+
Added: aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/ClassPathBuilder.java
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/ClassPathBuilder.java?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/ClassPathBuilder.java (added)
+++ aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/ClassPathBuilder.java Sun Feb 27 18:39:35 2011
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.web.converter.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.jar.Manifest;
+
+public class ClassPathBuilder
+{
+ private Map<String, Manifest> manifests;
+
+ /**
+ * This class takes a map of <jarFileName, manifest> pairs which are contained in
+ * a particular jar file.
+ * The updatePath method then uses this list to analyse the contents of the manifests
+ * and looks for any dependencies in the other manifests in the jar.
+ * @param manifests
+ */
+ public ClassPathBuilder(Map<String, Manifest> manifests)
+ {
+ this.manifests = manifests;
+ }
+
+ /**
+ * We take a full qualified jar file name and search its manifest for any other classpath
+ * dependencies within the other manifest in the parent jar file.
+ * @param jarFile
+ * @param classPath
+ * @return
+ * @throws IOException
+ */
+ public ArrayList<String> updatePath(String jarFile, ArrayList<String> classPath) throws IOException
+ {
+ // Get the classpath entries from this manifest and merge them into ours
+ Manifest manifest = manifests.get(jarFile);
+
+ if (manifest == null)
+ return classPath;
+
+ String dependencies = manifest.getMainAttributes().getValue("Class-Path");
+ if (dependencies == null)
+ dependencies = manifest.getMainAttributes().getValue("Class-path");
+
+ if (dependencies != null)
+ {
+ // Search through the entries in the classpath
+ StringTokenizer tok = new StringTokenizer(dependencies, ";");
+ while (tok.hasMoreTokens()) {
+ String path = jarFile.substring(0, jarFile.lastIndexOf('/'));;
+ String entry = tok.nextToken();
+
+ // Resolve the path to its canonical form
+ path = new File("/"+path+"/"+entry).getCanonicalPath().replace('\\','/');
+ path = path.substring(path.indexOf('/')+1);
+
+ // If we havent already located this dependency before then we add this to our
+ // list of dependencies
+ if (entry.endsWith(".jar") &&
+ manifests.keySet().contains(path) &&
+ !classPath.contains(path) &&
+ !path.startsWith("WEB-INF/lib/"))
+ {
+ classPath.add(path);
+
+ // Recursively search the new classpath entry for more dependencies
+ classPath = updatePath(path, classPath);
+
+ }
+ }
+ }
+
+ return classPath;
+ }
+
+}
Added: aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/JSPImportParser.java
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/JSPImportParser.java?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/JSPImportParser.java (added)
+++ aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/JSPImportParser.java Sun Feb 27 18:39:35 2011
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.web.converter.impl;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class JSPImportParser {
+
+ /**
+ *
+ * @param is
+ * An input stream of character-based text. We expect this to be JSP
+ * source code.
+ * @return Each java package found within valid JSP import tags
+ * @throws IOException
+ */
+ public static Collection<String> getImports (InputStream is) throws IOException {
+ Collection<String> importedPackages = new LinkedList<String>();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+ String line = null;
+ do {
+ line = reader.readLine();
+ // searchMatchedGroupForImports could take (line): I've not done that because
+ // the entry trace, once working, will print out lots of useless information.
+ if (line != null) {
+ Matcher hasJSPimport = lineWithJSPimport.matcher(line);
+ if (hasJSPimport.find()) {
+ Collection<String> foundImports = searchMatchedGroupForImports (hasJSPimport.group());
+ for (String found : foundImports) {
+ if (!importedPackages.contains(found)) {
+ importedPackages.add(found);
+ }
+ }
+ }
+ }
+ } while (line != null);
+
+ return importedPackages;
+ }
+
+ private static final Pattern lineWithJSPimport = Pattern.compile("<%@\\s*page\\s*import.*%>");
+ private static final Pattern stanzaEnd = Pattern.compile("%>");
+ private static final Pattern imports = Pattern.compile("import\\s*=\\s*\"(.*?)\"");
+
+ /**
+ *
+ * @param groupExtent a block of text known to contain a JSP import
+ * @return Each package found within valid JSP import tags
+ */
+ private static LinkedList<String> searchMatchedGroupForImports (String groupExtent) {
+ LinkedList<String> packagesFound = new LinkedList<String>();
+ String importStanzas[] = stanzaEnd.split(groupExtent);
+ for (String s: importStanzas){
+ Matcher oneImport = imports.matcher(s);
+ if (oneImport.find()) {
+ String thisStanzasImports = oneImport.group();
+ String allPackages = thisStanzasImports.substring(thisStanzasImports.indexOf("\"")+1,
+ thisStanzasImports.lastIndexOf("\""));
+ String [] imports = allPackages.split(",");
+ for (String p : imports) {
+ String thisPackage = p.substring(0,p.lastIndexOf('.')).trim();
+
+ if (!!!thisPackage.startsWith("java."))
+ packagesFound.add(thisPackage);
+ }
+ }
+ }
+
+ return packagesFound;
+ }
+}
Added: aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/PackageFinder.java
URL: http://svn.apache.org/viewvc/aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/PackageFinder.java?rev=1075111&view=auto
==============================================================================
--- aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/PackageFinder.java (added)
+++ aries/tags/web-0.1-incubating/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/PackageFinder.java Sun Feb 27 18:39:35 2011
@@ -0,0 +1,454 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.web.converter.impl;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Attribute;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.signature.SignatureReader;
+import org.objectweb.asm.signature.SignatureVisitor;
+
+public class PackageFinder implements AnnotationVisitor, SignatureVisitor, ClassVisitor,
+ FieldVisitor, MethodVisitor
+{
+ private Set<String> packages = new HashSet<String>();
+ private Set<String> exemptPackages = new HashSet<String>();
+
+ // stored value of the signature class name
+ private String signatureOuterClass = null;
+
+ public Set<String> getImportPackages()
+ {
+ // Remove entries that will be imported by default
+ for (Iterator<String> i = packages.iterator(); i.hasNext();) {
+ if (i.next().startsWith("java.")) i.remove();
+ }
+
+ return packages;
+ }
+
+ public Set<String> getExemptPackages()
+ {
+ return exemptPackages;
+ }
+
+ private String getPackageName(String name)
+ {
+ String packageName = null;
+ if (name != null) {
+ int index = name.lastIndexOf('/');
+ if (index > 0) packageName = name.substring(0, index);
+ }
+ return packageName;
+ }
+
+ private String canonizePackage(String rawPackage)
+ {
+ String result = rawPackage.replace('/', '.');
+
+ // handle arrays
+ return result.replaceFirst("^\\[+L", "");
+ }
+
+ private void addPackage(String packageName)
+ {
+ if (packageName != null) {
+ packages.add(canonizePackage(packageName));
+ }
+ }
+
+ private void addExemptPackage(String packageName)
+ {
+ if (packageName != null)
+ exemptPackages.add(canonizePackage(packageName));
+ }
+
+ private void addPackages(String[] packageNames)
+ {
+ if (packageNames != null) {
+ for (String s : packageNames)
+ if (s != null) {
+ packages.add(canonizePackage(s));
+ }
+ }
+ }
+
+ private String getResolvedPackageName(String name)
+ {
+ String resolvedName = null;
+ if (name != null) resolvedName = getPackageName(name);
+ return resolvedName;
+ }
+
+ private String[] getResolvedPackageNames(String[] names)
+ {
+ String[] resolvedNames = null;
+ if (names != null) {
+ resolvedNames = new String[names.length];
+ int i = 0;
+ for (String s : names)
+ resolvedNames[i++] = getResolvedPackageName(s);
+ }
+ return resolvedNames;
+ }
+
+ private String getDescriptorInfo(String descriptor)
+ {
+ String type = null;
+ if (descriptor != null) type = getType(Type.getType(descriptor));
+ return type;
+ }
+
+ private String[] getMethodDescriptorInfo(String descriptor)
+ {
+ String[] descriptors = null;
+ if (descriptor != null) {
+ Type[] types = Type.getArgumentTypes(descriptor);
+ descriptors = new String[types.length + 1];
+ descriptors[0] = getType(Type.getReturnType(descriptor));
+ int i = 1;
+ for (Type t : types)
+ descriptors[i++] = getType(t);
+ }
+ return descriptors;
+ }
+
+ private String getType(Type t)
+ {
+ String type = null;
+ switch (t.getSort())
+ {
+ case Type.ARRAY:
+ type = getType(t.getElementType());
+ break;
+ case Type.OBJECT:
+ type = getPackageName(t.getInternalName());
+ break;
+ }
+ return type;
+ }
+
+ private void addSignaturePackages(String signature)
+ {
+ if (signature != null) new SignatureReader(signature).accept(this);
+ }
+
+ private void addResolvedSignaturePackages(String signature)
+ {
+ if (signature != null) new SignatureReader(signature).acceptType(this);
+ }
+
+ //
+ // ClassVisitor methods
+ //
+
+ public void visit(int arg0, int arg1, String name, String signature, String parent,
+ String[] interfaces)
+ {
+ // We dont want to import our own packages so we add this classes package name to the
+ // list of exempt packages.
+ addExemptPackage(getPackageName(name));
+
+ if (signature == null) {
+ addPackage(getResolvedPackageName(parent));
+ addPackages(getResolvedPackageNames(interfaces));
+ } else addSignaturePackages(signature);
+ }
+
+ public AnnotationVisitor visitAnnotation(String descriptor, boolean visible)
+ {
+ addPackage(getDescriptorInfo(descriptor));
+ return this;
+ }
+
+ public void visitAttribute(Attribute arg0)
+ {
+ // No-op
+ }
+
+ public FieldVisitor visitField(int access, String name, String descriptor, String signature,
+ Object value)
+ {
+ if (signature == null) addPackage(getDescriptorInfo(descriptor));
+ else addResolvedSignaturePackages(signature);
+
+ if (value instanceof Type) addPackage(getType((Type) value));
+ return this;
+ }
+
+ public void visitInnerClass(String arg0, String arg1, String arg2, int arg3)
+ {
+ // no-op
+ }
+
+ public MethodVisitor visitMethod(int access, String name, String descriptor, String signature,
+ String[] exceptions)
+ {
+ if (signature == null) addPackages(getMethodDescriptorInfo(descriptor));
+ else addSignaturePackages(signature);
+
+ addPackages(getResolvedPackageNames(exceptions));
+ return this;
+
+ }
+
+ public void visitOuterClass(String arg0, String arg1, String arg2)
+ {
+ // no-op
+ }
+
+ public void visitSource(String arg0, String arg1)
+ {
+ // no-op
+ }
+
+ public void visitEnd()
+ {
+ // no-op
+ }
+
+ //
+ // MethodVisitor methods
+ //
+
+ public AnnotationVisitor visitAnnotationDefault()
+ {
+ return this;
+ }
+
+ public void visitCode()
+ {
+ // no-op
+ }
+
+ public void visitFieldInsn(int opcode, String owner, String name, String descriptor)
+ {
+ addPackage(getResolvedPackageName(owner));
+ addPackage(getDescriptorInfo(descriptor));
+ }
+
+ public void visitFrame(int arg0, int arg1, Object[] arg2, int arg3, Object[] arg4)
+ {
+ // no-op
+ }
+
+ public void visitIincInsn(int arg0, int arg1)
+ {
+ // no-op
+ }
+
+ public void visitInsn(int arg0)
+ {
+ // no-op
+ }
+
+ public void visitIntInsn(int arg0, int arg1)
+ {
+ // no-op
+ }
+
+ public void visitJumpInsn(int arg0, Label arg1)
+ {
+ // no-op
+ }
+
+ public void visitLabel(Label arg0)
+ {
+ // no-op
+ }
+
+ public void visitLdcInsn(Object type)
+ {
+ if (type instanceof Type) addPackage(getType((Type) type));
+ }
+
+ public void visitLineNumber(int arg0, Label arg1)
+ {
+ // no-op
+ }
+
+ public void visitLocalVariable(String name, String descriptor, String signature, Label start,
+ Label end, int index)
+ {
+ addResolvedSignaturePackages(signature);
+ }
+
+ public void visitLookupSwitchInsn(Label arg0, int[] arg1, Label[] arg2)
+ {
+ // no-op
+ }
+
+ public void visitMaxs(int arg0, int arg1)
+ {
+ // no-op
+ }
+
+ public void visitMethodInsn(int opcode, String owner, String name, String descriptor)
+ {
+ addPackage(getResolvedPackageName(owner));
+ addPackages(getMethodDescriptorInfo(descriptor));
+ }
+
+ public void visitMultiANewArrayInsn(String descriptor, int arg1)
+ {
+ addPackage(getDescriptorInfo(descriptor));
+ }
+
+ public AnnotationVisitor visitParameterAnnotation(int arg0, String descriptor, boolean arg2)
+ {
+ addPackage(getDescriptorInfo(descriptor));
+ return this;
+ }
+
+ public void visitTableSwitchInsn(int arg0, int arg1, Label arg2, Label[] arg3)
+ {
+ //no-op
+ }
+
+ public void visitTryCatchBlock(Label arg0, Label arg1, Label arg2, String type)
+ {
+ addPackage(getResolvedPackageName(type));
+ }
+
+ public void visitTypeInsn(int arg0, String type)
+ {
+ addPackage(getResolvedPackageName(type));
+ }
+
+ public void visitVarInsn(int arg0, int arg1)
+ {
+ // no-op
+ }
+
+ //
+ // AnnotationVisitor Methods
+ //
+
+ public void visit(String arg0, Object value)
+ {
+ if (value instanceof Type) {
+ addPackage(getType((Type) value));
+ }
+ }
+
+ public AnnotationVisitor visitAnnotation(String arg0, String descriptor)
+ {
+ addPackage(getDescriptorInfo(descriptor));
+ return this;
+ }
+
+ public AnnotationVisitor visitArray(String arg0)
+ {
+ return this;
+ }
+
+ public void visitEnum(String name, String desc, String value)
+ {
+ addPackage(getDescriptorInfo(desc));
+ }
+
+ //
+ // SignatureVisitor methods
+ //
+
+ public SignatureVisitor visitArrayType()
+ {
+ return this;
+ }
+
+ public void visitBaseType(char arg0)
+ {
+ // no-op
+ }
+
+ public SignatureVisitor visitClassBound()
+ {
+ return this;
+ }
+
+ public void visitClassType(String name)
+ {
+ signatureOuterClass = name;
+ addPackage(getResolvedPackageName(name));
+ }
+
+ public void visitInnerClassType(String name)
+ {
+ addPackage(getResolvedPackageName(signatureOuterClass + "$" + name));
+ }
+
+ public SignatureVisitor visitExceptionType()
+ {
+ return this;
+ }
+
+ public void visitFormalTypeParameter(String arg0)
+ {
+ // no-op
+ }
+
+ public SignatureVisitor visitInterface()
+ {
+ return this;
+ }
+
+ public SignatureVisitor visitParameterType()
+ {
+ return this;
+ }
+
+ public SignatureVisitor visitReturnType()
+ {
+ return this;
+ }
+
+ public SignatureVisitor visitSuperclass()
+ {
+ return this;
+ }
+
+ public void visitTypeArgument()
+ {
+ // no-op
+ }
+
+ public SignatureVisitor visitTypeArgument(char arg0)
+ {
+ return this;
+ }
+
+ public void visitTypeVariable(String arg0)
+ {
+ // no-op
+ }
+
+ public SignatureVisitor visitInterfaceBound()
+ {
+ return this;
+ }
+
+}