[maven-release-plugin] copy for tag 1.0_RC2
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2@1574250 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dist/pom.xml b/dist/pom.xml
index 753bc1f..03cd9db 100644
--- a/dist/pom.xml
+++ b/dist/pom.xml
@@ -125,6 +125,17 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<profiles>
<profile>
<id>release</id>
diff --git a/trunk/LICENSE.txt b/trunk/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/trunk/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/NOTICE.txt b/trunk/NOTICE.txt
deleted file mode 100644
index a7aa9ed..0000000
--- a/trunk/NOTICE.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Commons Weaver
-Copyright 2012-2014 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
diff --git a/trunk/RELEASE-NOTES.txt b/trunk/RELEASE-NOTES.txt
deleted file mode 100755
index 053d708..0000000
--- a/trunk/RELEASE-NOTES.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-
- Apache Commons Weaver 1.0
- RELEASE NOTES
-
-The Apache Commons team is pleased to announce the release of Apache Commons Weaver 1.0
-
-Apache Commons Weaver provides an easy way to enhance compiled classes with
-new functionality by generating ("weaving") bytecode into those classes.
-
-Initial release
-
-No changes defined in this version.
-
-Historical list of changes: http://commons.apache.org/commons-weaver-parent/changes-report.html
-
-For complete information on Apache Commons Weaver Parent POM, including instructions on how to submit bug reports,
-patches, or suggestions for improvement, see the Apache Apache Commons Weaver Parent POM website:
-
-http://commons.apache.org/commons-weaver-parent/
diff --git a/trunk/ant/lib/pom.xml b/trunk/ant/lib/pom.xml
deleted file mode 100644
index ccd8706..0000000
--- a/trunk/ant/lib/pom.xml
+++ /dev/null
@@ -1,179 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-antlib-parent</artifactId>
- <version>1.0</version>
- </parent>
-
- <artifactId>commons-weaver-antlib</artifactId>
- <name>Apache Commons Weaver Antlib</name>
- <description>Apache Commons Weaver Ant task library</description>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <commons.osgi.import />
- </properties>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/ant/lib</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/ant/lib</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/ant/lib</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-processor</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${ant.version}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <!-- shade plugin creates but does not clean ${basedir}/dependency-reduced-pom.xml -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <configuration>
- <filesets>
- <fileset>
- <directory>${basedir}</directory>
- <includes>
- <include>dependency-reduced-pom.xml</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-test-sources</id>
- <phase />
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <phase />
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>2.1</version>
- <executions>
- <execution>
- <id>shade</id>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <minimizeJar>true</minimizeJar>
- <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
- <relocations>
- <relocation>
- <pattern>org.apache.commons.lang3.</pattern>
- <shadedPattern>org.apache.commons.weaver.ant._lang3.</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.apache.commons.io.</pattern>
- <shadedPattern>org.apache.commons.weaver.ant._io.</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.apache.xbean.</pattern>
- <shadedPattern>org.apache.commons.weaver.ant._xbean.</shadedPattern>
- </relocation>
- </relocations>
- <filters>
- <filter>
- <artifact>org.apache.commons:commons-lang3</artifact>
- <excludes>
- <exclude>META-INF/**</exclude>
- </excludes>
- </filter>
- <filter>
- <artifact>commons-io:commons-io</artifact>
- <excludes>
- <exclude>META-INF/**</exclude>
- </excludes>
- </filter>
- <filter>
- <artifact>org.apache.xbean:*</artifact>
- <excludes>
- <exclude>META-INF/**</exclude>
- </excludes>
- </filter>
- </filters>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <rulesets>
- <ruleset>/org/apache/commons/weaver/pmd.xml</ruleset>
- </rulesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
- <configuration>
- <configLocation>org/apache/commons/weaver/checkstyle.xml</configLocation>
- <headerLocation>org/apache/commons/weaver/license-header.txt</headerLocation>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <configuration>
- <xmlOutput>true</xmlOutput>
- <excludeFilterFile>/org/apache/commons/weaver/findbugs-exclude-filter.xml</excludeFilterFile>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-</project>
diff --git a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/AbstractWeaverTask.java b/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/AbstractWeaverTask.java
deleted file mode 100644
index fde4f9e..0000000
--- a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/AbstractWeaverTask.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.
- */
-package org.apache.commons.weaver.ant;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.types.Reference;
-
-/**
- * Abstract weaver Ant task. Manages settings for filesystem-based weaving.
- */
-public abstract class AbstractWeaverTask extends Task {
- private WeaverSettings settings;
-
- /**
- * Create a new {@link AbstractWeaverTask} instance.
- * @param project owner
- */
- protected AbstractWeaverTask(final Project project) {
- super();
- setProject(project);
- }
-
- /**
- * Add a nested {@link WeaverSettings}.
- * @param settings to add
- */
- public void add(final WeaverSettings settings) {
- if (this.settings != null) {
- throw new BuildException("settings already specified");
- }
- this.settings = settings;
- }
-
- /**
- * Get the {@link WeaverSettings} in use.
- * @return {@link WeaverSettings}
- */
- public WeaverSettings getSettings() {
- return settings;
- }
-
- /**
- * Set a project reference to a {@link WeaverSettings} object.
- * @param refid key
- */
- public void setSettingsRef(final String refid) {
- final WeaverSettings settings = new WeaverSettings(getProject());
- settings.setRefid(new Reference(getProject(), refid));
- add(settings);
- }
-
-}
\ No newline at end of file
diff --git a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/CleanTask.java b/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/CleanTask.java
deleted file mode 100644
index a91f9da..0000000
--- a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/CleanTask.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.commons.weaver.ant;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.weaver.CleanProcessor;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-
-/**
- * Clean Ant task.
- */
-public class CleanTask extends AbstractWeaverTask {
- /**
- * Create a new {@link CleanTask} instance.
- * @param project owner
- */
- public CleanTask(final Project project) {
- super(project);
- }
-
- /**
- * Execute the clean task.
- */
- @Override
- public void execute() {
- try {
- final WeaverSettings settings = Validate.notNull(getSettings(), "settings");
- final CleanProcessor cleanProcessor =
- new CleanProcessor(settings.getClasspathEntries(), settings.getTarget(), settings.getProperties());
- cleanProcessor.clean();
- } catch (final Exception e) {
- throw new BuildException(e);
- }
- }
-}
diff --git a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java b/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.java
deleted file mode 100644
index 8f4ac1e..0000000
--- a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/InlineProperties.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.commons.weaver.ant;
-
-import java.util.Properties;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.tools.ant.DynamicElementNS;
-
-/**
- * <p>Structure to allow inline specification of properties.</p>
- * <p>Example:
- * {pre}<foo>foo-value</foo>
- * <bar>bar-value</bar>
- * <baz>baz
- * -nextline-value</baz>
- * {/pre}
- * </p>
- */
-public class InlineProperties implements DynamicElementNS {
- /**
- * Represents a single inline property.
- */
- public final class InlineProperty {
- private final String name;
-
- private InlineProperty(final String name) {
- this.name = name;
- }
-
- /**
- * Add text to this property.
- * @param text to add
- */
- public void addText(final String text) {
- final String value;
- if (properties.containsKey(name)) {
- value = StringUtils.join(properties.getProperty(name), text);
- } else {
- value = text;
- }
- properties.setProperty(name, value);
- }
- }
-
- /**
- * {@link Properties} object maintained by the {@link InlineProperties}.
- */
- final Properties properties = new Properties();
-
- /**
- * Handle the specified nested element.
- * @param uri String URI
- * @param localName local element name
- * @param qName qualified name
- * @return InlineProperty
- */
- @Override
- public InlineProperty createDynamicElement(final String uri, final String localName, final String qName) {
- return new InlineProperty(localName);
- }
-}
\ No newline at end of file
diff --git a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaveTask.java b/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaveTask.java
deleted file mode 100644
index 414bfb7..0000000
--- a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaveTask.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.commons.weaver.ant;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.weaver.WeaveProcessor;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-
-/**
- * Weave Ant task.
- */
-public class WeaveTask extends AbstractWeaverTask {
- /**
- * Create a new {@link WeaveTask} instance.
- * @param project owner
- */
- public WeaveTask(final Project project) {
- super(project);
- }
-
- /**
- * Execute the weave task.
- */
- @Override
- public void execute() {
- try {
- final WeaverSettings settings = Validate.notNull(getSettings(), "settings");
- final WeaveProcessor weaveProcessor =
- new WeaveProcessor(settings.getClasspathEntries(), settings.getTarget(), settings.getProperties());
- weaveProcessor.weave();
- } catch (final Exception e) {
- throw new BuildException(e);
- }
- }
-}
diff --git a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaverSettings.java b/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaverSettings.java
deleted file mode 100644
index dd3104b..0000000
--- a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/WeaverSettings.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.
- */
-package org.apache.commons.weaver.ant;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.DataType;
-import org.apache.tools.ant.types.EnumeratedAttribute;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.PropertySet;
-import org.apache.tools.ant.types.Reference;
-import org.apache.tools.ant.types.PropertySet.BuiltinPropertySetName;
-
-/**
- * Standalone weaver settings datatype. Handles:
- * <ul>
- * <li>{@code target} attribute - {@link File}</li>
- * <li>{@code classpath} attribute - {@link Path} (incompatible with {@code classpathref})</li>
- * <li>{@code classpathref} attribute - {@link String} (incompatible with {@code classpath})</li>
- * <li>nested {@code propertyset} - {@link PropertySet}</li>
- * <li>nested {@code properties} - {@link InlineProperties}</li>
- * </ul>
- * {@code propertyset} and {@code properties} are merged, with the latter taking precedence.
- */
-public class WeaverSettings extends DataType {
- private File target;
- private Path classpath;
- private String classpathref;
- private PropertySet propertySet;
- private InlineProperties inlineProperties;
-
- /**
- * Create a new {@link WeaverSettings} object.
- * @param project owner
- */
- public WeaverSettings(final Project project) {
- super();
- setProject(project);
- }
-
- /**
- * Get the {@code target} directory.
- * @return {@link File}
- */
- public File getTarget() {
- if (isReference()) {
- return getRef().getTarget();
- }
- return target;
- }
-
- /**
- * Set the {@code target} directory.
- * @param target {@link File}
- */
- public void setTarget(final File target) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.target = target;
- }
-
- /**
- * Get the {@code classpathref}.
- * @return {@link String}
- */
- public String getClasspathref() {
- if (isReference()) {
- return getRef().getClasspathref();
- }
- return classpathref;
- }
-
- /**
- * Set the {@code classpathref}.
- * @param classpathref {@link String}
- */
- public void setClasspathRef(final String classpathref) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- this.classpathref = classpathref;
- }
-
- /**
- * Return the effective classpath (system classpath + configured classpath) as a {@link List} of {@link String}
- * filesystem paths.
- * @return List<String>
- */
- public List<String> getClasspathEntries() {
- final Path path = new Path(getProject());
- final Path classpath = getClasspath();
- if (classpath != null) {
- path.add(classpath);
- }
- path.add(Path.systemClasspath);
-
- return Arrays.asList(path.list());
- }
-
- /**
- * Get the {@code classpath}.
- * @return {@link Path}
- */
- public Path getClasspath() {
- if (isReference()) {
- return getRef().getClasspath();
- }
- if (classpath == null) {
- if (getClasspathref() != null) {
- final Path ref = new Path(getProject());
- ref.setRefid(new Reference(getProject(), getClasspathref()));
- return ref;
- }
- } else if (StringUtils.isNotBlank(getClasspathref())) {
- throw new BuildException("Only one of classpathref|classpath is permitted.");
- }
- return classpath;
- }
-
- /**
- * Set the {@code classpath}.
- * @param classpath {@link Path}
- */
- public void setClasspath(final Path classpath) {
- if (isReference()) {
- throw tooManyAttributes();
- }
- if (this.classpath != null) {
- throw new BuildException("classpath already set");
- }
- this.classpath = classpath;
- }
-
- /**
- * Create the nested {@code properties}.
- * @return {@link InlineProperties}
- */
- public InlineProperties createProperties() {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- if (inlineProperties != null) {
- throw new BuildException("properties already specified");
- }
- inlineProperties = new InlineProperties();
- return inlineProperties;
- }
-
- /**
- * Create a nested {@code propertyset}.
- * @return {@link PropertySet}
- */
- public PropertySet createPropertySet() {
- if (isReference()) {
- throw noChildrenAllowed();
- }
- if (propertySet != null) {
- throw new BuildException("propertyset already specified");
- }
- propertySet = new PropertySet();
- propertySet.setProject(getProject());
- return propertySet;
- }
-
- /**
- * Merge nested {@code propertyset} and {@code properties}; latter takes precedence.
- * @return Properties
- */
- public Properties getProperties() {
- if (isReference()) {
- return getRef().getProperties();
- }
- if (propertySet == null && inlineProperties == null) {
- createPropertySet().appendBuiltin(
- (BuiltinPropertySetName) EnumeratedAttribute.getInstance(BuiltinPropertySetName.class, "all"));
- }
- final Properties result = new Properties();
- if (propertySet != null) {
- result.putAll(propertySet.getProperties());
- }
- if (inlineProperties != null) {
- for (final Map.Entry<Object, Object> entry : inlineProperties.properties.entrySet()) {
- result.put(entry.getKey(), StringUtils.trim((String) entry.getValue()));
- }
- }
- return result;
- }
-
- private WeaverSettings getRef() {
- return getCheckedRef(WeaverSettings.class, "settings");
- }
-
-}
\ No newline at end of file
diff --git a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/package-info.java b/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/package-info.java
deleted file mode 100644
index 7ecdb2f..0000000
--- a/trunk/ant/lib/src/main/java/org/apache/commons/weaver/ant/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Integration with Apache Ant.
- */
-package org.apache.commons.weaver.ant;
\ No newline at end of file
diff --git a/trunk/ant/lib/src/main/resources/org/apache/commons/weaver/ant/antlib.xml b/trunk/ant/lib/src/main/resources/org/apache/commons/weaver/ant/antlib.xml
deleted file mode 100644
index aa3e353..0000000
--- a/trunk/ant/lib/src/main/resources/org/apache/commons/weaver/ant/antlib.xml
+++ /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.
--->
-<antlib>
- <typedef name="settings" classname="org.apache.commons.weaver.ant.WeaverSettings" />
- <taskdef name="clean" classname="org.apache.commons.weaver.ant.CleanTask" />
- <taskdef name="weave" classname="org.apache.commons.weaver.ant.WeaveTask" />
-</antlib>
diff --git a/trunk/ant/lib/src/site/markdown/index.md b/trunk/ant/lib/src/site/markdown/index.md
deleted file mode 100644
index 6bbb5fc..0000000
--- a/trunk/ant/lib/src/site/markdown/index.md
+++ /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.
--->
-
-## Apache Commons Weaver Antlib
-
-Provides an Antlib in the `antlib:org.apache.commons.weaver` namespace,
-consisting of the following tasks:
-
-### clean
-
-Invokes available [Cleaner][cleaner] implementations.
-
-### weave
-
-Invokes available [Weaver][weaver] implementations.
-
-
-Both the **weave** and **clean** tasks are parameterized either by
-nesting or by reference (via the `settingsref` attribute) with a
-custom type:
-
-### settings
-
- * `target` attribute - specifies the location of the classfiles to weave
- * `classpath` attribute - path string (incompatible with `classpathref`)
- * `classpathref` attribute - refid of an Ant **path**
- (incompatible with `classpath`)
- * nested `propertyset` - Ant **PropertySet**
- * nested `properties` - specifies properties using the names and text values
- of nested elements (looks like Maven POM properties)
-
-
-[cleaner]: ../../apidocs/org/apache/commons/weaver/spi/Cleaner.html
-[weaver]: ../../apidocs/org/apache/commons/weaver/spi/Weaver.html
diff --git a/trunk/ant/pom.xml b/trunk/ant/pom.xml
deleted file mode 100644
index d3c1bdd..0000000
--- a/trunk/ant/pom.xml
+++ /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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-parent</artifactId>
- <version>1.0</version>
- </parent>
-
- <artifactId>commons-weaver-antlib-parent</artifactId>
- <name>Apache Commons Weaver Antlib Parent</name>
- <packaging>pom</packaging>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/ant</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/ant</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/ant</url>
- </scm>
-
- <modules>
- <module>lib</module>
- <module>test</module>
- </modules>
-</project>
diff --git a/trunk/ant/test/pom.xml b/trunk/ant/test/pom.xml
deleted file mode 100644
index d779ad0..0000000
--- a/trunk/ant/test/pom.xml
+++ /dev/null
@@ -1,302 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-antlib-parent</artifactId>
- <version>1.0</version>
- </parent>
-
- <artifactId>commons-weaver-antlib-test</artifactId>
- <name>Apache Commons Weaver Antlib Test</name>
- <description>Uses the privilizer example to test the antlib</description>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <privilizer.policy>DYNAMIC</privilizer.policy>
- </properties>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/ant/test</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/ant/test</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/ant/test</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <profiles>
- <profile>
- <id>antlib-test</id>
- <activation>
- <property>
- <name>!antlib-test-skip</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack-example-sources</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItems>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-example</artifactId>
- <version>${project.version}</version>
- <classifier>sources</classifier>
- <includes>**/*.java</includes>
- <outputDirectory>${project.build.directory}/example-sources</outputDirectory>
- </artifactItems>
- </artifactItems>
- </configuration>
- </execution>
- <execution>
- <id>copy-dependencies</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/compile-classpath</outputDirectory>
- <includeArtifactIds>commons-weaver-antlib,commons-weaver-privilizer,commons-weaver-privilizer-api,commons-io,asm,asm-commons,asm-tree,asm-util</includeArtifactIds>
- </configuration>
- </execution>
- <execution>
- <id>unpack-example-test-sources</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItems>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-example</artifactId>
- <version>${project.version}</version>
- <classifier>test-sources</classifier>
- <includes>**/*.java</includes>
- <outputDirectory>${project.build.directory}/example-test-sources</outputDirectory>
- </artifactItems>
- </artifactItems>
- </configuration>
- </execution>
- <execution>
- <id>unpack-example-test-resources</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItems>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-example</artifactId>
- <version>${project.version}</version>
- <classifier>test-sources</classifier>
- <includes>java.policy</includes>
- <outputDirectory>${project.build.directory}/example-test-resources</outputDirectory>
- </artifactItems>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>clean</id>
- <phase>process-sources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <sequential xmlns:cw="antlib:org.apache.commons.weaver.ant">
- <path id="cp">
- <fileset dir="${project.build.directory}/compile-classpath" erroronmissingdir="false" />
- </path>
- <typedef uri="antlib:org.apache.commons.weaver.ant" resource="org/apache/commons/weaver/ant/antlib.xml" classpathref="cp" />
-
- <cw:clean>
- <cw:settings target="${project.build.outputDirectory}" classpathref="cp">
- <properties>
- <privilizer.policy>${privilizer.policy}</privilizer.policy>
- <privilizer.accessLevel>PACKAGE</privilizer.accessLevel>
- </properties>
- </cw:settings>
- </cw:clean>
- </sequential>
- </target>
- </configuration>
- </execution>
- <execution>
- <id>weave</id>
- <phase>process-classes</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <sequential xmlns:cw="antlib:org.apache.commons.weaver.ant">
- <path id="cp">
- <fileset dir="${project.build.directory}/compile-classpath" />
- </path>
- <typedef uri="antlib:org.apache.commons.weaver.ant" resource="org/apache/commons/weaver/ant/antlib.xml" classpathref="cp" />
-
- <cw:weave>
- <cw:settings target="${project.build.outputDirectory}" classpathref="cp">
- <properties>
- <privilizer.policy>${privilizer.policy}</privilizer.policy>
- <privilizer.accessLevel>PACKAGE</privilizer.accessLevel>
- </properties>
- </cw:settings>
- </cw:weave>
- </sequential>
- </target>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-antlib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${ant.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-sources</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${project.build.directory}/example-sources</source>
- </sources>
- </configuration>
- </execution>
- <execution>
- <id>add-test-sources</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${project.build.directory}/example-test-sources</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>sec</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>filter-testResources</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <mkdir dir="${project.build.testOutputDirectory}" />
- <condition property="slash" value="/" else="">
- <os family="windows" />
- </condition>
- <copy todir="${project.build.testOutputDirectory}" overwrite="true">
- <fileset dir="${project.build.directory}/example-test-resources" erroronmissingdir="false" />
- <filterchain>
- <expandproperties />
- <!-- append extra slash on windows only -->
- <replacestring from="file://" to="file://${slash}" />
- <replacestring from="${file.separator}" to="/" />
- <!-- preserve system-specific file separator -->
- <replacestring from="$${preserve.project.build.directory}" to="${project.build.directory}" />
- </filterchain>
- </copy>
- </target>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${ant.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>-Djava.security.manager -Djava.security.policy=${project.build.testOutputDirectory}/java.policy</argLine>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
diff --git a/trunk/build-tools/pom.xml b/trunk/build-tools/pom.xml
deleted file mode 100644
index b8f42e2..0000000
--- a/trunk/build-tools/pom.xml
+++ /dev/null
@@ -1,67 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-parent</artifactId>
- <version>1.0</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>commons-weaver-build-tools</artifactId>
- <name>Apache Commons Weaver Build Tools</name>
- <description>Provide common setup, from http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/multi-module-config.html</description>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/build-tools</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/build-tools</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/build-tools</url>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <configuration>
- <skipSource>true</skipSource>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-test-jar</id>
- <phase />
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <executions>
- <execution>
- <id>create-javadoc-jar</id>
- <phase />
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/trunk/build-tools/src/main/resources/org/apache/commons/weaver/checkstyle.xml b/trunk/build-tools/src/main/resources/org/apache/commons/weaver/checkstyle.xml
deleted file mode 100644
index 9cdb3c0..0000000
--- a/trunk/build-tools/src/main/resources/org/apache/commons/weaver/checkstyle.xml
+++ /dev/null
@@ -1,207 +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.
--->
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<!--
-
- Checkstyle configuration that checks the sun coding conventions from:
-
- - the Java Language Specification at
- http://java.sun.com/docs/books/jls/second_edition/html/index.html
-
- - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
-
- - the Javadoc guidelines at
- http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
-
- - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
-
- - some best practices
-
- Checkstyle is very configurable. Be sure to read the documentation at
- http://checkstyle.sf.net (or in your downloaded distribution).
-
- Most Checks are configurable, be sure to consult the documentation.
-
- To completely disable a check, just comment it out or delete it from the file.
-
- Finally, it is worth reading the documentation.
-
--->
-
-<module name="Checker">
- <!--
- If you set the basedir property below, then all reported file
- names will be relative to the specified directory. See
- http://checkstyle.sourceforge.net/5.x/config.html#Checker
-
- <property name="basedir" value="${basedir}" />
- -->
-
- <!-- Checks that each Java package has a Javadoc file used for commenting. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
- <module name="JavadocPackage" />
-
- <!-- Checks that property files contain the same keys. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
- <module name="Translation" />
-
- <module name="FileLength" />
-
- <!-- Following interprets the header file as regular expressions. -->
- <!-- <module name="RegexpHeader" /> -->
-
- <module name="FileTabCharacter">
- <property name="eachLine" value="true" />
- </module>
-
- <module name="RegexpSingleline">
- <!-- \s matches whitespace character, $ matches end of line. -->
- <property name="format" value="\s+$" />
- <property name="message" value="Line has trailing spaces." />
- </module>
-
- <module name="TreeWalker">
-
- <property name="cacheFile" value="${checkstyle.cache.file}" />
-
- <!-- Checks for Javadoc comments. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html -->
- <module name="JavadocMethod">
- <property name="scope" value="protected" />
- <property name="allowUndeclaredRTE" value="true" />
- </module>
- <module name="JavadocType">
- <property name="scope" value="protected" />
- </module>
- <module name="JavadocVariable">
- <property name="scope" value="protected" />
- </module>
- <module name="JavadocStyle" />
-
-
- <!-- Checks for Naming Conventions. -->
- <!-- See http://checkstyle.sf.net/config_naming.html -->
- <module name="ConstantName" />
- <module name="LocalFinalVariableName" />
- <module name="LocalVariableName" />
- <module name="MemberName" />
- <module name="MethodName" />
- <module name="PackageName" />
- <module name="ParameterName" />
- <module name="StaticVariableName" />
- <module name="TypeName" />
-
-
- <!-- Checks for Headers -->
- <!-- See http://checkstyle.sf.net/config_header.html -->
- <!-- <module name="Header"> -->
- <!-- The follow property value demonstrates the ability -->
- <!-- to have access to ANT properties. In this case it uses -->
- <!-- the ${basedir} property to allow Checkstyle to be run -->
- <!-- from any directory within a project. See property -->
- <!-- expansion, -->
- <!-- http://checkstyle.sf.net/config.html#properties -->
- <!-- <property -->
- <!-- name="headerFile" -->
- <!-- value="${basedir}/java.header" /> -->
- <!-- </module> -->
-
-
- <!-- Checks for imports -->
- <!-- See http://checkstyle.sf.net/config_import.html -->
- <module name="AvoidStarImport" />
- <module name="IllegalImport" /> <!-- defaults to sun.* packages -->
- <module name="RedundantImport" />
- <module name="UnusedImports">
- <property name="processJavadoc" value="true" />
- </module>
-
-
- <!-- Checks for Size Violations. -->
- <!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="LineLength">
- <property name="max" value="120" />
- </module>
- <module name="MethodLength" />
- <module name="ParameterNumber" />
-
-
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <module name="EmptyForIteratorPad" />
- <module name="MethodParamPad" />
- <module name="NoWhitespaceAfter">
- <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS" />
- </module>
- <module name="NoWhitespaceBefore" />
- <module name="OperatorWrap" />
- <module name="ParenPad" />
- <module name="TypecastParenPad" />
- <module name="WhitespaceAfter" />
- <module name="WhitespaceAround" />
-
-
- <!-- Modifier Checks -->
- <!-- See http://checkstyle.sf.net/config_modifiers.html -->
- <module name="ModifierOrder" />
- <module name="RedundantModifier" />
-
-
- <!-- Checks for blocks. You know, those {}'s -->
- <!-- See http://checkstyle.sf.net/config_blocks.html -->
- <module name="EmptyBlock">
- <property name="option" value="text" />
- </module>
- <module name="LeftCurly" />
- <module name="NeedBraces" />
- <module name="RightCurly" />
-
-
- <!-- Checks for common coding problems -->
- <!-- See http://checkstyle.sf.net/config_coding.html -->
- <module name="EmptyStatement" />
- <module name="EqualsHashCode" />
- <module name="IllegalInstantiation" />
- <module name="InnerAssignment" />
- <module name="MissingSwitchDefault" />
- <module name="ModifiedControlVariable" />
- <module name="ParameterAssignment" />
- <module name="RedundantThrows" />
- <module name="SimplifyBooleanExpression" />
- <module name="SimplifyBooleanReturn" />
- <module name="StringLiteralEquality" />
-
- <!-- Checks for class design -->
- <!-- See http://checkstyle.sf.net/config_design.html -->
- <module name="FinalClass" />
- <module name="HideUtilityClassConstructor" />
- <module name="InterfaceIsType" />
-
-
- <!-- Miscellaneous other checks. -->
- <!-- See http://checkstyle.sf.net/config_misc.html -->
- <module name="ArrayTypeStyle" />
- <module name="TodoComment" />
- <module name="UpperEll" />
-
- </module>
-
-</module>
diff --git a/trunk/build-tools/src/main/resources/org/apache/commons/weaver/findbugs-exclude-filter.xml b/trunk/build-tools/src/main/resources/org/apache/commons/weaver/findbugs-exclude-filter.xml
deleted file mode 100644
index 91a25ce..0000000
--- a/trunk/build-tools/src/main/resources/org/apache/commons/weaver/findbugs-exclude-filter.xml
+++ /dev/null
@@ -1,48 +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 contains some false positive bugs detected by findbugs. Their
- false positive nature has been analyzed individually and they have been
- put here to instruct findbugs it must ignore them.
--->
-<FindBugsFilter>
-
- <!-- Reason: require that code execution hierarchy invoking CleanProcessor
- has privileges directly assigned
- -->
- <Match>
- <Class name="org.apache.commons.weaver.CleanProcessor" />
- <Method name="clean" />
- <Bug pattern="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED" />
- </Match>
-
- <!-- Reason: require that code execution hierarchy invoking WeaveProcessor
- has privileges directly assigned
- -->
- <Match>
- <Class name="org.apache.commons.weaver.WeaveProcessor" />
- <Method name="weave" />
- <Bug pattern="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED" />
- </Match>
-
- <!-- Reason: generated code -->
- <Match>
- <Class name="org.apache.commons.weaver.maven.HelpMojo" />
- </Match>
-</FindBugsFilter>
diff --git a/trunk/build-tools/src/main/resources/org/apache/commons/weaver/license-header.txt b/trunk/build-tools/src/main/resources/org/apache/commons/weaver/license-header.txt
deleted file mode 100644
index f974c9a..0000000
--- a/trunk/build-tools/src/main/resources/org/apache/commons/weaver/license-header.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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/build-tools/src/main/resources/org/apache/commons/weaver/pmd.xml b/trunk/build-tools/src/main/resources/org/apache/commons/weaver/pmd.xml
deleted file mode 100644
index 1aee97c..0000000
--- a/trunk/build-tools/src/main/resources/org/apache/commons/weaver/pmd.xml
+++ /dev/null
@@ -1,77 +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.
--->
-<ruleset name="mybraces"
- xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
- <description>Custom PMD setup for Apache Commons Weaver</description>
-
- <rule ref="rulesets/java/basic.xml">
- <exclude name="AvoidBranchingStatementAsLastInLoop" />
- </rule>
-
- <rule ref="rulesets/java/design.xml">
- <exclude name="AccessorClassGeneration" />
- <exclude name="CompareObjectsWithEquals" />
- <exclude name="NonStaticInitializer" />
- <exclude name="ConfusingTernary" />
- <exclude name="AvoidSynchronizedAtMethodLevel" />
- <exclude name="UnnecessaryLocalBeforeReturn" />
- <exclude name="PreserveStackTrace" />
- <exclude name="EmptyMethodInAbstractClassShouldBeAbstract" />
- <exclude name="FieldDeclarationsShouldBeAtStartOfClass" />
- <exclude name="GodClass" />
- </rule>
-
- <rule ref="rulesets/java/empty.xml" />
- <rule ref="rulesets/java/imports.xml" />
- <rule ref="rulesets/java/migrating.xml">
- <exclude name="JUnit4TestShouldUseTestAnnotation" />
- </rule>
- <rule ref="rulesets/java/naming.xml">
- <exclude name="AbstractNaming" />
- <exclude name="AvoidFieldNameMatchingMethodName" />
- <exclude name="GenericsNaming" />
- <exclude name="LongVariable" />
- <exclude name="ShortClassName" />
- <exclude name="ShortMethodName" />
- </rule>
- <rule ref="rulesets/java/optimizations.xml">
- <exclude name="AvoidInstantiatingObjectsInLoops" />
- <exclude name="PrematureDeclaration" />
- </rule>
- <rule ref="rulesets/java/strings.xml">
- <exclude name="AvoidDuplicateLiterals" />
- </rule>
- <rule ref="rulesets/java/strings.xml/AvoidDuplicateLiterals">
- <properties>
- <property name="exceptionList" value="unchecked,rawtypes" />
- </properties>
- </rule>
-
- <rule ref="rulesets/java/sunsecure.xml" />
- <rule ref="rulesets/java/typeresolution.xml" />
- <rule ref="rulesets/java/unnecessary.xml" />
- <rule ref="rulesets/java/unusedcode.xml" />
-
- <rule ref="rulesets/java/controversial.xml/UnnecessaryConstructor" />
- <rule ref="rulesets/java/controversial.xml/AssignmentInOperand" />
- <rule ref="rulesets/java/controversial.xml/DontImportSun" />
- <rule ref="rulesets/java/controversial.xml/UnnecessaryParentheses" />
- <rule ref="rulesets/java/controversial.xml/BooleanInversion" />
-</ruleset>
diff --git a/trunk/dist/pom.xml b/trunk/dist/pom.xml
deleted file mode 100644
index 03cd9db..0000000
--- a/trunk/dist/pom.xml
+++ /dev/null
@@ -1,168 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-parent</artifactId>
- <version>1.0</version>
- </parent>
-
- <artifactId>commons-weaver</artifactId>
- <packaging>pom</packaging>
- <name>Apache Commons Weaver Distribution</name>
- <description>
- Creates the Apache Commons Weaver multimodule distribution.
- </description>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/dist</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/dist</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/dist</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-processor</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-processor</artifactId>
- <classifier>sources</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-processor</artifactId>
- <classifier>javadoc</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-api</artifactId>
- <classifier>sources</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-api</artifactId>
- <classifier>javadoc</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer</artifactId>
- <classifier>sources</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer</artifactId>
- <classifier>javadoc</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-normalizer</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-normalizer</artifactId>
- <classifier>sources</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-normalizer</artifactId>
- <classifier>javadoc</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-maven-plugin</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-maven-plugin</artifactId>
- <classifier>sources</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-maven-plugin</artifactId>
- <classifier>javadoc</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-antlib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-antlib</artifactId>
- <classifier>sources</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-antlib</artifactId>
- <classifier>javadoc</classifier>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>release</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.4</version>
- <executions>
- <execution>
- <id>create-distribution</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/bin.xml</descriptor>
- <descriptor>src/assembly/src.xml</descriptor>
- </descriptors>
- <tarLongFileMode>gnu</tarLongFileMode>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
diff --git a/trunk/dist/src/assembly/bin.xml b/trunk/dist/src/assembly/bin.xml
deleted file mode 100644
index 2ab3c22..0000000
--- a/trunk/dist/src/assembly/bin.xml
+++ /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.
--->
-<assembly>
- <id>bin</id>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
- <baseDirectory>${project.artifactId}-${commons.release.version}</baseDirectory>
- <includeSiteDirectory>false</includeSiteDirectory>
- <dependencySets>
- <dependencySet>
- <useProjectArtifact>false</useProjectArtifact>
- <useTransitiveDependencies>false</useTransitiveDependencies>
- </dependencySet>
- </dependencySets>
-
- <fileSets>
- <fileSet>
- <directory>${project.basedir}/..</directory>
- <includes>
- <include>LICENSE.txt</include>
- <include>NOTICE.txt</include>
- <include>RELEASE-NOTES.txt</include>
- </includes>
- </fileSet>
- </fileSets>
-</assembly>
diff --git a/trunk/dist/src/assembly/src.xml b/trunk/dist/src/assembly/src.xml
deleted file mode 100644
index aa8ab44..0000000
--- a/trunk/dist/src/assembly/src.xml
+++ /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.
--->
-<assembly>
- <id>src</id>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
- <baseDirectory>${project.artifactId}-${commons.release.version}-src</baseDirectory>
- <fileSets>
- <fileSet>
- <directory>${project.basedir}/..</directory>
- <excludes>
- <exclude>${project.build.directory}/**</exclude>
- <exclude>.*/**</exclude>
- <exclude>**/${project.build.directory}/**</exclude>
- <exclude>**/.*/**</exclude>
- <exclude>**/dependency-reduced-pom.xml</exclude>
- </excludes>
- </fileSet>
- </fileSets>
-</assembly>
diff --git a/trunk/example/pom.xml b/trunk/example/pom.xml
deleted file mode 100644
index 4b6ad9a..0000000
--- a/trunk/example/pom.xml
+++ /dev/null
@@ -1,169 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-parent</artifactId>
- <version>1.0</version>
- </parent>
- <artifactId>commons-weaver-example</artifactId>
- <name>Apache Commons Weaver Privilizer Example</name>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <privilizer.policy>ON_INIT</privilizer.policy>
- <privilizer.verify>true</privilizer.verify>
- </properties>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/example</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/example</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/example</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-maven-plugin</artifactId>
- <version>${project.version}</version>
- <configuration>
- <weaverConfig>
- <privilizer.accessLevel>PACKAGE</privilizer.accessLevel>
- <privilizer.policy>${privilizer.policy}</privilizer.policy>
- <privilizer.verify>${privilizer.verify}</privilizer.verify>
- </weaverConfig>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>prepare</goal>
- <goal>weave</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <profiles>
- <profile>
- <id>sec</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <executions>
- <execution>
- <id>default-testResources</id>
- <phase />
- <goals>
- <goal>testResources</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>filter-testResources</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <mkdir dir="${project.build.testOutputDirectory}" />
- <condition property="slash" value="/" else="">
- <os family="windows" />
- </condition>
- <copy todir="${project.build.testOutputDirectory}" overwrite="true">
- <fileset dir="${project.basedir}/src/test/resources" erroronmissingdir="false" />
- <filterchain>
- <expandproperties />
- <!-- append extra slash on windows only -->
- <replacestring from="file://" to="file://${slash}" />
- <replacestring from="${file.separator}" to="/" />
- <!-- preserve system-specific file separator -->
- <expandproperties>
- <propertyset>
- <propertyref prefix="project." />
- <globmapper from="*" to="preserve.*" />
- </propertyset>
- </expandproperties>
- </filterchain>
- </copy>
- </target>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${ant.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>-Djava.security.manager -Djava.security.policy=${project.build.testOutputDirectory}/java.policy</argLine>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
diff --git a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/NoArgs.java b/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/NoArgs.java
deleted file mode 100644
index ff3072a..0000000
--- a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/NoArgs.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.commons.weaver.privilizer.example;
-
-import org.apache.commons.weaver.privilizer.Privileged;
-
-public class NoArgs {
-
- @Privileged
- void throwAwayFoo() {
- System.getProperty("foo");
- }
-
- @Privileged
- String getFoo() {
- return System.getProperty("foo");
- }
-
- @Privileged
- Boolean getTrue() {
- System.getProperty("foo");
- return Boolean.TRUE;
- }
-
- @Privileged
- boolean getFalse() {
- System.getProperty("foo");
- return false;
- }
-
- public static class CheckedException1 extends Exception {
- private static final long serialVersionUID = 1L;
- }
-
- public static class CheckedException2 extends Exception {
- private static final long serialVersionUID = 1L;
- }
-
- @Privileged
- void throwingCheckedException1() throws CheckedException1 {
- System.getProperty("foo");
- throw new CheckedException1();
- }
-
- @Privileged
- Integer throwingCheckedException2() throws CheckedException1, CheckedException2 {
- System.getProperty("foo");
- throw new CheckedException2();
- }
-}
diff --git a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Overloading.java b/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Overloading.java
deleted file mode 100644
index 264b65e..0000000
--- a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Overloading.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.commons.weaver.privilizer.example;
-
-import org.apache.commons.weaver.privilizer.Privileged;
-
-public class Overloading {
-
- @Privileged
- String get() {
- return System.getProperty("foo");
- }
-
- @Privileged
- String get(String s) {
- return System.getProperty(s);
- }
-
- @Privileged
- String get(int i, char c, short s) {
- return System.getProperty(new String(new char[] { (char) i, c, (char) s }));
- }
-}
diff --git a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/PrivateMethods.java b/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/PrivateMethods.java
deleted file mode 100644
index 771efc7..0000000
--- a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/PrivateMethods.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.commons.weaver.privilizer.example;
-
-import org.apache.commons.weaver.privilizer.Privileged;
-
-public class PrivateMethods {
- public String get(String s) {
- return getProperty(s);
- }
-
- @Privileged
- private String getProperty(String s) {
- return System.getProperty(s);
- }
-}
diff --git a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Setup.java b/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Setup.java
deleted file mode 100644
index cbcc981..0000000
--- a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Setup.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.weaver.privilizer.example;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-final class Setup {
- private Setup() {
- }
-
- /**
- * This simply allows us to to set up test classes by doing
- * privileged things without granting privileges to the test
- * code itself and thus making it impossible to test the effects
- * of privilization.
- */
- public static void setProperty(final String name, final String value) {
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- public Void run() {
- System.setProperty(name, value);
- return null;
- }
- });
- }
-}
diff --git a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticNoArgs.java b/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticNoArgs.java
deleted file mode 100644
index afd5931..0000000
--- a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticNoArgs.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.commons.weaver.privilizer.example;
-
-import org.apache.commons.weaver.privilizer.Privileged;
-
-public abstract class StaticNoArgs {
- private StaticNoArgs() {
- }
-
- @Privileged
- static void throwAwayFoo() {
- System.getProperty("foo");
- }
-
- @Privileged
- static String getFoo() {
- return System.getProperty("foo");
- }
-
- @Privileged
- static Boolean getTrue() {
- System.getProperty("foo");
- return Boolean.TRUE;
- }
-
- @Privileged
- static boolean getFalse() {
- System.getProperty("foo");
- return false;
- }
-
- public static class CheckedException1 extends Exception {
- private static final long serialVersionUID = 1L;
- }
-
- public static class CheckedException2 extends Exception {
- private static final long serialVersionUID = 1L;
- }
-
- @Privileged
- static void throwingCheckedException1() throws CheckedException1 {
- System.getProperty("foo");
- throw new CheckedException1();
- }
-
- @Privileged
- static Integer throwingCheckedException2() throws CheckedException1, CheckedException2 {
- System.getProperty("foo");
- throw new CheckedException2();
- }
-}
diff --git a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticOverloading.java b/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticOverloading.java
deleted file mode 100644
index 481317e..0000000
--- a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticOverloading.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.commons.weaver.privilizer.example;
-
-import org.apache.commons.weaver.privilizer.Privileged;
-
-public abstract class StaticOverloading {
- private StaticOverloading() {
- }
-
- @Privileged
- static String get() {
- return System.getProperty("foo");
- }
-
- @Privileged
- static String get(String s) {
- return System.getProperty(s);
- }
-
- @Privileged
- static String get(int i, char c, short s) {
- return System.getProperty(new String(new char[] { (char) i, c, (char) s }));
- }
-}
diff --git a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethods.java b/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethods.java
deleted file mode 100644
index 05c6dcc..0000000
--- a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethods.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.commons.weaver.privilizer.example;
-
-import org.apache.commons.weaver.privilizer.Privileged;
-
-public abstract class StaticPrivateMethods {
- private StaticPrivateMethods() {
- }
-
- public static String get(String s) {
- return getProperty(s);
- }
-
- @Privileged
- private static String getProperty(String s) {
- return System.getProperty(s);
- }
-}
diff --git a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java b/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java
deleted file mode 100644
index c9aa778..0000000
--- a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.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.commons.weaver.privilizer.example;
-
-import java.util.ArrayList;
-
-import org.apache.commons.weaver.privilizer.Privileged;
-
-
-
-public abstract class StaticUsingArgs {
-
- private StaticUsingArgs() {
- }
-
- @Privileged
- static String getProperty(String name) {
- return System.getProperty(name);
- }
-
- @Privileged
- static String[] getProperties(String... names) {
- if (names == null) {
- return null;
- }
- final ArrayList<String> result = new ArrayList<String>();
- // in reality one would delegate to #getProperty to minimize the scope
- // of the privileged action
- for (String name : names) {
- result.add(System.getProperty(name));
- }
- return result.toArray(new String[result.size()]);
- }
-
- @Privileged
- static void throwAwayProperty(int first, String middle, char last) {
- System.getProperty(new StringBuilder().append((char) first).append(middle).append(last).toString());
- }
-
- @Privileged
- static Object assembleAndGetProperty(char first, CharSequence middle, int last) {
- return System.getProperty(new StringBuilder().append(first).append(middle).append((char) last).toString());
- }
-
- public static class CheckedException1 extends Exception {
- private static final long serialVersionUID = 1L;
- }
-
- public static class CheckedException2 extends Exception {
- private static final long serialVersionUID = 1L;
- }
-
- @Privileged
- static int throwingCheckedException(int which, String propertyToGet) throws CheckedException1, CheckedException2 {
- System.getProperty(propertyToGet);
- switch (which) {
- case 1:
- throw new CheckedException1();
- case 2:
- throw new CheckedException2();
- default:
- return which;
- }
- }
-}
diff --git a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java b/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java
deleted file mode 100644
index 582267e..0000000
--- a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.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.
- */
-package org.apache.commons.weaver.privilizer.example;
-
-import java.util.ArrayList;
-
-import org.apache.commons.weaver.privilizer.Privileged;
-
-public class UsingArgs {
-
- @Privileged
- String getProperty(String name) {
- return System.getProperty(name);
- }
-
- @Privileged
- String[] getProperties(String... names) {
- if (names == null) {
- return null;
- }
- final ArrayList<String> result = new ArrayList<String>();
- // in reality one would delegate to #getProperty to minimize the scope
- // of the privileged action
- for (String name : names) {
- result.add(System.getProperty(name));
- }
- return result.toArray(new String[result.size()]);
- }
-
- @Privileged
- void throwAwayProperty(int first, String middle, char last) {
- System.getProperty(new StringBuilder().append((char) first).append(middle).append(last).toString());
- }
-
- @Privileged
- Object assembleAndGetProperty(char first, CharSequence middle, int last) {
- return System.getProperty(new StringBuilder().append(first).append(middle).append((char) last).toString());
- }
-
- public static class CheckedException1 extends Exception {
- private static final long serialVersionUID = 1L;
- }
-
- public static class CheckedException2 extends Exception {
- private static final long serialVersionUID = 1L;
- }
-
- @Privileged
- int throwingCheckedException(int which, String propertyToGet) throws CheckedException1, CheckedException2 {
- System.getProperty(propertyToGet);
- switch (which) {
- case 1:
- throw new CheckedException1();
- case 2:
- throw new CheckedException2();
- default:
- return which;
- }
- }
-}
diff --git a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingBlueprints.java b/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingBlueprints.java
deleted file mode 100644
index f9bec65..0000000
--- a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingBlueprints.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.commons.weaver.privilizer.example;
-
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-@Privilizing({ @CallTo(Utils.class), @CallTo(value = Utils.More.class, methods = "getProperty") })
-public class UsingBlueprints {
-
- public String utilsReadPublicConstant() {
- return Utils.readPublicConstant();
- }
-
- public int utilsReadPrivateField() {
- return Utils.readPrivateField();
- }
-
- public String utilsGetProperty() {
- return Utils.getProperty();
- }
-
- public String utilsGetProperty(int i, String key) {
- return Utils.getProperty(i, key);
- }
-
- public String utilsGetProperty(String key) {
- return Utils.getProperty(key);
- }
-
- public String moreGetProperty() {
- return Utils.More.getProperty();
- }
-
- public String moreGetTopStackElementClassName() {
- return Utils.More.getTopStackElementClassName();
- }
-}
diff --git a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Utils.java b/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Utils.java
deleted file mode 100644
index 67ceff2..0000000
--- a/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Utils.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.commons.weaver.privilizer.example;
-
-public final class Utils {
- public static final class More {
- private More() {
- }
-
- public static String getProperty() {
- return Utils.getProperty("bar");
- }
-
- public static String getTopStackElementClassName() {
- return Thread.currentThread().getStackTrace()[1].getClassName();
- }
- }
-
- private Utils() {
- }
-
- public static final String FOO = "foo".intern();
-
- public static String readPublicConstant() {
- return FOO;
- }
-
- public static String getProperty() {
- return getProperty("foo");
- }
-
- public static String getProperty(int i, String key) {
- if (i <= 0) {
- return getProperty(key);
- }
- int counter = i;
- return getProperty(--counter, key);
- }
-
- public static String getProperty(String key) {
- return System.getProperty(key);
- }
-
- private static Integer n;
- static {
- n = Integer.valueOf(999);
- }
-
- public static int readPrivateField() {
- return n;
- }
-}
diff --git a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/NoArgsTest.java b/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/NoArgsTest.java
deleted file mode 100644
index c117999..0000000
--- a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/NoArgsTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.privilizer.example;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.fail;
-
-import org.apache.commons.weaver.privilizer.example.NoArgs.CheckedException1;
-import org.apache.commons.weaver.privilizer.example.NoArgs.CheckedException2;
-import org.junit.Before;
-import org.junit.Test;
-
-public class NoArgsTest {
- private NoArgs noArgs;
-
- @Before
- public void setUp() throws Exception {
- Setup.setProperty("foo", "foo-value");
- noArgs = new NoArgs();
- }
-
- @Test
- public void testThrowAwayFoo() {
- noArgs.throwAwayFoo();
- }
-
- @Test
- public void testGetFoo() {
- assertEquals("foo-value", noArgs.getFoo());
- }
-
- @Test
- public void testGetTrue() {
- assertSame(Boolean.TRUE, noArgs.getTrue());
- }
-
- @Test
- public void testGetFalse() {
- assertFalse(noArgs.getFalse());
- }
-
- @Test
- public void testThrowingCheckedException1() {
- try {
- noArgs.throwingCheckedException1();
- fail();
- } catch (CheckedException1 e) {
- }
- }
-
- @Test
- public void testThrowingCheckedException2() {
- try {
- noArgs.throwingCheckedException2();
- } catch (CheckedException1 e) {
- } catch (CheckedException2 e) {
- return;
- }
- fail();
- }
-}
diff --git a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/OverloadingTest.java b/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/OverloadingTest.java
deleted file mode 100644
index 4df3e06..0000000
--- a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/OverloadingTest.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.commons.weaver.privilizer.example;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class OverloadingTest {
- private Overloading overloading;
-
- @Before
- public void setUp() throws Exception {
- Setup.setProperty("foo", "foo-value");
- Setup.setProperty("bar", "bar-value");
- Setup.setProperty("baz", "baz-value");
- overloading = new Overloading();
- }
-
- @Test
- public void testNoArgs() {
- assertEquals("foo-value", overloading.get());
- }
-
- @Test
- public void testStringArg() {
- assertEquals("bar-value", overloading.get("bar"));
- }
-
- @Test
- public void testCharishArgs() {
- assertEquals("baz-value", overloading.get('b', 'a', (short) 'z'));
- }
-}
diff --git a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/PrivateMethodsTest.java b/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/PrivateMethodsTest.java
deleted file mode 100644
index 205da5c..0000000
--- a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/PrivateMethodsTest.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.commons.weaver.privilizer.example;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class PrivateMethodsTest {
- private PrivateMethods privateMethods;
-
- @Before
- public void setUp() throws Exception {
- Setup.setProperty("foo", "foo-value");
- Setup.setProperty("bar", "bar-value");
- Setup.setProperty("baz", "baz-value");
- privateMethods = new PrivateMethods();
- }
-
- @Test
- public void testGet() {
- assertEquals("foo-value", privateMethods.get("foo"));
- assertEquals("bar-value", privateMethods.get("bar"));
- assertEquals("baz-value", privateMethods.get("baz"));
- }
-}
diff --git a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticNoArgsTest.java b/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticNoArgsTest.java
deleted file mode 100644
index f3f99d2..0000000
--- a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticNoArgsTest.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.
- */
-package org.apache.commons.weaver.privilizer.example;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.fail;
-
-import org.apache.commons.weaver.privilizer.example.StaticNoArgs.CheckedException1;
-import org.apache.commons.weaver.privilizer.example.StaticNoArgs.CheckedException2;
-import org.junit.Before;
-import org.junit.Test;
-
-public class StaticNoArgsTest {
- @Before
- public void setUp() throws Exception {
- Setup.setProperty("foo", "foo-value");
- }
-
- @Test
- public void testThrowAwayFoo() {
- StaticNoArgs.throwAwayFoo();
- }
-
- @Test
- public void testGetFoo() {
- assertEquals("foo-value", StaticNoArgs.getFoo());
- }
-
- @Test
- public void testGetTrue() {
- assertSame(Boolean.TRUE, StaticNoArgs.getTrue());
- }
-
- @Test
- public void testGetFalse() {
- assertFalse(StaticNoArgs.getFalse());
- }
-
- @Test
- public void testThrowingCheckedException1() {
- try {
- StaticNoArgs.throwingCheckedException1();
- fail();
- } catch (CheckedException1 e) {
- }
- }
-
- @Test
- public void testThrowingCheckedException2() {
- try {
- StaticNoArgs.throwingCheckedException2();
- } catch (CheckedException1 e) {
- } catch (CheckedException2 e) {
- return;
- }
- fail();
- }
-}
diff --git a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticOverloadingTest.java b/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticOverloadingTest.java
deleted file mode 100644
index 8ee591d..0000000
--- a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticOverloadingTest.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.commons.weaver.privilizer.example;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class StaticOverloadingTest {
-
- @Before
- public void setUp() throws Exception {
- Setup.setProperty("foo", "foo-value");
- Setup.setProperty("bar", "bar-value");
- Setup.setProperty("baz", "baz-value");
- }
-
- @Test
- public void testNoArgs() {
- assertEquals("foo-value", StaticOverloading.get());
- }
-
- @Test
- public void testStringArg() {
- assertEquals("bar-value", StaticOverloading.get("bar"));
- }
-
- @Test
- public void testCharishArgs() {
- assertEquals("baz-value", StaticOverloading.get('b', 'a', (short) 'z'));
- }
-}
diff --git a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethodsTest.java b/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethodsTest.java
deleted file mode 100644
index 56f3e5e..0000000
--- a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethodsTest.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.commons.weaver.privilizer.example;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class StaticPrivateMethodsTest {
-
- @Before
- public void setUp() throws Exception {
- Setup.setProperty("foo", "foo-value");
- Setup.setProperty("bar", "bar-value");
- Setup.setProperty("baz", "baz-value");
- }
-
- @Test
- public void testGet() {
- assertEquals("foo-value", StaticPrivateMethods.get("foo"));
- assertEquals("bar-value", StaticPrivateMethods.get("bar"));
- assertEquals("baz-value", StaticPrivateMethods.get("baz"));
- }
-}
diff --git a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgsTest.java b/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgsTest.java
deleted file mode 100644
index 6818409..0000000
--- a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgsTest.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.commons.weaver.privilizer.example;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
-
-import org.apache.commons.weaver.privilizer.example.StaticUsingArgs.CheckedException1;
-import org.apache.commons.weaver.privilizer.example.StaticUsingArgs.CheckedException2;
-import org.junit.Before;
-import org.junit.Test;
-
-public class StaticUsingArgsTest {
-
- @Before
- public void setUp() throws Exception {
- Setup.setProperty("foo", "foo-value");
- Setup.setProperty("bar", "bar-value");
- Setup.setProperty("baz", "baz-value");
- }
-
- @Test
- public void testGetProperty() {
- assertEquals("foo-value", StaticUsingArgs.getProperty("foo"));
- assertEquals("bar-value", StaticUsingArgs.getProperty("bar"));
- assertEquals("baz-value", StaticUsingArgs.getProperty("baz"));
- }
-
- @Test
- public void testGetProperties() {
- assertTrue(Arrays.equals(new String[] { "foo-value", "bar-value", "baz-value" },
- StaticUsingArgs.getProperties("foo", "bar", "baz")));
- assertEquals(0, StaticUsingArgs.getProperties().length);
- assertNull(StaticUsingArgs.getProperties((String[]) null));
- }
-
- @Test
- public void testThrowAwayProperty() {
- StaticUsingArgs.throwAwayProperty('f', "o", 'o');
- }
-
- @Test
- public void testAssembleAndGetProperty() {
- assertEquals("foo-value", StaticUsingArgs.assembleAndGetProperty('f', new StringBuilder().append('o'), 'o'));
- assertEquals("bar-value", StaticUsingArgs.assembleAndGetProperty('b', new StringBuilder().append('a'), 'r'));
- assertEquals("baz-value", StaticUsingArgs.assembleAndGetProperty('b', new StringBuilder().append('a'), 'z'));
- }
-
- @Test
- public void testThrowingCheckedException() throws CheckedException1, CheckedException2 {
- assertEquals(0, StaticUsingArgs.throwingCheckedException(0, "foo"));
- try {
- StaticUsingArgs.throwingCheckedException(1, "bar");
- } catch (CheckedException1 e) {
- }
- try {
- StaticUsingArgs.throwingCheckedException(2, "baz");
- } catch (CheckedException2 e) {
- }
- }
-}
diff --git a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingArgsTest.java b/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingArgsTest.java
deleted file mode 100644
index d38cce1..0000000
--- a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingArgsTest.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.commons.weaver.privilizer.example;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
-
-import org.apache.commons.weaver.privilizer.example.UsingArgs.CheckedException1;
-import org.apache.commons.weaver.privilizer.example.UsingArgs.CheckedException2;
-import org.junit.Before;
-import org.junit.Test;
-
-public class UsingArgsTest {
- private UsingArgs usingArgs;
-
- @Before
- public void setUp() throws Exception {
- Setup.setProperty("foo", "foo-value");
- Setup.setProperty("bar", "bar-value");
- Setup.setProperty("baz", "baz-value");
- usingArgs = new UsingArgs();
- }
-
- @Test
- public void testGetProperty() {
- assertEquals("foo-value", usingArgs.getProperty("foo"));
- assertEquals("bar-value", usingArgs.getProperty("bar"));
- assertEquals("baz-value", usingArgs.getProperty("baz"));
- }
-
- @Test
- public void testGetProperties() {
- assertTrue(Arrays.equals(new String[] { "foo-value", "bar-value", "baz-value" },
- usingArgs.getProperties("foo", "bar", "baz")));
- assertEquals(0, usingArgs.getProperties().length);
- assertNull(usingArgs.getProperties((String[]) null));
- }
-
- @Test
- public void testThrowAwayProperty() {
- usingArgs.throwAwayProperty('f', "o", 'o');
- }
-
- @Test
- public void testAssembleAndGetProperty() {
- assertEquals("foo-value", usingArgs.assembleAndGetProperty('f', new StringBuilder().append('o'), 'o'));
- assertEquals("bar-value", usingArgs.assembleAndGetProperty('b', new StringBuilder().append('a'), 'r'));
- assertEquals("baz-value", usingArgs.assembleAndGetProperty('b', new StringBuilder().append('a'), 'z'));
- }
-
- @Test
- public void testThrowingCheckedException() throws CheckedException1, CheckedException2 {
- assertEquals(0, usingArgs.throwingCheckedException(0, "foo"));
- try {
- usingArgs.throwingCheckedException(1, "bar");
- } catch (CheckedException1 e) {
- }
- try {
- usingArgs.throwingCheckedException(2, "baz");
- } catch (CheckedException2 e) {
- }
- }
-}
diff --git a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingBlueprintsTest.java b/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingBlueprintsTest.java
deleted file mode 100644
index 5bb0d6b..0000000
--- a/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingBlueprintsTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.privilizer.example;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class UsingBlueprintsTest {
-
- private UsingBlueprints usingBlueprints;
-
- @Before
- public void setUp() throws Exception {
- Setup.setProperty("foo", "foo-value");
- Setup.setProperty("bar", "bar-value");
- Setup.setProperty("baz", "baz-value");
- usingBlueprints = new UsingBlueprints();
- }
-
- @Test
- public void testUtilsReadPublicConstant() {
- assertEquals(Utils.FOO, usingBlueprints.utilsReadPublicConstant());
- }
-
- @Test
- public void testUtilsReadPrivateField() {
- assertEquals(999, usingBlueprints.utilsReadPrivateField());
- }
-
- @Test
- public void testUtilsGetProperty() {
- assertEquals("foo-value", usingBlueprints.utilsGetProperty());
- }
-
- @Test
- public void testUtilsGetProperty_String() {
- assertEquals("foo-value", usingBlueprints.utilsGetProperty("foo"));
- assertEquals("bar-value", usingBlueprints.utilsGetProperty("bar"));
- assertEquals("baz-value", usingBlueprints.utilsGetProperty("baz"));
- }
-
- @Test
- public void testUtilsGetProperty_int_String() {
- assertEquals("foo-value", usingBlueprints.utilsGetProperty(2, "foo"));
- assertEquals("bar-value", usingBlueprints.utilsGetProperty(2, "bar"));
- assertEquals("baz-value", usingBlueprints.utilsGetProperty(2, "baz"));
- }
-
- @Test
- public void testMoreGetProperty() {
- assertEquals("bar-value", usingBlueprints.moreGetProperty());
- }
-
- @Test
- public void testMoreGetTopStackElementClassName() {
- assertEquals(Utils.More.class.getName(), usingBlueprints.moreGetTopStackElementClassName());
- }
-
-}
diff --git a/trunk/example/src/test/resources/java.policy b/trunk/example/src/test/resources/java.policy
deleted file mode 100644
index 7f496f2..0000000
--- a/trunk/example/src/test/resources/java.policy
+++ /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.
-//
-// Allows unit tests to run with a Java Security Manager
-//
-
-grant
-{
- // let everyone read target dir
- permission java.io.FilePermission "${preserve.project.build.directory}${/}-", "read";
-};
-
-// we don't care about the permissions of the testing infrastructure,
-// including maven;
-grant codeBase "file://${user.home}/.m2/repository/org/apache/maven/-"
-{
- permission java.security.AllPermission;
-};
-
-// junit;
-grant codeBase "file://${user.home}/.m2/repository/junit/-"
-{
- permission java.security.AllPermission;
-};
-
-// surefire booter;
-grant codeBase "file://${project.build.directory}/surefire/-"
-{
- permission java.security.AllPermission;
-};
-
-// classes under test
-grant codeBase "file://${project.build.outputDirectory}/-"
-{
- permission java.util.PropertyPermission "foo", "read,write";
- permission java.util.PropertyPermission "bar", "read,write";
- permission java.util.PropertyPermission "baz", "read,write";
- permission java.lang.RuntimePermission "accessDeclaredMembers";
- permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
-};
diff --git a/trunk/maven-plugin/pom.xml b/trunk/maven-plugin/pom.xml
deleted file mode 100644
index c82e5f2..0000000
--- a/trunk/maven-plugin/pom.xml
+++ /dev/null
@@ -1,157 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-parent</artifactId>
- <version>1.0</version>
- </parent>
-
- <artifactId>commons-weaver-maven-plugin</artifactId>
- <packaging>maven-plugin</packaging>
-
- <name>Apache Commons Weaver Maven Plugin</name>
- <description>Weaving Maven goals</description>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.version>3.0.4</maven.version>
- <maven.plugin.version>3.1</maven.plugin.version>
- </properties>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/maven-plugin</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/maven-plugin</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/maven-plugin</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-processor</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>${maven.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-core</artifactId>
- <version>${maven.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-annotations</artifactId>
- <version>${maven.plugin.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>2.0.6</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <supportedProjectTypes>
- <supportedProjectType>maven-plugin</supportedProjectType>
- </supportedProjectTypes>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-plugin-plugin</artifactId>
- <version>${maven.plugin.version}</version>
- <configuration>
- <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
- </configuration>
- <executions>
- <execution>
- <id>mojo-descriptor</id>
- <goals>
- <goal>descriptor</goal>
- </goals>
- </execution>
- <!-- if you want to generate help goal -->
- <execution>
- <id>help-goal</id>
- <goals>
- <goal>helpmojo</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-test-sources</id>
- <phase />
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-plugin-plugin</artifactId>
- <version>${maven.plugin.version}</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <rulesets>
- <ruleset>/org/apache/commons/weaver/pmd.xml</ruleset>
- </rulesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
- <configuration>
- <configLocation>org/apache/commons/weaver/checkstyle.xml</configLocation>
- <headerLocation>org/apache/commons/weaver/license-header.txt</headerLocation>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <configuration>
- <xmlOutput>true</xmlOutput>
- <excludeFilterFile>/org/apache/commons/weaver/findbugs-exclude-filter.xml</excludeFilterFile>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-
-</project>
diff --git a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractPrepareMojo.java b/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractPrepareMojo.java
deleted file mode 100644
index 06456fd..0000000
--- a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractPrepareMojo.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.commons.weaver.maven;
-
-import java.io.File;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.commons.weaver.CleanProcessor;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.Parameter;
-
-/**
- * Defines common properties.
- */
-public abstract class AbstractPrepareMojo extends AbstractMojo {
-
- /**
- * {@code verbose} parameter.
- */
- @Parameter(defaultValue = "false")
- protected boolean verbose;
-
- /**
- * {@code weaver.config} parameter.
- */
- @Parameter(property = "weaver.config", required = false)
- protected Properties weaverConfig;
-
- /**
- * Get the classpath for this prepare mojo.
- * @return {@link List} of {@link String}
- */
- protected abstract List<String> getClasspath();
-
- /**
- * Get the target directory for this prepare mojo.
- * @return {@link File}
- */
- protected abstract File getTarget();
-
- /**
- * Execute this mojo.
- * @throws MojoExecutionException in the event of failure
- */
- @Override
- public void execute() throws MojoExecutionException {
- if (!getTarget().isDirectory()) {
- return;
- }
- final JavaLoggingToMojoLoggingRedirector logRedirector = new JavaLoggingToMojoLoggingRedirector(getLog());
- logRedirector.activate();
-
- final List<String> classpath = getClasspath();
- final File target = getTarget();
- final Properties config = weaverConfig == null ? new Properties() : weaverConfig;
-
- getLog().debug(String.format("classpath=%s%ntarget=%s%nconfig=%s", classpath, target, config));
-
- try {
- final CleanProcessor cleanProcessor = new CleanProcessor(classpath, target, config);
- cleanProcessor.clean();
- } catch (Exception e) {
- throw new MojoExecutionException("cleaning failed due to " + e.getMessage(), e);
- } finally {
- logRedirector.deactivate();
- }
- }
-
-}
diff --git a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractWeaveMojo.java b/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractWeaveMojo.java
deleted file mode 100644
index beee1b0..0000000
--- a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/AbstractWeaveMojo.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.commons.weaver.maven;
-
-import java.io.File;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.commons.weaver.WeaveProcessor;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.Parameter;
-
-/**
- * Defines common properties.
- */
-public abstract class AbstractWeaveMojo extends AbstractMojo {
-
- /**
- * {@code verbose} parameter.
- */
- @Parameter(defaultValue = "false")
- protected boolean verbose;
-
- /**
- * {@code weaver.config} parameter.
- */
- @Parameter(property = "weaver.config", required = false)
- protected Properties weaverConfig;
-
- /**
- * Get the classpath for this weave mojo.
- * @return {@link List} of {@link String}
- */
- protected abstract List<String> getClasspath();
-
- /**
- * Get the target directory for this weave mojo.
- * @return {@link File}
- */
- protected abstract File getTarget();
-
- /**
- * Execute this mojo.
- * @throws MojoExecutionException in the event of failure
- */
- @Override
- public void execute() throws MojoExecutionException {
- final JavaLoggingToMojoLoggingRedirector logRedirector = new JavaLoggingToMojoLoggingRedirector(getLog());
- logRedirector.activate();
-
- final List<String> classpath = getClasspath();
- final File target = getTarget();
- final Properties config = weaverConfig == null ? new Properties() : weaverConfig;
-
- getLog().debug(String.format("classpath=%s%ntarget=%s%nconfig=%s", classpath, target, config));
-
- try {
- final WeaveProcessor weaveProcessor = new WeaveProcessor(classpath, target, config);
- weaveProcessor.weave();
- } catch (Exception e) {
- throw new MojoExecutionException("weaving failed due to " + e.getMessage(), e);
- } finally {
- logRedirector.deactivate();
- }
- }
-
-}
diff --git a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/JavaLoggingToMojoLoggingRedirector.java b/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/JavaLoggingToMojoLoggingRedirector.java
deleted file mode 100644
index 69f5313..0000000
--- a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/JavaLoggingToMojoLoggingRedirector.java
+++ /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.
- */
-package org.apache.commons.weaver.maven;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ResourceBundle;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.logging.Log;
-
-/**
- * This class redirects calls to java.util Logging to Mojo logging.
- */
-public class JavaLoggingToMojoLoggingRedirector {
- private final List<Handler> removedHandlers = new ArrayList<Handler>();
-
- /**
- * The Maven mojo logger to delegate messages to.
- */
- private final Log mojoLogger;
-
- private JDKLogHandler activeHandler;
-
- /**
- * @param mojoLogger
- * the Maven mojo logger to delegate messages to.
- */
- public JavaLoggingToMojoLoggingRedirector(final Log mojoLogger) {
- this.mojoLogger = mojoLogger;
- }
-
- /**
- * Activates this feature.
- * @throws MojoExecutionException in the event of failure
- */
- public void activate() throws MojoExecutionException {
- try {
- final Logger rootLogger = LogManager.getLogManager().getLogger("");
- // remove old handlers
- for (final Handler handler : rootLogger.getHandlers()) {
- rootLogger.removeHandler(handler);
- removedHandlers.add(handler);
- }
- if (removedHandlers.isEmpty()) {
- throw new MojoExecutionException("could not remove any handler. aborting.");
- }
-
- // add our own
- activeHandler = new JDKLogHandler();
- activeHandler.setLevel(Level.ALL);
- rootLogger.setLevel(Level.ALL);
-
- rootLogger.addHandler(activeHandler);
- } catch (Exception exc) {
- throw new MojoExecutionException("failed to activate the jul logging redirector", exc);
- }
- }
-
- /**
- * Deactivate the redirection and put the original Handlers back in place
- * again.
- */
- public void deactivate() {
- final Logger rootLogger = LogManager.getLogManager().getLogger("");
- // remove old handlers
- for (final Handler handler : rootLogger.getHandlers()) {
- if (handler == activeHandler) {
- rootLogger.removeHandler(handler);
- }
- }
-
- for (final Handler oldHandler : removedHandlers) {
- rootLogger.addHandler(oldHandler);
- }
- }
-
- private class JDKLogHandler extends Handler {
-
- @Override
- public void publish(final LogRecord record) {
- final Throwable exception = record.getThrown();
- final Level level = record.getLevel();
- if (level == Level.SEVERE && mojoLogger.isErrorEnabled()) {
- if (exception == null) {
- mojoLogger.error(getMessage(record));
- } else {
- mojoLogger.error(getMessage(record), exception);
- }
- } else if (level == Level.WARNING && mojoLogger.isWarnEnabled()) {
- if (exception == null) {
- mojoLogger.warn(getMessage(record));
- } else {
- mojoLogger.warn(getMessage(record), exception);
- }
- } else if (level == Level.INFO && mojoLogger.isInfoEnabled()) {
- if (exception == null) {
- mojoLogger.info(getMessage(record));
- } else {
- mojoLogger.info(getMessage(record), exception);
- }
- } else if (mojoLogger.isDebugEnabled()) {
- if (exception == null) {
- mojoLogger.debug(getMessage(record));
- } else {
- mojoLogger.debug(getMessage(record), exception);
- }
- }
- }
-
- private String getMessage(final LogRecord record) {
- final ResourceBundle bundle = record.getResourceBundle();
- final Object[] params = record.getParameters();
- final String message;
- if (bundle != null && bundle.containsKey(record.getMessage())) {
- // todo: cannot enforce Locale.ENGLISH here
- message = bundle.getString(record.getMessage());
- } else {
- message = record.getMessage();
- }
- if (ArrayUtils.isNotEmpty(params)) {
- return new MessageFormat(message).format(params);
- }
- return message;
- }
-
- @Override
- public void flush() {
- // nothing to do
- }
-
- @Override
- public void close() {
- // nothing to do
- }
-
- }
-
-}
diff --git a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/PrepareMojo.java b/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/PrepareMojo.java
deleted file mode 100644
index abb43e3..0000000
--- a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/PrepareMojo.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.commons.weaver.maven;
-
-import java.io.File;
-import java.util.List;
-
-import org.apache.maven.model.Build;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-
-/**
- * Goal to clean woven classes.
- */
-@Mojo(
- name = "prepare",
- defaultPhase = LifecyclePhase.INITIALIZE,
- requiresDependencyCollection = ResolutionScope.COMPILE
-)
-public class PrepareMojo extends AbstractPrepareMojo {
- /**
- * {@link MavenProject#getCompileClasspathElements()}.
- */
- @Parameter(readonly = true, required = true, defaultValue = "${project.compileClasspathElements}")
- protected List<String> classpath;
-
- /**
- * {@link Build#getOutputDirectory()}.
- */
- @Parameter(readonly = true, required = true, defaultValue = "${project.build.outputDirectory}")
- protected File target;
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected List<String> getClasspath() {
- return classpath;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected File getTarget() {
- return target;
- }
-
-}
diff --git a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/TestPrepareMojo.java b/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/TestPrepareMojo.java
deleted file mode 100644
index 134385a..0000000
--- a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/TestPrepareMojo.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.commons.weaver.maven;
-
-import java.io.File;
-import java.util.List;
-
-import org.apache.maven.model.Build;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-
-/**
- * Goal to clean woven test classes.
- */
-@Mojo(
- name = "test-prepare",
- defaultPhase = LifecyclePhase.INITIALIZE,
- requiresDependencyCollection = ResolutionScope.TEST
-)
-public class TestPrepareMojo extends AbstractPrepareMojo {
-
- /**
- * {@link MavenProject#getTestClasspathElements()}.
- */
- @Parameter(readonly = true, required = true, defaultValue = "${project.testClasspathElements}")
- protected List<String> classpath;
-
- /**
- * {@link Build#getTestOutputDirectory()}.
- */
- @Parameter(readonly = true, required = true, defaultValue = "${project.build.testOutputDirectory}")
- protected File target;
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected List<String> getClasspath() {
- return classpath;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected File getTarget() {
- return target;
- }
-
-}
diff --git a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/TestWeaveMojo.java b/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/TestWeaveMojo.java
deleted file mode 100644
index aab1310..0000000
--- a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/TestWeaveMojo.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.commons.weaver.maven;
-
-import java.io.File;
-import java.util.List;
-
-import org.apache.maven.model.Build;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-
-/**
- * Goal to weave test classes.
- */
-@Mojo(
- name = "test-weave",
- defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES,
- requiresDependencyCollection = ResolutionScope.TEST
-)
-public class TestWeaveMojo extends AbstractWeaveMojo {
-
- /**
- * {@link MavenProject#getTestClasspathElements()}.
- */
- @Parameter(readonly = true, required = true, defaultValue = "${project.testClasspathElements}")
- protected List<String> classpath;
-
- /**
- * {@link Build#getTestOutputDirectory()}.
- */
- @Parameter(readonly = true, required = true, defaultValue = "${project.build.testOutputDirectory}")
- protected File target;
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected List<String> getClasspath() {
- return classpath;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected File getTarget() {
- return target;
- }
-
-}
diff --git a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/WeaveMojo.java b/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/WeaveMojo.java
deleted file mode 100644
index 00844cf..0000000
--- a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/WeaveMojo.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.commons.weaver.maven;
-
-import java.io.File;
-import java.util.List;
-
-import org.apache.maven.model.Build;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-
-/**
- * Goal to weave classes.
- */
-@Mojo(
- name = "weave",
- defaultPhase = LifecyclePhase.PROCESS_CLASSES,
- requiresDependencyCollection = ResolutionScope.COMPILE
-)
-public class WeaveMojo extends AbstractWeaveMojo {
-
- /**
- * {@link MavenProject#getCompileClasspathElements()}.
- */
- @Parameter(readonly = true, required = true, defaultValue = "${project.compileClasspathElements}")
- protected List<String> classpath;
-
- /**
- * {@link Build#getOutputDirectory()}.
- */
- @Parameter(readonly = true, required = true, defaultValue = "${project.build.outputDirectory}")
- protected File target;
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected List<String> getClasspath() {
- return classpath;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected File getTarget() {
- return target;
- }
-
-}
diff --git a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/package-info.java b/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/package-info.java
deleted file mode 100644
index 52057ee..0000000
--- a/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/maven/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Integration with Apache Maven.
- */
-package org.apache.commons.weaver.maven;
\ No newline at end of file
diff --git a/trunk/maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml b/trunk/maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
deleted file mode 100644
index 730992d..0000000
--- a/trunk/maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
+++ /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.
--->
-<lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <goals>
- <goal>prepare</goal>
- <goal>test-prepare</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <execute>
- <runOnIncremental>true</runOnIncremental>
- <runOnConfiguration>true</runOnConfiguration>
- </execute>
- </action>
- </pluginExecution>
- <pluginExecution>
- <pluginExecutionFilter>
- <goals>
- <goal>weave</goal>
- <goal>test-weave</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <execute>
- <runOnIncremental>true</runOnIncremental>
- <runOnConfiguration>false</runOnConfiguration>
- </execute>
- </action>
- </pluginExecution>
- </pluginExecutions>
-</lifecycleMappingMetadata>
\ No newline at end of file
diff --git a/trunk/modules/normalizer/example/pom.xml b/trunk/modules/normalizer/example/pom.xml
deleted file mode 100644
index 709ebef..0000000
--- a/trunk/modules/normalizer/example/pom.xml
+++ /dev/null
@@ -1,106 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-normalizer-parent</artifactId>
- <version>1.0</version>
- </parent>
- <artifactId>commons-weaver-normalizer-example</artifactId>
- <name>Apache Commons Weaver Normalizer Example</name>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/normalizer/example</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/normalizer/example</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/modules/normalizer/example</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-maven-plugin</artifactId>
- <version>${project.version}</version>
- <configuration>
- <weaverConfig>
- <normalizer.superTypes>
- org.apache.commons.lang3.reflect.TypeLiteral,
- org.apache.commons.weaver.normalizer.example.ContrivedWrapper
- </normalizer.superTypes>
- <normalizer.targetPackage>org.apache.commons.weaver.normalizer.example.normalized</normalizer.targetPackage>
- </weaverConfig>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>prepare</goal>
- <goal>weave</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-normalizer</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-commons</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-tree</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-util</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-debug-all</artifactId>
- <version>${asm.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/trunk/modules/normalizer/example/src/main/java/org/apache/commons/weaver/normalizer/example/ContrivedWrapper.java b/trunk/modules/normalizer/example/src/main/java/org/apache/commons/weaver/normalizer/example/ContrivedWrapper.java
deleted file mode 100644
index 42e9b28..0000000
--- a/trunk/modules/normalizer/example/src/main/java/org/apache/commons/weaver/normalizer/example/ContrivedWrapper.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.commons.weaver.normalizer.example;
-
-public abstract class ContrivedWrapper {
- public final Object value;
-
- protected ContrivedWrapper(Object value) {
- this.value = value;
- }
-
- protected ContrivedWrapper(int value) {
- this.value = Integer.valueOf(value);
- }
-
- @Override
- public final boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof ContrivedWrapper)) {
- return false;
- }
- final ContrivedWrapper other = (ContrivedWrapper) obj;
- return value.equals(other.value);
- }
-
- @Override
- public int hashCode() {
- return 41 << 4 | value.hashCode();
- }
-
-}
diff --git a/trunk/modules/normalizer/example/src/main/java/org/apache/commons/weaver/normalizer/example/InstanceMembers.java b/trunk/modules/normalizer/example/src/main/java/org/apache/commons/weaver/normalizer/example/InstanceMembers.java
deleted file mode 100644
index 0a58b4f..0000000
--- a/trunk/modules/normalizer/example/src/main/java/org/apache/commons/weaver/normalizer/example/InstanceMembers.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.normalizer.example;
-
-import org.apache.commons.lang3.reflect.TypeLiteral;
-
-public class InstanceMembers {
- public final TypeLiteral<String> stringType = new TypeLiteral<String>() { };
- public final TypeLiteral<String> stringType2 = new TypeLiteral<String>() { };
- public final TypeLiteral<Iterable<Integer>> integerIterableType = new TypeLiteral<Iterable<Integer>>() { };
-
- public final ContrivedWrapper wrappedObject = new ContrivedWrapper(new Object()) { };
- public final ContrivedWrapper wrappedString = new ContrivedWrapper("foo") { };
- public final ContrivedWrapper wrappedString2 = new ContrivedWrapper("foo") { };
- public final ContrivedWrapper wrappedInteger = new ContrivedWrapper(Integer.valueOf(1)) { };
- public final ContrivedWrapper wrappedInt = new ContrivedWrapper(1) { };
-}
diff --git a/trunk/modules/normalizer/example/src/main/java/org/apache/commons/weaver/normalizer/example/StaticMembers.java b/trunk/modules/normalizer/example/src/main/java/org/apache/commons/weaver/normalizer/example/StaticMembers.java
deleted file mode 100644
index 78e3bc9..0000000
--- a/trunk/modules/normalizer/example/src/main/java/org/apache/commons/weaver/normalizer/example/StaticMembers.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.commons.weaver.normalizer.example;
-
-import org.apache.commons.lang3.reflect.TypeLiteral;
-
-public final class StaticMembers {
- private StaticMembers() {
- }
-
- public static final TypeLiteral<String> STRING_TYPE = new TypeLiteral<String>() { };
- public static final TypeLiteral<String> STRING_TYPE2 = new TypeLiteral<String>() { };
- public static final TypeLiteral<Iterable<Integer>> INTEGER_ITERABLE_TYPE = new TypeLiteral<Iterable<Integer>>() { };
-
- public static final ContrivedWrapper WRAPPED_OBJECT = new ContrivedWrapper(new Object()) { };
- public static final ContrivedWrapper WRAPPED_STRING = new ContrivedWrapper("foo") { };
- public static final ContrivedWrapper WRAPPED_STRING2 = new ContrivedWrapper("foo") { };
- public static final ContrivedWrapper WRAPPED_INTEGER = new ContrivedWrapper(Integer.valueOf(1)) { };
- public static final ContrivedWrapper WRAPPED_INT = new ContrivedWrapper(1) { };
-}
diff --git a/trunk/modules/normalizer/example/src/test/java/org/apache/commons/weaver/normalizer/example/NormalizerTest.java b/trunk/modules/normalizer/example/src/test/java/org/apache/commons/weaver/normalizer/example/NormalizerTest.java
deleted file mode 100644
index eae71c2..0000000
--- a/trunk/modules/normalizer/example/src/test/java/org/apache/commons/weaver/normalizer/example/NormalizerTest.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.commons.weaver.normalizer.example;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class NormalizerTest {
- private InstanceMembers instanceMembers;
-
- @Before
- public void setup() {
- instanceMembers = new InstanceMembers();
- }
-
- @Test
- public void testGenericType() {
- final Class<?> stringLiteral = StaticMembers.STRING_TYPE.getClass();
- assertTrue(stringLiteral.isInstance(StaticMembers.STRING_TYPE2));
- assertFalse(stringLiteral.isInstance(StaticMembers.INTEGER_ITERABLE_TYPE));
- assertTrue(stringLiteral.isInstance(instanceMembers.stringType));
- assertTrue(stringLiteral.isInstance(instanceMembers.stringType2));
- assertFalse(stringLiteral.isInstance(instanceMembers.integerIterableType));
-
- final Class<?> integerIterable = StaticMembers.INTEGER_ITERABLE_TYPE.getClass();
- assertTrue(integerIterable.isInstance(instanceMembers.integerIterableType));
- }
-
- @Test
- public void testAlternateConstructors() {
- final Class<?> objectWrapper = StaticMembers.WRAPPED_OBJECT.getClass();
- assertTrue(objectWrapper.isInstance(StaticMembers.WRAPPED_STRING));
- assertTrue(objectWrapper.isInstance(StaticMembers.WRAPPED_STRING2));
- assertTrue(objectWrapper.isInstance(StaticMembers.WRAPPED_INTEGER));
- assertFalse(objectWrapper.isInstance(StaticMembers.WRAPPED_INT));
- assertTrue(objectWrapper.isInstance(instanceMembers.wrappedObject));
- assertTrue(objectWrapper.isInstance(instanceMembers.wrappedString));
- assertTrue(objectWrapper.isInstance(instanceMembers.wrappedString2));
- assertTrue(objectWrapper.isInstance(instanceMembers.wrappedInteger));
- assertFalse(objectWrapper.isInstance(instanceMembers.wrappedInt));
- final Class<?> intWrapper = StaticMembers.WRAPPED_INT.getClass();
- assertTrue(intWrapper.isInstance(instanceMembers.wrappedInt));
- }
-}
diff --git a/trunk/modules/normalizer/pom.xml b/trunk/modules/normalizer/pom.xml
deleted file mode 100644
index 9f9fdb8..0000000
--- a/trunk/modules/normalizer/pom.xml
+++ /dev/null
@@ -1,51 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-modules-parent</artifactId>
- <version>1.0</version>
- </parent>
-
- <artifactId>commons-weaver-normalizer-parent</artifactId>
- <packaging>pom</packaging>
-
- <name>Apache Commons Weaver Normalizer Parent POM</name>
-
- <description>
- The Normalizer module merges identical anonymous class definitions into
- a single type, thereby "normalizing" them and reducing their
- collective footprint on your archive and more importantly on your JVM.
- </description>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/normalizer</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/normalizer</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/modules/normalizer</url>
- </scm>
-
- <modules>
- <module>weaver</module>
- <module>example</module>
- </modules>
-</project>
-
diff --git a/trunk/modules/normalizer/src/site/markdown/index.md b/trunk/modules/normalizer/src/site/markdown/index.md
deleted file mode 100644
index 3505434..0000000
--- a/trunk/modules/normalizer/src/site/markdown/index.md
+++ /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.
--->
-
-## Apache Commons Weaver Normalizer
-
-The Normalizer module merges identical anonymous class definitions into
-a single type, thereby "normalizing" them and reducing their
-collective footprint on your archive and more importantly on your JVM.
-
-Considers only the simplest case in which:
-
- - no methods are implemented
-
- - the constructor only calls the super constructor
-
-An anonymous class which violates these restrictions will be considered
-too complex and skipped in the interest of correctness.
-
-
-### Configuration
-The [NormalizerWeaver][normalizerWeaver] supports the following options:
-
-- `normalizer.superTypes` : comma-delimited list of types whose
- subclasses/implementations should be normalized, e.g.
- `javax.enterprise.util.TypeLiteral`.
-
-- `normalizer.targetPackage` : package to which merged types should be added.
-
-
-[normalizerWeaver]: ../../apidocs/org/apache/commons/weaver/normalizer/NormalizerWeaver.html
diff --git a/trunk/modules/normalizer/weaver/pom.xml b/trunk/modules/normalizer/weaver/pom.xml
deleted file mode 100644
index e7cab43..0000000
--- a/trunk/modules/normalizer/weaver/pom.xml
+++ /dev/null
@@ -1,197 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-normalizer-parent</artifactId>
- <version>1.0</version>
- </parent>
- <artifactId>commons-weaver-normalizer</artifactId>
- <name>Apache Commons Weaver Normalizer</name>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/normalizer/weaver</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/normalizer/weaver</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/modules/normalizer/weaver</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-processor</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <profiles>
- <profile>
- <id>basic</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm</artifactId>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-commons</artifactId>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-tree</artifactId>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>dev</id>
- <dependencies>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-debug-all</artifactId>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
- <build>
- <plugins>
- <!-- shade plugin creates but does not clean ${basedir}/dependency-reduced-pom.xml -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <configuration>
- <filesets>
- <fileset>
- <directory>${basedir}</directory>
- <includes>
- <include>dependency-reduced-pom.xml</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>2.1</version>
- <executions>
- <execution>
- <id>shade</id>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <minimizeJar>true</minimizeJar>
- <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
- <artifactSet>
- <includes>
- <include>org.apache.commons:commons-lang3</include>
- <include>commons-io:commons-io</include>
- <include>org.ow2.asm:*</include>
- </includes>
- </artifactSet>
- <relocations>
- <relocation>
- <pattern>org.apache.commons.lang3.</pattern>
- <shadedPattern>org.apache.commons.weaver.normalizer._lang3.</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.apache.commons.io.</pattern>
- <shadedPattern>org.apache.commons.weaver.normalizer._io.</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.objectweb.asm.</pattern>
- <shadedPattern>org.apache.commons.weaver.normalizer._asm.</shadedPattern>
- </relocation>
- </relocations>
- <filters>
- <filter>
- <artifact>org.apache.commons:commons-lang3</artifact>
- <excludes>
- <exclude>META-INF/**</exclude>
- </excludes>
- </filter>
- <filter>
- <artifact>commons-io:commons-io</artifact>
- <excludes>
- <exclude>META-INF/**</exclude>
- </excludes>
- </filter>
- <filter>
- <artifact>org.ow2.asm:*</artifact>
- <excludes>
- <exclude>META-INF/**</exclude>
- </excludes>
- </filter>
- </filters>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <rulesets>
- <ruleset>/org/apache/commons/weaver/pmd.xml</ruleset>
- </rulesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
- <configuration>
- <configLocation>org/apache/commons/weaver/checkstyle.xml</configLocation>
- <headerLocation>org/apache/commons/weaver/license-header.txt</headerLocation>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <configuration>
- <xmlOutput>true</xmlOutput>
- <excludeFilterFile>/org/apache/commons/weaver/findbugs-exclude-filter.xml</excludeFilterFile>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-</project>
diff --git a/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java b/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java
deleted file mode 100644
index dab0895..0000000
--- a/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java
+++ /dev/null
@@ -1,566 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.weaver.normalizer;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.nio.charset.Charset;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.activation.DataSource;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.CharEncoding;
-import org.apache.commons.lang3.Conversion;
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.lang3.mutable.MutableBoolean;
-import org.apache.commons.lang3.tuple.MutablePair;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.commons.weaver.model.ScanRequest;
-import org.apache.commons.weaver.model.ScanResult;
-import org.apache.commons.weaver.model.Scanner;
-import org.apache.commons.weaver.model.WeavableClass;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-import org.apache.commons.weaver.spi.Weaver;
-import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.Type;
-import org.objectweb.asm.commons.GeneratorAdapter;
-import org.objectweb.asm.commons.Method;
-import org.objectweb.asm.commons.Remapper;
-import org.objectweb.asm.commons.RemappingClassAdapter;
-import org.objectweb.asm.commons.SimpleRemapper;
-
-/**
- * Handles the work of "normalizing" anonymous class definitions.
- */
-public class Normalizer {
- private static final String INIT = "<init>";
-
- private static final Type OBJECT_TYPE = Type.getType(Object.class);
-
- /**
- * Marker annotation.
- */
- @Target(ElementType.TYPE)
- private @interface Marker {
- }
-
- private static class ClassWrapper {
- final Class<?> wrapped;
- final boolean mustRewriteConstructor;
-
- ClassWrapper(final Class<?> wrapped, final boolean mustRewriteConstructor) {
- this.wrapped = wrapped;
- this.mustRewriteConstructor = mustRewriteConstructor;
- }
- }
-
- private class WriteClass extends ClassVisitor {
- private String className;
-
- WriteClass() {
- super(Opcodes.ASM4, new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS));
- }
-
- WriteClass(final ClassReader reader) {
- super(Opcodes.ASM4, new ClassWriter(reader, 0));
- }
-
- @Override
- public void visit(final int version, final int access, final String name, final String signature,
- final String superName, final String[] intrfces) {
- super.visit(version, access, name, signature, superName, intrfces);
- className = name;
- }
-
- @Override
- public void visitEnd() {
- super.visitEnd();
- final byte[] bytecode = ((ClassWriter) cv).toByteArray();
-
- final DataSource classfile = env.getClassfile(className);
- env.debug("Writing class %s to %s", className, classfile.getName());
- OutputStream outputStream = null;
- try {
- outputStream = classfile.getOutputStream();
- IOUtils.write(bytecode, outputStream);
- } catch (final IOException e) {
- throw new RuntimeException(e);
- } finally {
- IOUtils.closeQuietly(outputStream);
- }
- }
- }
-
- private enum IneligibilityReason {
- NOT_ANONYMOUS, TOO_MANY_CONSTRUCTORS, IMPLEMENTS_METHODS, TOO_BUSY_CONSTRUCTOR;
- }
-
- /**
- * Configuration prefix for this {@link Weaver}.
- */
- public static final String CONFIG_WEAVER = "normalizer.";
-
- /**
- * Property name referencing a comma-delimited list of types whose subclasses/implementations should be normalized,
- * e.g. {@code javax.enterprise.util.TypeLiteral}.
- */
- public static final String CONFIG_SUPER_TYPES = CONFIG_WEAVER + "superTypes";
-
- /**
- * Property name referencing a package name to which merged types should be added.
- */
- public static final String CONFIG_TARGET_PACKAGE = CONFIG_WEAVER + "targetPackage";
-
- private static final Charset UTF8 = Charset.forName(CharEncoding.UTF_8);
-
- private final WeaveEnvironment env;
-
- private final Set<Class<?>> normalizeTypes;
- private final String targetPackage;
-
- /**
- * Create a new {@link Normalizer} instance.
- * @param env {@link WeaveEnvironment}
- */
- public Normalizer(final WeaveEnvironment env) {
- this.env = env;
-
- this.targetPackage =
- Utils.validatePackageName(Validate.notBlank(env.config.getProperty(CONFIG_TARGET_PACKAGE),
- "missing target package name"));
- this.normalizeTypes =
- Utils.parseTypes(
- Validate.notEmpty(env.config.getProperty(CONFIG_SUPER_TYPES), "no types specified for normalization"),
- env.classLoader);
- }
-
- /**
- * Normalize the classes found using the specified {@link Scanner}.
- * @param scanner to scan with
- * @return whether any work was done
- */
- public boolean normalize(final Scanner scanner) {
- boolean result = false;
- for (final Class<?> supertype : normalizeTypes) {
- final Set<Class<?>> subtypes = getBroadlyEligibleSubclasses(supertype, scanner);
- try {
- final Map<Pair<String, String>, Set<ClassWrapper>> segregatedSubtypes = segregate(subtypes);
- for (final Map.Entry<Pair<String, String>, Set<ClassWrapper>> entry : segregatedSubtypes.entrySet()) {
- final Set<ClassWrapper> likeTypes = entry.getValue();
- if (likeTypes.size() > 1) {
- result = true;
- rewrite(entry.getKey(), likeTypes);
- }
- }
- } catch (final RuntimeException e) {
- throw e;
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- }
- return result;
- }
-
- /**
- * Map a set of classes by their enclosing class.
- * @param sort values
- * @return {@link Map} of enclosing classname to {@link Map} of internal name to {@link ClassWrapper}
- */
- private Map<String, Map<String, ClassWrapper>> byEnclosingClass(final Set<ClassWrapper> sort) {
- final Map<String, Map<String, ClassWrapper>> result = new HashMap<String, Map<String, ClassWrapper>>();
- for (final ClassWrapper wrapper : sort) {
- final String outer = wrapper.wrapped.getEnclosingClass().getName();
- Map<String, ClassWrapper> map = result.get(outer);
- if (map == null) {
- map = new LinkedHashMap<String, Normalizer.ClassWrapper>();
- result.put(outer, map);
- }
- map.put(wrapper.wrapped.getName().replace('.', '/'), wrapper);
- }
- return result;
- }
-
- /**
- * Rewrite classes as indicated by one entry of {@link #segregate(Iterable)}.
- * @param key {@link String} {@link Pair} indicating supertype and constructor signature
- * @param toMerge matching classes
- * @throws IOException on I/O error
- * @throws ClassNotFoundException if class not found
- */
- private void rewrite(final Pair<String, String> key, final Set<ClassWrapper> toMerge) throws IOException,
- ClassNotFoundException {
- final String target = copy(key, toMerge.iterator().next());
- env.info("Merging %s identical %s implementations with constructor %s to type %s", toMerge.size(),
- key.getLeft(), key.getRight(), target);
-
- final Map<String, Map<String, ClassWrapper>> byEnclosingClass = byEnclosingClass(toMerge);
- for (final Map.Entry<String, Map<String, ClassWrapper>> entry : byEnclosingClass.entrySet()) {
- final String outer = entry.getKey();
- env.debug("Normalizing %s inner classes of %s", entry.getValue().size(), outer);
- final Map<String, String> classMap = new HashMap<String, String>();
- for (final String merged : entry.getValue().keySet()) {
- classMap.put(merged, target);
- }
- final Remapper remapper = new SimpleRemapper(classMap);
-
- InputStream enclosingBytecode = null;
- try {
- enclosingBytecode = env.getClassfile(outer).getInputStream();
- final ClassReader reader = new ClassReader(enclosingBytecode);
-
- final ClassVisitor cv = // NOPMD
- new RemappingClassAdapter(new WriteClass(reader), remapper) {
-
- @Override
- public void visitInnerClass(final String name, final String outerName, final String innerName,
- final int access) {
- if (!classMap.containsKey(name)) {
- super.visitInnerClass(name, outerName, innerName, access);
- }
- }
-
- @Override
- public MethodVisitor visitMethod(final int access, final String name, final String desc,
- final String signature, final String[] exceptions) {
- final MethodVisitor mv = // NOPMD
- super.visitMethod(access, name, desc, signature, exceptions);
- return new MethodVisitor(Opcodes.ASM4, mv) {
- @Override
- public void visitMethodInsn(final int opcode, final String owner, final String name,
- final String desc) {
- String useDescriptor = desc;
- if (INIT.equals(name)) {
- final ClassWrapper wrapper = entry.getValue().get(owner);
- if (wrapper != null && wrapper.mustRewriteConstructor) {
- // simply replace first argument type with OBJECT_TYPE:
- final Type[] args = Type.getArgumentTypes(desc);
- args[0] = OBJECT_TYPE;
- useDescriptor = new Method(INIT, Type.VOID_TYPE, args).getDescriptor();
- }
- }
- super.visitMethodInsn(opcode, owner, name, useDescriptor);
- }
- };
- }
- };
-
- reader.accept(cv, 0);
- } finally {
- IOUtils.closeQuietly(enclosingBytecode);
- }
- for (final String merged : entry.getValue().keySet()) {
- if (env.deleteClassfile(merged)) {
- env.debug("Deleted class %s", merged);
- } else {
- env.warn("Unable to delete class %s", merged);
- }
- }
- }
-
- }
-
- /**
- * <p>Find subclasses/implementors of {code supertype} that:
- * <ul>
- * <li>are anonymous</li>
- * <li>declare a single constructor (probably redundant in the case of an anonymous class)</li>
- * <li>do not implement any methods</li>
- * </ul>
- * </p><p>
- * Considered "broadly" eligible because the instructions in the implemented constructor may remove the class from
- * consideration later on.
- * </p>
- * @param supertype whose subtypes are sought
- * @param scanner to use
- * @return {@link Set} of {@link Class}
- * @see #segregate(Iterable)
- */
- private Set<Class<?>> getBroadlyEligibleSubclasses(final Class<?> supertype, final Scanner scanner) {
- final ScanResult scanResult = scanner.scan(new ScanRequest().addSupertypes(supertype));
- final Set<Class<?>> result = new LinkedHashSet<Class<?>>();
- for (final WeavableClass<?> cls : scanResult.getClasses()) {
- final Class<?> subtype = cls.getTarget();
- final IneligibilityReason reason;
- if (!subtype.isAnonymousClass()) {
- reason = IneligibilityReason.NOT_ANONYMOUS;
- } else if (subtype.getDeclaredConstructors().length != 1) {
- reason = IneligibilityReason.TOO_MANY_CONSTRUCTORS;
- } else if (subtype.getDeclaredMethods().length > 0) {
- reason = IneligibilityReason.IMPLEMENTS_METHODS;
- } else {
- result.add(subtype);
- continue;
- }
- env.debug("Removed %s from consideration due to %s", subtype, reason);
- }
- return result;
- }
-
- /**
- * <p>Segregate a number of classes (presumed subclasses/implementors of a
- * common supertype/interface). The keys of the map consist of the important
- * parts for identifying similar anonymous types: the "signature" and the
- * invoked superclass constructor. For our purposes, the signature consists
- * of the first applicable item of:
- * <ol>
- * <li>The generic signature of the class</li>
- * <li>The sole implemented interface</li>
- * <li>The superclass</li>
- * </ol>
- * </p><p>
- * The class will be considered ineligible if its constructor is too "busy" as its side effects cannot be
- * anticipated; the normalizer will err on the side of caution.
- * </p><p>
- * Further, we will here avail ourselves of the opportunity to discard any types we have already normalized.
- * </p>
- * @param subtypes
- * @return Map of Pair<String, String> to Set of Classes
- * @throws IOException
- */
- private Map<Pair<String, String>, Set<ClassWrapper>> segregate(final Iterable<Class<?>> subtypes)
- throws IOException {
- final Map<Pair<String, String>, Set<ClassWrapper>> classMap =
- new LinkedHashMap<Pair<String, String>, Set<ClassWrapper>>();
- for (final Class<?> subtype : subtypes) {
- final MutablePair<String, String> key = new MutablePair<String, String>();
- final MutableBoolean ignore = new MutableBoolean(false);
- final MutableBoolean valid = new MutableBoolean(true);
- final MutableBoolean mustRewriteConstructor = new MutableBoolean();
- InputStream bytecode = null;
-
- try {
- bytecode = env.getClassfile(subtype).getInputStream();
- new ClassReader(bytecode).accept(new ClassVisitor(Opcodes.ASM4) {
- String superName;
-
- @Override
- public void visit(final int version, final int access, final String name, final String signature,
- final String superName, final String[] interfaces) {
- super.visit(version, access, name, signature, superName, interfaces);
- this.superName = superName;
- final String left;
- if (signature != null) {
- left = signature;
- } else if (ArrayUtils.getLength(interfaces) == 1) {
- left = interfaces[0];
- } else {
- left = superName;
- }
- key.setLeft(left);
- }
-
- @Override
- public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
- if (Type.getType(Marker.class).getDescriptor().equals(desc)) {
- ignore.setValue(true);
- }
- return null;
- }
-
- @Override
- public MethodVisitor visitMethod(final int access, final String name, final String desc,
- final String signature, final String[] exceptions) {
- if (INIT.equals(name)) {
- return new MethodVisitor(Opcodes.ASM4) {
- @Override
- public void visitMethodInsn(final int opcode, final String owner, final String name,
- final String desc) {
- if (INIT.equals(name) && owner.equals(superName)) {
- key.setRight(desc);
- } else {
- valid.setValue(false);
- }
- }
-
- @Override
- public void visitFieldInsn(final int opcode, final String owner, final String name,
- final String desc) {
- if ("this$0".equals(name) && opcode == Opcodes.PUTFIELD) {
- mustRewriteConstructor.setValue(true);
- return;
- }
- valid.setValue(false);
- }
- };
- }
- return null;
- }
- }, 0);
- } finally {
- IOUtils.closeQuietly(bytecode);
- }
- if (ignore.booleanValue()) {
- continue;
- }
- if (valid.booleanValue()) {
- Set<ClassWrapper> set = classMap.get(key);
- if (set == null) {
- set = new LinkedHashSet<ClassWrapper>();
- classMap.put(key, set);
- }
- set.add(new ClassWrapper(subtype, mustRewriteConstructor.booleanValue()));
- } else {
- env.debug("%s is ineligible for normalization due to %s", subtype,
- IneligibilityReason.TOO_BUSY_CONSTRUCTOR);
- }
- }
- return classMap;
- }
-
- /**
- * Create the normalized version of a given class in the configured target package. The {@link Normalizer} will
- * gladly do so in a package from which the normalized class will not actually be able to reference any types upon
- * which it relies; in such a situation you must specify the target package as the package of the supertype.
- * @param key used to generate the normalized classname.
- * @param classWrapper
- * @return the generated classname.
- * @throws IOException
- * @throws ClassNotFoundException
- */
- private String copy(final Pair<String, String> key, final ClassWrapper classWrapper) throws IOException,
- ClassNotFoundException {
- final MessageDigest md5;
- try {
- md5 = MessageDigest.getInstance("MD5");
- } catch (final NoSuchAlgorithmException e) {
- throw new RuntimeException(e);
- }
- md5.update(key.getLeft().getBytes(UTF8));
- md5.update(key.getRight().getBytes(UTF8));
-
- final long digest = Conversion.byteArrayToLong(md5.digest(), 0, 0L, 0, Long.SIZE / Byte.SIZE);
-
- final String result = MessageFormat.format("{0}/$normalized{1,number,0;_0}", targetPackage, digest);
-
- env.debug("Copying class %s to %s", classWrapper.wrapped.getName(), result);
-
- InputStream bytecode = null;
-
- try {
- bytecode = env.getClassfile(classWrapper.wrapped).getInputStream();
- final ClassReader reader = new ClassReader(bytecode);
-
- final ClassVisitor writeClass = new WriteClass();
-
- // we're doing most of this by hand; we only read the original class to hijack signature, ctor exceptions,
- // etc.:
-
- reader.accept(new ClassVisitor(Opcodes.ASM4) {
- Type supertype;
-
- @Override
- public void visit(final int version, final int access, final String name, final String signature,
- final String superName, final String[] interfaces) {
- supertype = Type.getObjectType(superName);
- writeClass.visit(version, Opcodes.ACC_PUBLIC, result, signature, superName, interfaces);
-
- visitAnnotation(Type.getType(Marker.class).getDescriptor(), false);
- }
-
- @Override
- public MethodVisitor visitMethod(final int access, final String name, final String desc,
- final String signature, final String[] exceptions) {
- if (INIT.equals(name)) {
-
- final Method staticCtor = new Method(INIT, key.getRight());
- final Type[] argumentTypes = staticCtor.getArgumentTypes();
- final Type[] exceptionTypes = toObjectTypes(exceptions);
-
- {
- final GeneratorAdapter mgen =
- new GeneratorAdapter(Opcodes.ACC_PUBLIC, staticCtor, signature, exceptionTypes,
- writeClass);
- mgen.visitCode();
- mgen.loadThis();
- for (int i = 0; i < argumentTypes.length; i++) {
- mgen.loadArg(i);
- }
- mgen.invokeConstructor(supertype, staticCtor);
- mgen.returnValue();
- mgen.endMethod();
- }
- /*
- * now declare a dummy constructor that will match, and discard,
- * any originally inner-class bound constructor i.e. that set up a this$0 field.
- * By doing this we can avoid playing with the stack that originally
- * invoked such a constructor and simply rewrite the method
- */
- {
- final Method instanceCtor =
- new Method(INIT, Type.VOID_TYPE, ArrayUtils.add(argumentTypes, 0, OBJECT_TYPE));
- final GeneratorAdapter mgen =
- new GeneratorAdapter(Opcodes.ACC_PUBLIC, instanceCtor, signature, exceptionTypes,
- writeClass);
- mgen.visitCode();
- mgen.loadThis();
- for (int i = 0; i < argumentTypes.length; i++) {
- mgen.loadArg(i + 1);
- }
- mgen.invokeConstructor(supertype, staticCtor);
- mgen.returnValue();
- mgen.endMethod();
- }
- return null;
- }
- return null;
- }
-
- @Override
- public void visitEnd() {
- writeClass.visitEnd();
- }
- }, 0);
- } finally {
- IOUtils.closeQuietly(bytecode);
- }
- return result;
- }
-
- /**
- * Translate internal names to Java type names.
- * @param types to translate
- * @return {@link Type}[]
- * @see Type#getObjectType(String)
- */
- private static Type[] toObjectTypes(final String[] types) {
- if (types == null) {
- return null;
- }
- final Type[] result = new Type[types.length];
- for (int i = 0; i < types.length; i++) {
- result[i] = Type.getObjectType(types[i]);
- }
- return result;
- }
-}
diff --git a/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/NormalizerWeaver.java b/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/NormalizerWeaver.java
deleted file mode 100644
index 0b8693a..0000000
--- a/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/NormalizerWeaver.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.commons.weaver.normalizer;
-
-import org.apache.commons.weaver.model.Scanner;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-import org.apache.commons.weaver.spi.Weaver;
-
-/**
- * The purpose of the normalizer module is to merge identical anonymous class definitions into a single type, thereby
- * "normalizing" them and reducing their collective footprint on your archive and more importantly on your JVM.
- */
-public class NormalizerWeaver implements Weaver {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean process(final WeaveEnvironment environment, final Scanner scanner) {
- return new Normalizer(environment).normalize(scanner);
- }
-
-}
diff --git a/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Utils.java b/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Utils.java
deleted file mode 100644
index 93d1bea..0000000
--- a/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/Utils.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.commons.weaver.normalizer;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.apache.commons.lang3.ClassUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.Validate;
-
-/**
- * Normalization utilities.
- */
-final class Utils {
- private Utils() {
- }
-
- /**
- * Validate a package name.
- * @param pkg to validate
- * @return {@code pkg}, ({@code ""} if {@code null}), having replaced
- * {@code '.'} with {@code '/'} and removed any terminating separator
- * @throws IllegalArgumentException if invalid
- */
- static String validatePackageName(final String pkg) {
- if (StringUtils.isBlank(pkg)) {
- return "";
- }
- String result = pkg.trim();
-
- final String unexpected = "Unexpected character %s at pos %s of package name \"%s\"";
-
- boolean next = true;
- for (int pos = 0; pos < result.length(); pos++) {
- final char chr = result.charAt(pos);
- if (next) {
- next = false;
- Validate.isTrue(Character.isJavaIdentifierStart(chr), unexpected, chr, pos, result);
- continue;
- }
- if (chr == '/' || chr == '.') {
- next = true;
- continue;
- }
- Validate.isTrue(Character.isJavaIdentifierPart(chr), unexpected, chr, pos, result);
- }
-
- result = result.replace('.', '/');
- final int last = result.length() - 1;
- if (result.charAt(last) == '/') {
- result = result.substring(0, last);
- }
- return result;
- }
-
- /**
- * Parse a number of Java types speciified as a comma-delimited
- * {@link String} of fully-qualified or internal names (i.e., slashes are
- * legal).
- * @param types to parse
- * @param classLoader {@link ClassLoader} to search
- * @return {@link Set} of {@link Class}
- */
- static Set<Class<?>> parseTypes(final String types, final ClassLoader classLoader) {
- final Set<Class<?>> result = new LinkedHashSet<Class<?>>();
- for (final String token : StringUtils.splitByWholeSeparatorPreserveAllTokens(types, ",")) {
- try {
- result.add(ClassUtils.getClass(classLoader, token.trim().replace('/', '.')));
- } catch (final ClassNotFoundException e) {
- throw new IllegalArgumentException(e);
- }
- }
- return result;
- }
-}
diff --git a/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/package-info.java b/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/package-info.java
deleted file mode 100644
index 584b015..0000000
--- a/trunk/modules/normalizer/weaver/src/main/java/org/apache/commons/weaver/normalizer/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * Implements the Normalizer weaver, whose purpose is to collapse identical
- * anonymous class definitions into a single one.
- */
-package org.apache.commons.weaver.normalizer;
\ No newline at end of file
diff --git a/trunk/modules/normalizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver b/trunk/modules/normalizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver
deleted file mode 100644
index 12a05ca..0000000
--- a/trunk/modules/normalizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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 class gets picked up by the WeaveProcessor
-org.apache.commons.weaver.normalizer.NormalizerWeaver
diff --git a/trunk/modules/normalizer/weaver/src/test/java/org/apache/commons/weaver/normalizer/UtilsTest.java b/trunk/modules/normalizer/weaver/src/test/java/org/apache/commons/weaver/normalizer/UtilsTest.java
deleted file mode 100644
index d12eac2..0000000
--- a/trunk/modules/normalizer/weaver/src/test/java/org/apache/commons/weaver/normalizer/UtilsTest.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.commons.weaver.normalizer;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.junit.Test;
-
-public class UtilsTest {
- @Test
- public void testValidatePackageName() {
- assertEquals("", Utils.validatePackageName(""));
- assertEquals("", Utils.validatePackageName(" "));
- assertEquals("foo", Utils.validatePackageName("foo"));
- assertEquals("foo/bar", Utils.validatePackageName("foo.bar"));
- assertEquals("foo/bar", Utils.validatePackageName("foo/bar"));
- assertEquals("foo/bar/baz", Utils.validatePackageName("foo.bar.baz"));
- assertEquals("foo/bar/baz", Utils.validatePackageName("foo.bar/baz"));
- assertEquals("foo/bar/baz", Utils.validatePackageName("foo/bar.baz"));
- assertEquals("foo/bar/baz", Utils.validatePackageName("foo/bar/baz"));
- assertEquals("$foo", Utils.validatePackageName("$foo"));
- assertEquals("_foo", Utils.validatePackageName("_foo"));
- assertEquals("foo2", Utils.validatePackageName("foo2"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testValidatePackageNameStartsWithDigit() {
- Utils.validatePackageName("2foo");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testValidatePackageNameEmbeddedWhitespace() {
- Utils.validatePackageName("foo bar");
- }
-
- @Test
- public void testParseTypes() {
- assertContainsInOrder(Utils.parseTypes(" java.lang.Number ", getClass().getClassLoader()), Number.class);
- assertContainsInOrder(
- Utils.parseTypes("java.lang.Number,java.lang.String,java.util.Map", getClass().getClassLoader()),
- Number.class, String.class, Map.class);
- assertContainsInOrder(
- Utils.parseTypes("java.lang.Number, java.lang.String, java.util.Map", getClass().getClassLoader()),
- Number.class, String.class, Map.class);
- assertContainsInOrder(
- Utils.parseTypes("java/lang/Number, java/lang/String, java/util/Map", getClass().getClassLoader()),
- Number.class, String.class, Map.class);
- assertContainsInOrder(
- Utils.parseTypes("java.lang.Number,\njava.lang.String,\njava.util.Map", getClass().getClassLoader()),
- Number.class, String.class, Map.class);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testParseUnknownType() {
- Utils.parseTypes("gobbledygook", getClass().getClassLoader());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testParseMissingFirstType() {
- Utils.parseTypes(",java.lang.Object", getClass().getClassLoader());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testParseMissingLastType() {
- Utils.parseTypes("java.lang.Object,", getClass().getClassLoader());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testParseMissingType() {
- Utils.parseTypes("java.lang.Object,,java.lang.Iterable", getClass().getClassLoader());
- }
-
- <E> void assertContainsInOrder(Iterable<E> iterable, E... expectedElements) {
- final Iterator<E> iterator = iterable.iterator();
- for (E e : expectedElements) {
- assertTrue(iterator.hasNext());
- assertEquals(e, iterator.next());
- }
- assertFalse(iterator.hasNext());
- }
-}
diff --git a/trunk/modules/pom.xml b/trunk/modules/pom.xml
deleted file mode 100644
index fa1245e..0000000
--- a/trunk/modules/pom.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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>commons-weaver-parent</artifactId>
- <groupId>org.apache.commons</groupId>
- <version>1.0</version>
- </parent>
-
- <artifactId>commons-weaver-modules-parent</artifactId>
- <packaging>pom</packaging>
-
- <name>Apache Commons Weaver Modules aggregator project</name>
- <description>Hosts weaver modules.</description>
- <modules>
- <module>privilizer</module>
- <module>normalizer</module>
- </modules>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/modules</url>
- </scm>
-
- <dependencies>
- <dependency>
- <!-- we need this dependency for the reactor to correctly resolve the build order -->
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-maven-plugin</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/modules/privilizer/api/pom.xml b/trunk/modules/privilizer/api/pom.xml
deleted file mode 100644
index 953f51c..0000000
--- a/trunk/modules/privilizer/api/pom.xml
+++ /dev/null
@@ -1,73 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-parent</artifactId>
- <version>1.0</version>
- </parent>
-
- <artifactId>commons-weaver-privilizer-api</artifactId>
- <name>Apache Commons Weaver Privilizer API</name>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/privilizer/api</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/privilizer/api</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/modules/privilizer/api</url>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-test-sources</id>
- <phase />
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <phase />
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
- <configuration>
- <configLocation>org/apache/commons/weaver/checkstyle.xml</configLocation>
- <headerLocation>org/apache/commons/weaver/license-header.txt</headerLocation>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-</project>
diff --git a/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/Privileged.java b/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/Privileged.java
deleted file mode 100644
index 08f0564..0000000
--- a/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/Privileged.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.privilizer;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marks a method as needing to execute in a privileged fashion in secured
- * environments.
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.CLASS)
-public @interface Privileged {
-}
diff --git a/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/Privilizing.java b/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/Privilizing.java
deleted file mode 100644
index e4604b9..0000000
--- a/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/Privilizing.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.commons.weaver.privilizer;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Indicates that a certain set of method calls should be "blueprint privilized," i.e.,
- * their method bodies should be (recursively) copied for privileged invocation
- * per the privilizer policy with which the blueprint privilizer weaver is invoked.
- */
-@Target(ElementType.TYPE)
-public @interface Privilizing {
- /**
- * Models calls to blueprint methods defined on a specific class.
- */
- public @interface CallTo {
- /**
- * The class owning one or more blueprint method.
- */
- Class<?> value();
-
- /**
- * The names of the blueprint methods.
- */
- String[] methods() default { };
- }
-
- /**
- * List of blueprint calls.
- */
- CallTo[] value();
-}
diff --git a/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/package-info.java b/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/package-info.java
deleted file mode 100644
index 9b5fb44..0000000
--- a/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Defines the annotations that drive the privilizer weaver.
- */
-package org.apache.commons.weaver.privilizer;
\ No newline at end of file
diff --git a/trunk/modules/privilizer/pom.xml b/trunk/modules/privilizer/pom.xml
deleted file mode 100644
index 5e5a727..0000000
--- a/trunk/modules/privilizer/pom.xml
+++ /dev/null
@@ -1,48 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-modules-parent</artifactId>
- <version>1.0</version>
- </parent>
-
- <artifactId>commons-weaver-privilizer-parent</artifactId>
- <packaging>pom</packaging>
-
- <name>Apache Commons Weaver Privilizer Parent POM</name>
-
- <description>
- Privilizer provides machinery to automate the handling of Java Security access controls in code.
- </description>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/privilizer</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/privilizer</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/modules/privilizer</url>
- </scm>
-
- <modules>
- <module>api</module>
- <module>weaver</module>
- </modules>
-</project>
diff --git a/trunk/modules/privilizer/src/site/markdown/index.md b/trunk/modules/privilizer/src/site/markdown/index.md
deleted file mode 100644
index 54ff2c3..0000000
--- a/trunk/modules/privilizer/src/site/markdown/index.md
+++ /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.
--->
-
-## Apache Commons Weaver Privilizer
-
-Provides machinery to automate the handling of Java Security access
-controls in code. This involves wrapping calls that may trigger
-`java.lang.SecurityException`s in `PrivilegedAction` objects.
-Unfortunately this is quite an expensive operation and slows code
-down considerably; when executed in an environment that has no
-`SecurityManager` activated it is an utter waste.
-The typical pattern to cope with this is:
-
-```java
-if (System.getSecurityManager() != null) {
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- public Void run() {
- doSomethingThatRequiresPermissions();
- return null;
- }
- });
-} else {
- doSomethingThatRequiresPermissions();
-}
-```
-
-This becomes tedious in short order. The immediate response of a
-typical developer: relegate the repetitive code to a set of
-utility methods. In the case of Java security, however, this
-approach is considered risky. The purpose of the Privilizer, then,
-is to instrument compiled methods originally annotated with our
-`@Privileged` annotation. This annotation is retained in the
-classfiles, but not available at runtime, and there are no runtime
-dependencies.
-
-### Basic Privilization
-
-```java
-
-@Privileged
-private void doSomethingThatRequiresPermissions() {
- ...
-}
-```
-
-Annotating a method with the [@Privileged][privileged] annotation will cause
-the [PrivilizerWeaver][privilizerWeaver] to generate these checks automatically,
-leaving you to simply implement the code!
-
-### Blueprint Privilization
-The so-called "blueprint" feature returns to the concept of static utility
-methods. Why are these considered a liability? Because your trusted code
-presumptuously extends your trust via public methods to any class in the JVM,
-almost certainly contrary to the wishes of the owner of that JVM. Our
-blueprint technique allows you to define (or reuse) static utility methods
-in a secure way: simply define these utility methods in a
-`SecurityManager`-agnostic manner and let the consuming class request that
-calls to them be treated as blueprints for `@Privileged` methods:
-
-```java
-public class Utils {
- public static void doSomethingThatRequiresPrivileges() {
- ...
- }
-}
-
-@Privilizing(CallTo(Utils.class))
-public class UtilsClient {
- public void foo() {
- Utils.doSomethingThatRequiresPrivileges();
- }
-}
-```
-
-The static methods of the `Utils` class will be called as though they had been
-locally declared and annotated with `@Privileged`. See the documentation of the
-[@Privilizing][privilizing] annotation for more information on how to specify
-multiple classes, restrict to only certain methods, etc.
-
-*Q:* What if my utility methods access static variables of their declaring class?
-
-*A:* The imported methods reference those fields via reflection; i.e. the
- original fields are used.
-
-*Q:* Does this modify the accessibility of those fields?
-
-*A:* Yes, but only for the duration of the method implementation. The fields'
- accessibility is checked before execution, and if a given field is not
- accessible on the way in, it will be restored to its original state in
- a `finally` block.
-
-### Configuration
-The `PrivilizerWeaver` supports the following options:
-
-- `privilizer.accessLevel` : name of the highest [AccessLevel][accessLevel] to privilize (default `PRIVATE`)
-- `privilizer.policy` : name of the [Policy][policy] (determines when to check for a `SecurityManager`)
-
-[privileged]: ../../apidocs/org/apache/commons/weaver/privilizer/Privileged.html
-[privilizerWeaver]: ../../apidocs/org/apache/commons/weaver/privilizer/PrivilizerWeaver.html
-[privilizing]: ../../apidocs/org/apache/commons/weaver/privilizer/Privilizing.html
-[policy]: ../../apidocs/org/apache/commons/weaver/privilizer/Policy.html
-[accessLevel]: ../../apidocs/org/apache/commons/weaver/privilizer/AccessLevel.html
diff --git a/trunk/modules/privilizer/weaver/pom.xml b/trunk/modules/privilizer/weaver/pom.xml
deleted file mode 100644
index b5c67d3..0000000
--- a/trunk/modules/privilizer/weaver/pom.xml
+++ /dev/null
@@ -1,226 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-parent</artifactId>
- <version>1.0</version>
- </parent>
-
- <artifactId>commons-weaver-privilizer</artifactId>
- <name>Apache Commons Weaver Privilizer Weaver</name>
- <description>
- Implements the Apache Commons Weaver SPI for the Privilizer module.
- </description>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/privilizer/weaver</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/modules/privilizer/weaver</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/modules/privilizer/weaver</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-processor</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- </dependencies>
- <profiles>
- <profile>
- <id>basic</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm</artifactId>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-commons</artifactId>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-tree</artifactId>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-analysis</artifactId>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>dev</id>
- <dependencies>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-debug-all</artifactId>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-test-sources</id>
- <phase />
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <phase />
- </execution>
- </executions>
- </plugin>
- <!-- shade plugin creates but does not clean ${basedir}/dependency-reduced-pom.xml -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <configuration>
- <filesets>
- <fileset>
- <directory>${basedir}</directory>
- <includes>
- <include>dependency-reduced-pom.xml</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>2.1</version>
- <executions>
- <execution>
- <id>shade</id>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <minimizeJar>true</minimizeJar>
- <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
- <artifactSet>
- <includes>
- <include>org.apache.commons:commons-lang3</include>
- <include>commons-io:commons-io</include>
- <include>org.ow2.asm:*</include>
- </includes>
- </artifactSet>
- <relocations>
- <relocation>
- <pattern>org.apache.commons.lang3.</pattern>
- <shadedPattern>org.apache.commons.weaver.privilizer._lang3.</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.apache.commons.io.</pattern>
- <shadedPattern>org.apache.commons.weaver.privilizer._io.</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.objectweb.asm.</pattern>
- <shadedPattern>org.apache.commons.weaver.privilizer._asm.</shadedPattern>
- </relocation>
- </relocations>
- <filters>
- <filter>
- <artifact>org.apache.commons:commons-lang3</artifact>
- <excludes>
- <exclude>META-INF/**</exclude>
- </excludes>
- </filter>
- <filter>
- <artifact>commons-io:commons-io</artifact>
- <excludes>
- <exclude>META-INF/**</exclude>
- </excludes>
- </filter>
- <filter>
- <artifact>org.ow2.asm:*</artifact>
- <excludes>
- <exclude>META-INF/**</exclude>
- </excludes>
- </filter>
- </filters>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <rulesets>
- <ruleset>/org/apache/commons/weaver/pmd.xml</ruleset>
- </rulesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
- <configuration>
- <configLocation>org/apache/commons/weaver/checkstyle.xml</configLocation>
- <headerLocation>org/apache/commons/weaver/license-header.txt</headerLocation>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <configuration>
- <xmlOutput>true</xmlOutput>
- <excludeFilterFile>/org/apache/commons/weaver/findbugs-exclude-filter.xml</excludeFilterFile>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-</project>
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/AccessLevel.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/AccessLevel.java
deleted file mode 100644
index 28e01af..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/AccessLevel.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.privilizer;
-
-import java.lang.reflect.Modifier;
-import java.util.EnumSet;
-import java.util.Locale;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.Validate;
-
-/**
- * Enumerates the Java access levels.
- */
-public enum AccessLevel {
- /**
- * {@code public}.
- */
- PUBLIC(Modifier.PUBLIC),
-
- /**
- * {@code protected}.
- */
- PROTECTED(Modifier.PROTECTED),
-
- /**
- * {@code ""}.
- */
- PACKAGE(0),
-
- /**
- * {@code private}.
- */
- PRIVATE(Modifier.PRIVATE);
-
- private final int flag;
-
- private AccessLevel(final int flag) {
- this.flag = flag;
- }
-
- /**
- * Get the {@link AccessLevel} specified by a Java modifier.
- * @param mod from which to extract
- * @return {@link AccessLevel}
- * @throws IllegalArgumentException if multiple access modifiers specified
- */
- public static AccessLevel of(final int mod) {
- final Set<AccessLevel> matched = EnumSet.noneOf(AccessLevel.class);
- if (Modifier.isPublic(mod)) {
- matched.add(PUBLIC);
- }
- if (Modifier.isProtected(mod)) {
- matched.add(PROTECTED);
- }
- if (Modifier.isPrivate(mod)) {
- matched.add(PRIVATE);
- }
- if (matched.isEmpty()) {
- return PACKAGE;
- }
- Validate.isTrue(matched.size() == 1, "%s seems to declare multiple access modifiers: %s", mod, matched);
- return matched.iterator().next();
- }
-
- /**
- * Overlay this {@link AccessLevel} onto a Java modifier value.
- * @param mod input
- * @return {@code mod}, with this {@link AccessLevel}
- */
- public int merge(final int mod) {
- int remove = 0;
- for (final AccessLevel accessLevel : EnumSet.complementOf(EnumSet.of(this))) {
- remove |= accessLevel.flag;
- }
- return mod & ~remove | flag;
- }
-
- /**
- * Render this {@link AccessLevel} as a {@link String}.
- * @return {@link String}
- */
- @Override
- public String toString() {
- return name().toLowerCase(Locale.US);
- }
-
- /**
- * Get the {@link AccessLevel} value that should be used as a default.
- * This is <em>not</em> "default"/{@code package} access, but rather the default
- * value that should be used for privilizer weaving.
- * @return {@link AccessLevel#PRIVATE}
- */
- public static AccessLevel defaultValue() {
- return AccessLevel.PRIVATE;
- }
-
- /**
- * Parse from a {@link String} returning {@link #defaultValue()} for blank/null input.
- * @param str to parse
- * @return {@link AccessLevel}
- */
- public static AccessLevel parse(final String str) {
- if (StringUtils.isBlank(str)) {
- return defaultValue();
- }
- return valueOf(str.trim().toUpperCase(Locale.US));
- }
-}
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/ActionGenerator.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/ActionGenerator.java
deleted file mode 100644
index 710bd0f..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/ActionGenerator.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.privilizer;
-
-import java.lang.reflect.Modifier;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.util.Map;
-
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.lang3.builder.Builder;
-import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.Label;
-import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.Type;
-import org.objectweb.asm.commons.GeneratorAdapter;
-import org.objectweb.asm.commons.Method;
-import org.objectweb.asm.signature.SignatureReader;
-import org.objectweb.asm.signature.SignatureVisitor;
-import org.objectweb.asm.signature.SignatureWriter;
-
-/**
- * Generates the Privileged[Exception?]Action class to privilize a given Method.
- */
-class ActionGenerator extends Privilizer.WriteClass implements Builder<Type> {
- final PrivilizingVisitor owner;
- final Method methd;
- final boolean exc;
- final Type[] exceptions;
- final String simpleName;
- final Type action;
- final Method impl;
- final int index;
- final boolean implIsStatic;
- final Method helper;
- final Type result;
- final Field[] fields;
- private final Type actionInterface;
-
- /**
- * Create a new {@link ActionGenerator}.
- * @param access modifier
- * @param methd {@link Method} to implement
- * @param exceptions thrown
- * @param owner of the action class
- */
- ActionGenerator(final int access, final Method methd, final String[] exceptions, final PrivilizingVisitor owner) {
- owner.privilizer().super(new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES));
- this.methd = methd;
- this.exc = ArrayUtils.isNotEmpty(exceptions);
- this.exceptions = exc ? new Type[] { Type.getType(Exception.class) } : null;
- this.owner = owner;
- this.simpleName = generateName(methd);
- this.action = Type.getObjectType(owner.className + '$' + simpleName);
-
- int privilegedAccessIndex = -1;
- String implName = null;
- for (final Map.Entry<Method, String> entry : owner.privilegedMethods.entrySet()) {
- privilegedAccessIndex++;
- if (entry.getKey().equals(methd)) {
- implName = entry.getValue();
- break;
- }
- }
- Validate.validState(implName != null);
-
- this.index = privilegedAccessIndex;
-
- this.impl = new Method(implName, methd.getDescriptor());
- this.implIsStatic = Modifier.isStatic(access);
- final Type[] args =
- implIsStatic ? methd.getArgumentTypes() : ArrayUtils.add(methd.getArgumentTypes(), 0, owner.target);
- this.helper = new Method(privilizer().generateName("access$" + index), methd.getReturnType(), args);
- this.result = privilizer().wrap(methd.getReturnType());
- this.fields = fields(args);
- this.actionInterface = Type.getType(exc ? PrivilegedExceptionAction.class : PrivilegedAction.class);
- }
-
- private static String generateName(final Method methd) {
- final StringBuilder buf = new StringBuilder(methd.getName());
- if (methd.getArgumentTypes().length > 0) {
- buf.append("$$");
- for (final Type arg : methd.getArgumentTypes()) {
- buf.append(arg.getDescriptor().replace("[", "arrayOf").replace('/', '_').replace(';', '$'));
- }
- }
- return buf.append("_ACTION").toString();
- }
-
- private static Field[] fields(final Type[] args) {
- final Field[] result = new Field[args.length];
-
- for (int i = 0; i < args.length; i++) {
- final String name = new StringBuilder("f").append(i + 1).toString();
- result[i] = new Field(Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL, name, args[i]);
- }
- return result;
- }
-
- @Override
- public Type build() {
- generateHelper();
- begin();
- init();
- impl();
- visitEnd();
- owner.privilizer().env.debug("Generated %s implementation %s to call %s#%s", actionInterface.getClassName(),
- action.getClassName(), owner.target.getClassName(), helper);
- return action;
- }
-
- /**
- * We must add special methods for inner classes to invoke their owners' methods, according to the scheme "access$n"
- * where n is the index into this (ordered) map. Additionally we will prefix the whole thing like we usually do
- * (__privileged_):
- */
- private void generateHelper() {
- owner.privilizer().env.debug("Generating static helper method %s.%s to call %s", owner.target.getClassName(),
- helper, impl);
- final GeneratorAdapter mgen =
- new GeneratorAdapter(Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC, helper, null, exceptions, owner);
-
- mgen.visitCode();
- mgen.loadArgs();
- if (implIsStatic) {
- mgen.invokeStatic(owner.target, impl);
- } else {
- mgen.invokeVirtual(owner.target, impl);
- }
- mgen.returnValue();
- mgen.endMethod();
- }
-
- private void begin() {
- owner.visitInnerClass(action.getInternalName(), owner.className, simpleName, Opcodes.ACC_PRIVATE
- | Opcodes.ACC_STATIC);
-
- final SignatureWriter type = new SignatureWriter();
- final SignatureVisitor actionImplemented = type.visitInterface();
- actionImplemented.visitClassType(actionInterface.getInternalName());
- final SignatureVisitor visitTypeArgument = actionImplemented.visitTypeArgument('=');
- final SignatureReader result = new SignatureReader(privilizer().wrap(methd.getReturnType()).getDescriptor());
- result.accept(visitTypeArgument);
- actionImplemented.visitEnd();
-
- final String signature = type.toString();
-
- visit(Opcodes.V1_5, Opcodes.ACC_SUPER | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_FINAL, action.getInternalName(),
- signature, Type.getType(Object.class).getInternalName(),
- new String[] { actionInterface.getInternalName() });
- }
-
- /**
- * Add fields and generate constructor.
- */
- private void init() {
- for (final Field field : fields) {
- visitField(field.access, field.name, field.type.getDescriptor(), null, null).visitEnd();
- }
- final Method init = new Method("<init>", Type.VOID_TYPE, helper.getArgumentTypes());
-
- final GeneratorAdapter mgen =
- new GeneratorAdapter(0, init, null, Privilizer.EMPTY_TYPE_ARRAY, this);
-
- mgen.visitCode();
- final Label begin = mgen.mark();
-
- // invoke super constructor
- mgen.loadThis();
- mgen.invokeConstructor(Type.getType(Object.class), Method.getMethod("void <init> ()"));
- // assign remaining fields
-
- int arg = 0;
- for (final Field field : fields) {
- mgen.loadThis();
- mgen.loadArg(arg++);
- mgen.putField(action, field.name, field.type);
- }
-
- mgen.returnValue();
- final Label end = mgen.mark();
-
- // declare local vars
- mgen.visitLocalVariable("this", action.getDescriptor(), null, begin, end, 0);
- arg = 1;
- for (final Field field : fields) {
- mgen.visitLocalVariable("arg" + arg, field.type.getDescriptor(), null, begin, end, arg++);
- }
- mgen.endMethod();
- }
-
- /**
- * Generate impl method.
- */
- private void impl() {
- final Method run = Method.getMethod("Object run()");
-
- final GeneratorAdapter mgen = new GeneratorAdapter(Opcodes.ACC_PUBLIC, run, null, exceptions, this);
-
- for (final Field field : fields) {
- mgen.loadThis();
- mgen.getField(action, field.name, field.type);
- }
-
- mgen.invokeStatic(owner.target, helper);
-
- if (methd.getReturnType().getSort() < Type.ARRAY) {
- mgen.valueOf(methd.getReturnType());
- }
-
- mgen.returnValue();
-
- mgen.endMethod();
- }
-
-}
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/BlueprintingVisitor.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/BlueprintingVisitor.java
deleted file mode 100644
index 6311709..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/BlueprintingVisitor.java
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.privilizer;
-
-import java.io.InputStream;
-import java.lang.reflect.Modifier;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.BitSet;
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.lang3.mutable.MutableObject;
-import org.apache.commons.lang3.tuple.Pair;
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.FieldVisitor;
-import org.objectweb.asm.Label;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.Type;
-import org.objectweb.asm.commons.AdviceAdapter;
-import org.objectweb.asm.commons.GeneratorAdapter;
-import org.objectweb.asm.commons.Method;
-import org.objectweb.asm.tree.ClassNode;
-import org.objectweb.asm.tree.MethodNode;
-
-/**
- * {@link ClassVisitor} to import so-called "blueprint methods".
- */
-class BlueprintingVisitor extends Privilizer.PrivilizerClassVisitor {
-
- private final Set<Type> blueprintTypes = new HashSet<Type>();
- private final Map<Pair<Type, Method>, MethodNode> blueprintRegistry = new HashMap<Pair<Type, Method>, MethodNode>();
-
- private final Map<Pair<Type, Method>, String> importedMethods = new HashMap<Pair<Type, Method>, String>();
-
- private final Map<Type, Map<Method, MethodNode>> methodCache = new HashMap<Type, Map<Method, MethodNode>>();
- private final Map<Pair<Type, String>, FieldAccess> fieldAccessMap = new HashMap<Pair<Type, String>, FieldAccess>();
-
- private final ClassVisitor next;
-
- /**
- * Create a new {@link BlueprintingVisitor}.
- * @param privilizer owner
- * @param cv wrapped
- * @param config annotation
- */
- BlueprintingVisitor(final Privilizer privilizer,
- final ClassVisitor cv, //NOPMD
- final Privilizing config) {
- privilizer.super(new ClassNode(Opcodes.ASM4));
- this.next = cv;
-
- // load up blueprint methods:
- for (final Privilizing.CallTo callTo : config.value()) {
- final Type blueprintType = Type.getType(callTo.value());
- blueprintTypes.add(blueprintType);
- for (final Map.Entry<Method, MethodNode> entry : getMethods(blueprintType).entrySet()) {
- boolean found = false;
- if (callTo.methods().length == 0) {
- found = true;
- } else {
- for (final String name : callTo.methods()) {
- if (entry.getKey().getName().equals(name)) {
- found = true;
- break;
- }
- }
- }
- if (found) {
- blueprintRegistry.put(Pair.of(blueprintType, entry.getKey()), entry.getValue());
- }
- }
- }
- }
-
- private Map<Method, MethodNode> getMethods(final Type type) {
- if (methodCache.containsKey(type)) {
- return methodCache.get(type);
- }
- final ClassNode classNode = read(type.getClassName());
- final Map<Method, MethodNode> result = new HashMap<Method, MethodNode>();
-
- @SuppressWarnings("unchecked")
- final List<MethodNode> methods = classNode.methods;
-
- for (final MethodNode methodNode : methods) {
- if (Modifier.isStatic(methodNode.access) && !"<clinit>".equals(methodNode.name)) {
- result.put(new Method(methodNode.name, methodNode.desc), methodNode);
- }
- }
- methodCache.put(type, result);
- return result;
- }
-
- private ClassNode read(final String className) {
- final ClassNode result = new ClassNode(Opcodes.ASM4);
- InputStream bytecode = null;
- try {
- bytecode = privilizer().env.getClassfile(className).getInputStream();
- new ClassReader(bytecode).accept(result, ClassReader.SKIP_DEBUG | ClassReader.EXPAND_FRAMES);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- } finally {
- IOUtils.closeQuietly(bytecode);
- }
- return result;
- }
-
- @Override
- public void visit(final int version, final int access, final String name, final String signature,
- final String superName, final String[] interfaces) {
- Validate.isTrue(!blueprintTypes.contains(Type.getObjectType(name)),
- "Class %s cannot declare itself as a blueprint!", name);
- super.visit(version, access, name, signature, superName, interfaces);
- }
-
- @Override
- public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature,
- final String[] exceptions) {
- final MethodVisitor toWrap = super.visitMethod(access, name, desc, signature, exceptions);
- return new MethodInvocationHandler(toWrap) {
- @Override
- boolean shouldImport(final Pair<Type, Method> methodKey) {
- return blueprintRegistry.containsKey(methodKey);
- }
- };
- }
-
- private String importMethod(final Pair<Type, Method> key) {
- if (importedMethods.containsKey(key)) {
- return importedMethods.get(key);
- }
- final String result =
- new StringBuilder(key.getLeft().getInternalName().replace('/', '_')).append("$$")
- .append(key.getRight().getName()).toString();
- importedMethods.put(key, result);
- privilizer().env.debug("importing %s#%s as %s", key.getLeft().getClassName(), key.getRight(), result);
- final int access = Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC + Opcodes.ACC_SYNTHETIC;
-
- final MethodNode source = getMethods(key.getLeft()).get(key.getRight());
-
- @SuppressWarnings("unchecked")
- final String[] exceptions = (String[]) source.exceptions.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
-
- // non-public fields accessed
- final Set<FieldAccess> fieldAccesses = new LinkedHashSet<FieldAccess>();
-
- source.accept(new MethodVisitor(Opcodes.ASM4) {
- @Override
- public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) {
- final FieldAccess fieldAccess = fieldAccess(Type.getObjectType(owner), name);
-
- super.visitFieldInsn(opcode, owner, name, desc);
- if (!Modifier.isPublic(fieldAccess.access)) {
- fieldAccesses.add(fieldAccess);
- }
- }
- });
-
- final MethodNode withAccessibleAdvice =
- new MethodNode(access, result, source.desc, source.signature, exceptions);
-
- // spider own methods:
- MethodVisitor mv = new NestedMethodInvocationHandler(withAccessibleAdvice, key.getLeft()); //NOPMD
-
- if (!fieldAccesses.isEmpty()) {
- // accessesNonPublicFields = true;
- mv = new AccessibleAdvisor(mv, access, result, source.desc, new ArrayList<FieldAccess>(fieldAccesses));
- }
-
- source.accept(mv);
-
- // private can only be called by other privileged methods, so no need to mark as privileged
- if (!Modifier.isPrivate(source.access)) {
- withAccessibleAdvice.visitAnnotation(Type.getType(Privileged.class).getDescriptor(), false).visitEnd();
- }
-
- withAccessibleAdvice.accept(this.cv);
-
- return result;
- }
-
- private FieldAccess fieldAccess(final Type owner, final String name) {
- final Pair<Type, String> key = Pair.of(owner, name);
- if (!fieldAccessMap.containsKey(key)) {
- try {
- final MutableObject<Type> next = new MutableObject<Type>(owner);
- final Deque<Type> stk = new ArrayDeque<Type>();
- while (next.getValue() != null) {
- stk.push(next.getValue());
- InputStream bytecode = null;
- try {
- bytecode = privilizer().env.getClassfile(next.getValue().getInternalName()).getInputStream();
- new ClassReader(bytecode).accept(privilizer().new PrivilizerClassVisitor() {
- @Override
- public void visit(final int version, final int access, final String name,
- final String signature, final String superName, final String[] interfaces) {
- super.visit(version, access, name, signature, superName, interfaces);
- next.setValue(Type.getObjectType(superName));
- }
-
- @Override
- public FieldVisitor visitField(final int access, final String name, final String desc,
- final String signature, final Object value) {
- for (final Type type : stk) {
- final Pair<Type, String> key = Pair.of(type, name);
- // skip shadowed fields:
- if (!fieldAccessMap.containsKey(key)) {
- fieldAccessMap.put(key,
- new FieldAccess(access, target, name, Type.getType(desc)));
- }
- }
- return null;
- }
- }, ClassReader.SKIP_CODE);
- } finally {
- IOUtils.closeQuietly(bytecode);
- }
- if (fieldAccessMap.containsKey(key)) {
- break;
- }
- }
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- Validate.isTrue(fieldAccessMap.containsKey(key), "Could not locate %s.%s", owner.getClassName(), name);
- }
- return fieldAccessMap.get(key);
- }
-
- @Override
- public void visitEnd() {
- super.visitEnd();
- ((ClassNode) cv).accept(next);
- }
-
- private abstract class MethodInvocationHandler extends MethodVisitor {
- MethodInvocationHandler(final MethodVisitor mvr) {
- super(Opcodes.ASM4, mvr);
- }
-
- @Override
- public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) {
- if (opcode == Opcodes.INVOKESTATIC) {
- final Method methd = new Method(name, desc);
- final Pair<Type, Method> methodKey = Pair.of(Type.getObjectType(owner), methd);
- if (shouldImport(methodKey)) {
- final String importedName = importMethod(methodKey);
- super.visitMethodInsn(opcode, className, importedName, desc);
- return;
- }
- }
- super.visitMethodInsn(opcode, owner, name, desc);
- }
-
- abstract boolean shouldImport(Pair<Type, Method> methodKey);
- }
-
- class NestedMethodInvocationHandler extends MethodInvocationHandler {
- final Type owner;
-
- NestedMethodInvocationHandler(final MethodVisitor mvr, final Type owner) {
- super(mvr);
- this.owner = owner;
- }
-
- @Override
- boolean shouldImport(final Pair<Type, Method> methodKey) {
- // call anything called within a class hierarchy:
- final Type called = methodKey.getLeft();
- // "I prefer the short cut":
- if (called.equals(owner)) {
- return true;
- }
- try {
- final Class<?> inner = load(called);
- final Class<?> outer = load(owner);
- return inner.isAssignableFrom(outer);
- } catch (final ClassNotFoundException e) {
- return false;
- }
- }
-
- private Class<?> load(final Type type) throws ClassNotFoundException {
- return privilizer().env.classLoader.loadClass(type.getClassName());
- }
- }
-
- /**
- * For every non-public referenced field of an imported method, replaces with reflective calls. Additionally, for
- * every such field that is not accessible, sets the field's accessibility and clears it as the method exits.
- */
- private class AccessibleAdvisor extends AdviceAdapter {
- final Type bitSetType = Type.getType(BitSet.class);
- final Type classType = Type.getType(Class.class);
- final Type fieldType = Type.getType(java.lang.reflect.Field.class);
- final Type fieldArrayType = Type.getType(java.lang.reflect.Field[].class);
- final Type stringType = Type.getType(String.class);
-
- final List<FieldAccess> fieldAccesses;
- final Label begin = new Label();
- int localFieldArray;
- int bitSet;
- int fieldCounter;
-
- AccessibleAdvisor(final MethodVisitor mvr, final int access, final String name, final String desc,
- final List<FieldAccess> fieldAccesses) {
- super(ASM4, mvr, access, name, desc);
- this.fieldAccesses = fieldAccesses;
- }
-
- @Override
- protected void onMethodEnter() {
- localFieldArray = newLocal(fieldArrayType);
- bitSet = newLocal(bitSetType);
- fieldCounter = newLocal(Type.INT_TYPE);
-
- // create localFieldArray
- push(fieldAccesses.size());
- newArray(fieldArrayType.getElementType());
- storeLocal(localFieldArray);
-
- // create bitSet
- newInstance(bitSetType);
- dup();
- push(fieldAccesses.size());
- invokeConstructor(bitSetType, Method.getMethod("void <init>(int)"));
- storeLocal(bitSet);
-
- // populate localFieldArray
- push(0);
- storeLocal(fieldCounter);
- for (final FieldAccess access : fieldAccesses) {
- prehandle(access);
- iinc(fieldCounter, 1);
- }
- mark(begin);
- }
-
- private void prehandle(final FieldAccess access) {
- // push owner.class literal
- visitLdcInsn(access.owner);
- push(access.name);
- final Label next = new Label();
- invokeVirtual(classType, new Method("getDeclaredField", fieldType, new Type[] { stringType }));
-
- dup();
- // store the field at localFieldArray[fieldCounter]:
- loadLocal(localFieldArray);
- swap();
- loadLocal(fieldCounter);
- swap();
- arrayStore(fieldArrayType.getElementType());
-
- dup();
- invokeVirtual(fieldArrayType.getElementType(), Method.getMethod("boolean isAccessible()"));
-
- final Label setAccessible = new Label();
- // if false, setAccessible:
- ifZCmp(EQ, setAccessible);
-
- // else pop field instance
- pop();
- // and record that he was already accessible:
- loadLocal(bitSet);
- loadLocal(fieldCounter);
- invokeVirtual(bitSetType, Method.getMethod("void set(int)"));
- goTo(next);
-
- mark(setAccessible);
- push(true);
- invokeVirtual(fieldArrayType.getElementType(), Method.getMethod("void setAccessible(boolean)"));
-
- mark(next);
- }
-
- @Override
- public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) {
- final Pair<Type, String> key = Pair.of(Type.getObjectType(owner), name);
- final FieldAccess fieldAccess = fieldAccessMap.get(key);
- Validate.isTrue(fieldAccesses.contains(fieldAccess), "Cannot find field %s", key);
- final int fieldIndex = fieldAccesses.indexOf(fieldAccess);
- visitInsn(NOP);
- loadLocal(localFieldArray);
- push(fieldIndex);
- arrayLoad(fieldArrayType.getElementType());
- checkCast(fieldType);
-
- final Method access;
- if (opcode == PUTSTATIC) {
- // value should have been at top of stack on entry; position the field under the value:
- swap();
- // add null object for static field deref and swap under value:
- push((String) null);
- swap();
- if (fieldAccess.type.getSort() < Type.ARRAY) {
- // box value:
- valueOf(fieldAccess.type);
- }
- access = Method.getMethod("void set(Object, Object)");
- } else {
- access = Method.getMethod("Object get(Object)");
- // add null object for static field deref:
- push((String) null);
- }
-
- invokeVirtual(fieldType, access);
-
- if (opcode == GETSTATIC) {
- checkCast(privilizer().wrap(fieldAccess.type));
- if (fieldAccess.type.getSort() < Type.ARRAY) {
- unbox(fieldAccess.type);
- }
- }
- }
-
- @Override
- public void visitMaxs(final int maxStack, final int maxLocals) {
- // put try-finally around the whole method
- final Label fny = mark();
- // null exception type signifies finally block:
- final Type exceptionType = null;
- catchException(begin, fny, exceptionType);
- onFinally();
- throwException();
- super.visitMaxs(maxStack, maxLocals);
- }
-
- @Override
- protected void onMethodExit(final int opcode) {
- if (opcode != ATHROW) {
- onFinally();
- }
- }
-
- private void onFinally() {
- // loop over fields and return any non-null element to being inaccessible:
- push(0);
- storeLocal(fieldCounter);
-
- final Label test = mark();
- final Label increment = new Label();
- final Label endFinally = new Label();
-
- loadLocal(fieldCounter);
- push(fieldAccesses.size());
- ifCmp(Type.INT_TYPE, GeneratorAdapter.GE, endFinally);
-
- loadLocal(bitSet);
- loadLocal(fieldCounter);
- invokeVirtual(bitSetType, Method.getMethod("boolean get(int)"));
-
- // if true, increment:
- ifZCmp(NE, increment);
-
- loadLocal(localFieldArray);
- loadLocal(fieldCounter);
- arrayLoad(fieldArrayType.getElementType());
- push(false);
- invokeVirtual(fieldArrayType.getElementType(), Method.getMethod("void setAccessible(boolean)"));
-
- mark(increment);
- iinc(fieldCounter, 1);
- goTo(test);
- mark(endFinally);
- }
- }
-}
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Field.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Field.java
deleted file mode 100644
index afa5915..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Field.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.commons.weaver.privilizer;
-
-import org.apache.commons.lang3.ObjectUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.Validate;
-import org.objectweb.asm.Type;
-
-/**
- * Represents a Java field.
- */
-public class Field {
- /**
- * Access modifier.
- */
- public final int access;
-
- /**
- * Field name.
- */
- public final String name;
-
- /**
- * Field type.
- */
- public final Type type;
-
- /**
- * Create a new {@link Field}.
- * @param access modifier
- * @param name of field
- * @param type of field
- */
- public Field(final int access, final String name, final Type type) {
- super();
- this.access = access;
- this.name = Validate.notNull(name);
- this.type = Validate.notNull(type);
- }
-
- /**
- * Considers name and type.
- * @param obj to check for equality
- * @return whether equal
- */
- @SuppressWarnings("deprecation")
- @Override
- public boolean equals(final Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof Field)) {
- return false;
- }
- final Field other = (Field) obj;
- return StringUtils.equals(other.name, name) && ObjectUtils.equals(other.type, type);
- }
-
- /**
- * Considers name and type.
- * @return hashCode
- */
- @Override
- public int hashCode() {
- int result = 57 << 2;
- result |= name.hashCode();
- result <<= 4;
- result |= type.hashCode();
- return result;
- }
-}
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/FieldAccess.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/FieldAccess.java
deleted file mode 100644
index ba5554c..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/FieldAccess.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.commons.weaver.privilizer;
-
-import org.objectweb.asm.Type;
-
-/**
- * Models the action of accessing a field by extending {@link Field} with an
- * accessing type.
- */
-public class FieldAccess extends Field {
- /**
- * {@link Type} from which field is accessed.
- */
- public final Type owner;
-
- /**
- * Create a new {@link FieldAccess}.
- * @param access operation
- * @param owner {@link Type} from which field is accessed.
- * @param name of field
- * @param type of field
- */
- public FieldAccess(final int access, final Type owner, final String name, final Type type) {
- super(access, name, type);
- this.owner = owner;
- }
-
- /**
- * Compare against {@code obj} for equality.
- * @param obj to compare
- * @return whether Objects are equal
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof FieldAccess)) {
- return false;
- }
- return super.equals(obj) && ((FieldAccess) obj).owner.equals(owner);
- }
-
- /**
- * Generate a hashCode.
- * @return int
- */
- @Override
- public int hashCode() {
- final int result = super.hashCode() << 4;
- return result | owner.hashCode();
- }
-
-}
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/InlineNestedPrivilegedCalls.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/InlineNestedPrivilegedCalls.java
deleted file mode 100644
index f462e22..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/InlineNestedPrivilegedCalls.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.commons.weaver.privilizer;
-
-import java.util.Map;
-
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.commons.Method;
-import org.objectweb.asm.tree.ClassNode;
-
-/**
- * For any privileged method called from another privileged method (actually the internal implementation method copied
- * from the original method body) the call is replaced by a call to the target's internal implementation method, thus
- * avoiding nested privileged invocations when possible. Persists everything to a tree model until the parent is
- * complete; allowing us to use a tree model while yet building the high-level view as a stack of visitors.
- */
-class InlineNestedPrivilegedCalls extends ClassNode {
- private final Privilizer privilizer;
-
- private final ClassVisitor next;
-
- /**
- * Map of original method to name of internal implementation method.
- */
- private final Map<Method, String> privilegedMethods;
-
- /**
- * Create a new {@link InlineNestedPrivilegedCalls} object.
- * @param privilizer owner
- * @param privilegedMethods map of original method to name of internal implementation method
- * @param next visitor
- */
- InlineNestedPrivilegedCalls(final Privilizer privilizer, final Map<Method, String> privilegedMethods,
- final ClassVisitor next) {
- super(Opcodes.ASM4);
- this.privilizer = privilizer;
- this.privilegedMethods = privilegedMethods;
- this.next = next;
- }
-
- @Override
- public void visitEnd() {
- super.visitEnd();
-
- accept(new ClassVisitor(Opcodes.ASM4, next) {
- @Override
- public MethodVisitor visitMethod(final int access, final String name, final String desc,
- final String signature, final String[] exceptions) {
- final Method outer = new Method(name, desc);
- final MethodVisitor orig = super.visitMethod(access, name, desc, signature, exceptions);
- if (!privilegedMethods.containsValue(name)) {
- return orig;
- }
- return new MethodVisitor(Opcodes.ASM4, orig) {
- @Override
- public void visitMethodInsn(final int opcode, final String owner, final String name,
- final String desc) {
- String useName = name;
- if (owner.equals(InlineNestedPrivilegedCalls.this.name)) {
- final Method methd = new Method(name, desc);
- if (privilegedMethods.containsKey(methd)) {
- useName = privilegedMethods.get(methd);
- privilizer.env.debug("Inlining call from %s to %s as %s", outer, methd,
- useName);
- }
- }
- super.visitMethodInsn(opcode, owner, useName, desc);
- }
- };
- }
- });
- }
-}
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Policy.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Policy.java
deleted file mode 100644
index cef9344..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Policy.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.privilizer;
-
-import java.security.PrivilegedAction;
-import java.util.Locale;
-
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * Weaving policy: when to use {@link PrivilegedAction}s.
- */
-public enum Policy {
- /**
- * Disables weaving.
- */
- NEVER,
-
- /**
- * Weaves such that the check for an active {@link SecurityManager} is done once only.
- */
- ON_INIT,
-
- /**
- * Weaves such that the check for an active {@link SecurityManager} is done for each {@link Privileged} method
- * execution.
- */
- DYNAMIC,
-
- /**
- * Weaves such that {@link Privileged} methods are always executed as such.
- */
- ALWAYS;
-
- /**
- * Get the {@link Policy} value that should be used as a default.
- * @return {@link Policy#DYNAMIC}
- */
- public static Policy defaultValue() {
- return DYNAMIC;
- }
-
- /**
- * Parse from a {@link String} returning {@link #defaultValue()} for blank/null input.
- * @param str to parse
- * @return {@link Policy}
- */
- public static Policy parse(final String str) {
- if (StringUtils.isBlank(str)) {
- return defaultValue();
- }
- return valueOf(str.trim().toUpperCase(Locale.US));
- }
-
- /**
- * Learn whether this is a conditional {@link Policy}.
- * @return {@code this == ON_INIT || this == DYNAMIC}
- */
- public boolean isConditional() {
- return this == ON_INIT || this == DYNAMIC;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilized.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilized.java
deleted file mode 100644
index 6e1e5cb..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilized.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.privilizer;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Class-retention annotation to mark privilized classes.
- */
-@Target(ElementType.TYPE)
-public @interface Privilized {
- /**
- * Name of {@link Policy} with which privilized weaving was performed.
- */
- String value();
-}
\ No newline at end of file
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java
deleted file mode 100644
index 8d732b7..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.privilizer;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.activation.DataSource;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.Type;
-import org.objectweb.asm.util.CheckClassAdapter;
-import org.objectweb.asm.util.TraceClassVisitor;
-
-/**
- * Coordinates privilization activities.
- */
-public class Privilizer {
- /**
- * An ASM {@link ClassVisitor} for privilization.
- */
- abstract class PrivilizerClassVisitor extends ClassVisitor {
- String className;
- Type target;
-
- protected PrivilizerClassVisitor() {
- this(null);
- }
-
- protected PrivilizerClassVisitor(final ClassVisitor cv) { //NOPMD
- super(Opcodes.ASM4, cv);
- }
-
- protected Privilizer privilizer() {
- return Privilizer.this;
- }
-
- @Override
- public void visit(final int version, final int access, final String name, final String signature,
- final String superName, final String[] interfaces) {
- super.visit(version, access, name, signature, superName, interfaces);
- className = name;
- target = Type.getObjectType(name);
- }
- }
-
- /**
- * Convenient {@link ClassVisitor} layer to write classfiles into the {@link WeaveEnvironment}.
- */
- class WriteClass extends PrivilizerClassVisitor {
- WriteClass(final ClassWriter classWriter) {
- super(classWriter);
- }
-
- @Override
- public void visitEnd() {
- super.visitEnd();
- final byte[] bytecode = ((ClassWriter) cv).toByteArray();
-
- if (verify) {
- verify(className, bytecode);
- }
-
- final DataSource classfile = env.getClassfile(className);
- env.debug("Writing class %s to resource %s", className, classfile.getName());
- OutputStream outputStream = null;
- try {
- outputStream = classfile.getOutputStream();
- IOUtils.write(bytecode, outputStream);
- } catch (final IOException e) {
- throw new RuntimeException(e);
- } finally {
- IOUtils.closeQuietly(outputStream);
- }
- }
- }
-
- /**
- * Privilizer weaver configuration prefix.
- */
- public static final String CONFIG_WEAVER = "privilizer.";
-
- /**
- * {@link AccessLevel} configuration key.
- * @see AccessLevel#parse(String)
- */
- public static final String CONFIG_ACCESS_LEVEL = CONFIG_WEAVER + "accessLevel";
-
- /**
- * Weave {@link Policy} configuration key.
- * @see Policy#parse(String)
- */
- public static final String CONFIG_POLICY = CONFIG_WEAVER + "policy";
-
- /**
- * Verification configuration key.
- * @see BooleanUtils#toBoolean(String)
- */
- public static final String CONFIG_VERIFY = CONFIG_WEAVER + "verify";
-
- private static final String GENERATE_NAME = "__privileged_%s";
-
- static final Type[] EMPTY_TYPE_ARRAY = new Type[0];
-
- final WeaveEnvironment env;
- final AccessLevel accessLevel;
- final Policy policy;
- final boolean verify;
-
- /**
- * Create a new {@link Privilizer}.
- * @param env to use
- */
- public Privilizer(final WeaveEnvironment env) {
- super();
- this.env = env;
- this.policy = Policy.parse(env.config.getProperty(CONFIG_POLICY));
- this.accessLevel = AccessLevel.parse(env.config.getProperty(CONFIG_ACCESS_LEVEL));
- verify = BooleanUtils.toBoolean(env.config.getProperty(CONFIG_VERIFY));
- }
-
- String generateName(final String simple) {
- return String.format(GENERATE_NAME, simple);
- }
-
- Type wrap(final Type type) {
- switch (type.getSort()) {
- case Type.BOOLEAN:
- return Type.getType(Boolean.class);
- case Type.BYTE:
- return Type.getType(Byte.class);
- case Type.SHORT:
- return Type.getType(Short.class);
- case Type.INT:
- return Type.getType(Integer.class);
- case Type.CHAR:
- return Type.getType(Character.class);
- case Type.LONG:
- return Type.getType(Long.class);
- case Type.FLOAT:
- return Type.getType(Float.class);
- case Type.DOUBLE:
- return Type.getType(Double.class);
- case Type.VOID:
- return Type.getType(Void.class);
- default:
- return type;
- }
- }
-
- void blueprint(final Class<?> type, final Privilizing privilizing) {
- final Object[] args = { type.getName(), privilizing };
- env.debug("blueprinting class %s %s", args);
- InputStream bytecode = null;
- try {
- bytecode = env.getClassfile(type).getInputStream();
- final ClassReader classReader = new ClassReader(bytecode);
-
- ClassVisitor cvr;
- cvr = new WriteClass(new ClassWriter(classReader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS));
- cvr = new PrivilizingVisitor(this, cvr);
- cvr = new BlueprintingVisitor(this, cvr, privilizing);
-
- classReader.accept(cvr, ClassReader.EXPAND_FRAMES);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- } finally {
- IOUtils.closeQuietly(bytecode);
- }
- }
-
- void privilize(final Class<?> type) {
- final Object[] args = { type.getName() };
- env.debug("privilizing class %s", args);
- InputStream bytecode = null;
- try {
- bytecode = env.getClassfile(type).getInputStream();
- final ClassReader classReader = new ClassReader(bytecode);
- ClassVisitor cv; //NOPMD
- cv = new WriteClass(new ClassWriter(classReader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS));
- cv = new PrivilizingVisitor(this, cv);
-
- classReader.accept(cv, ClassReader.EXPAND_FRAMES);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- } finally {
- IOUtils.closeQuietly(bytecode);
- }
- }
-
- void verify(final String className, final byte[] bytecode) {
- final ClassReader reader = new ClassReader(bytecode);
-
- env.debug("Verifying bytecode for class %s", className);
- final StringWriter w = new StringWriter(); //NOPMD
- CheckClassAdapter.verify(reader, env.classLoader, false, new PrintWriter(w));
- final String error = w.toString();
- if (!error.isEmpty()) {
- env.error(error);
- final StringWriter trace = new StringWriter();
- reader.accept(new TraceClassVisitor(new PrintWriter(trace)), ClassReader.SKIP_DEBUG);
- env.debug(trace.toString());
- throw new IllegalStateException();
- }
- Validate.validState(StringUtils.isBlank(error), error);
-
- final ClassVisitor checkInnerClasses = new ClassVisitor(Opcodes.ASM4, null) {
- final Set<String> innerNames = new HashSet<String>();
-
- @Override
- public void visitInnerClass(final String name, final String outerName, final String innerName,
- final int access) {
- super.visitInnerClass(name, outerName, innerName, access);
- Validate.validState(innerNames.add(innerName), "%s already defined", innerName);
- }
- };
- reader.accept(checkInnerClasses, ClassReader.SKIP_CODE);
- }
-}
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerCleaner.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerCleaner.java
deleted file mode 100644
index e9578f1..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerCleaner.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.privilizer;
-
-import java.io.InputStream;
-import java.lang.annotation.ElementType;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.weaver.model.ScanRequest;
-import org.apache.commons.weaver.model.Scanner;
-import org.apache.commons.weaver.model.WeavableClass;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-import org.apache.commons.weaver.model.WeaveInterest;
-import org.apache.commons.weaver.spi.Cleaner;
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.Opcodes;
-
-/**
- * Removes classes privilized with a different policy.
- */
-public class PrivilizerCleaner implements Cleaner {
-
- @Override
- public boolean clean(final WeaveEnvironment environment, final Scanner scanner) {
- final Privilizer privilizer = new Privilizer(environment);
-
- final List<String> toDelete = new ArrayList<String>();
-
- final ScanRequest scanRequest = new ScanRequest().add(WeaveInterest.of(Privilized.class, ElementType.TYPE));
-
- environment.debug("Cleaning classes privilized with policy other than %s", privilizer.policy);
- for (final WeavableClass<?> weavableClass : scanner.scan(scanRequest).getClasses().with(Privilized.class)) {
- final Policy privilizedPolicy = Policy.valueOf(weavableClass.getAnnotation(Privilized.class).value());
- if (privilizedPolicy == privilizer.policy) {
- continue;
- }
- final String className = weavableClass.getTarget().getName();
- environment.debug("Class %s privilized with %s; deleting.", className, privilizedPolicy);
-
- InputStream bytecode = null;
- try {
- bytecode = privilizer.env.getClassfile(className).getInputStream();
- final ClassReader classReader = new ClassReader(bytecode);
- classReader.accept(new ClassVisitor(Opcodes.ASM4) {
- @Override
- public void visit(final int version, final int access, final String name, final String signature,
- final String superName, final String[] interfaces) {
- toDelete.add(name);
- }
-
- @Override
- public void visitInnerClass(final String name, final String outerName, final String innerName,
- final int access) {
- if (toDelete.contains(outerName)) {
- toDelete.add(name);
- }
- }
- }, ClassReader.SKIP_CODE + ClassReader.SKIP_DEBUG + ClassReader.SKIP_FRAMES);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- } finally {
- IOUtils.closeQuietly(bytecode);
- }
- }
- boolean result = false;
- for (final String className : toDelete) {
- final String resourcePath = toResourcePath(className);
- final boolean success = environment.deleteResource(resourcePath);
- environment.debug("Deletion of resource %s was %ssuccessful.", resourcePath, success ? "" : "un");
- result |= success;
- }
- return result;
- }
-
- private static String toResourcePath(final String className) {
- return className.replace('.', '/') + ".class";
- }
-
-}
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java
deleted file mode 100644
index e7e7149..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.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.commons.weaver.privilizer;
-
-import java.lang.annotation.ElementType;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.weaver.model.ScanRequest;
-import org.apache.commons.weaver.model.Scanner;
-import org.apache.commons.weaver.model.WeavableClass;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-import org.apache.commons.weaver.model.WeaveInterest;
-import org.apache.commons.weaver.spi.Weaver;
-
-/**
- * Privilizer {@link Weaver} implementation.
- */
-public class PrivilizerWeaver implements Weaver {
- @Override
- public boolean process(final WeaveEnvironment weaveEnvironment, final Scanner scanner) {
- final Privilizer privilizer = new Privilizer(weaveEnvironment);
-
- final Set<Class<?>> privilizedTypes = new LinkedHashSet<Class<?>>();
-
- // handle blueprints:
- for (final WeavableClass<?> type : scanner.scan(
- new ScanRequest().add(WeaveInterest.of(Privilizing.class, ElementType.TYPE))).getClasses()) {
-
- final Class<?> target = type.getTarget();
- if (privilizedTypes.add(target) && validateRequest(privilizer, type)) {
- privilizer.blueprint(target, type.getAnnotation(Privilizing.class));
- }
- }
-
- // handle remaining classes declaring @Privileged methods:
-
- for (final WeavableClass<?> type : scanner.scan(
- new ScanRequest().add(WeaveInterest.of(Privileged.class, ElementType.METHOD))).getClasses()) {
- final Class<?> target = type.getTarget();
- if (privilizedTypes.add(target) && validateRequest(privilizer, type)) {
- privilizer.privilize(target);
- }
- }
- return !privilizedTypes.isEmpty();
- }
-
- /**
- * Validate a weaving request for a given target type.
- * @param privilizer whose configuration to consult
- * @param type target
- * @return whether weaving should proceed
- * @throws IllegalStateException if class has already been woven with some other policy
- */
- private boolean validateRequest(final Privilizer privilizer, final WeavableClass<?> type) {
- final Privilized marker = type.getAnnotation(Privilized.class);
- if (marker == null) {
- return privilizer.policy != Policy.NEVER;
- }
- Validate.validState(privilizer.policy.name().equals(marker.value()), "%s already privilized with policy %s",
- type.getTarget().getName(), marker.value());
-
- return false;
- }
-}
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizingVisitor.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizingVisitor.java
deleted file mode 100644
index 59887ed..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizingVisitor.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.privilizer;
-
-import java.lang.reflect.Modifier;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.commons.lang3.ArrayUtils;
-import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.FieldVisitor;
-import org.objectweb.asm.Label;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.Type;
-import org.objectweb.asm.commons.GeneratorAdapter;
-import org.objectweb.asm.commons.Method;
-import org.objectweb.asm.commons.StaticInitMerger;
-
-/**
- * ASM {@link ClassVisitor} to privilize {@link Privileged} methods.
- */
-class PrivilizingVisitor extends Privilizer.PrivilizerClassVisitor {
- final Map<Method, String> privilegedMethods = new LinkedHashMap<Method, String>();
- boolean annotated;
- final Policy policy;
- final AccessLevel accessLevel;
-
- /**
- * Create a new {@link PrivilizingVisitor}.
- * @param privilizer owner
- * @param cv next
- */
- PrivilizingVisitor(final Privilizer privilizer, final ClassVisitor cv) { //NOPMD
- privilizer.super();
- this.policy = privilizer.policy;
- this.accessLevel = privilizer.accessLevel;
- this.cv =
- new InlineNestedPrivilegedCalls(privilizer, privilegedMethods, new StaticInitMerger(
- privilizer.generateName("clinit"), cv));
- }
-
- private void annotate() {
- if (!annotated) {
- annotated = true;
- final AnnotationVisitor privilizedVisitor =
- super.visitAnnotation(Type.getType(Privilized.class).getDescriptor(), false);
- privilizedVisitor.visit("value", policy.name());
- privilizedVisitor.visitEnd();
- }
- }
-
- @Override
- public void visitInnerClass(final String name, final String outerName, final String innerName, final int access) {
- annotate();
- super.visitInnerClass(name, outerName, innerName, access);
- }
-
- @Override
- public FieldVisitor visitField(final int access, final String name, final String desc, final String signature,
- final Object value) {
- annotate();
- return super.visitField(access, name, desc, signature, value);
- }
-
- @Override
- public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature,
- final String[] exceptions) {
- annotate();
- final MethodVisitor originalMethod = super.visitMethod(access, name, desc, signature, exceptions);
- final Method methd = new Method(name, desc);
-
- return new GeneratorAdapter(Opcodes.ASM4, originalMethod, access, name, desc) {
-
- @Override
- public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
- if (Type.getType(Privileged.class).getDescriptor().equals(desc)) {
- final AccessLevel localAccessLevel = AccessLevel.of(access);
- if (accessLevel.compareTo(localAccessLevel) > 0) {
- throw new RuntimeException(new IllegalAccessException("Method " + className + "#" + methd
- + " must have maximum access level '" + accessLevel + "' but is defined wider ('"
- + localAccessLevel + "')"));
- }
- if (AccessLevel.PACKAGE.compareTo(accessLevel) > 0) {
- privilizer().env.warn("Possible security leak: granting privileges to %s method %s.%s",
- localAccessLevel, className, methd);
- }
- privilegedMethods.put(methd, privilizer().generateName(name));
- }
- return super.visitAnnotation(desc, visible);
- }
-
- @Override
- public void visitCode() {
- super.visitCode();
- if (!privilegedMethods.containsKey(methd)) {
- return;
- }
- final String impl = privilegedMethods.get(methd);
- final boolean instanceMethod = !Modifier.isStatic(access);
-
- if (policy.isConditional()) {
- privilizer().env.debug("setting up conditional execution due to policy %s", policy);
- // test, loading boolean
- if (policy == Policy.ON_INIT) {
- getStatic(target, privilizer().generateName("hasSecurityManager"), Type.BOOLEAN_TYPE);
- } else if (policy == Policy.DYNAMIC) {
- checkSecurityManager(this);
- }
- final Label doPrivileged = new Label();
-
- // if true, goto doPrivileged:
- ifZCmp(NE, doPrivileged);
-
- final Method implMethod = new Method(impl, desc);
- if (instanceMethod) {
- loadThis();
- loadArgs();
- invokeVirtual(target, implMethod);
- } else {
- loadArgs();
- invokeStatic(target, implMethod);
- }
- returnValue();
- mark(doPrivileged);
- } else {
- privilizer().env.debug("setting up unconditional privileged execution due to policy %s", policy);
- }
-
- // generate action:
- final Type[] ctorArgs;
- if (instanceMethod) {
- ctorArgs = ArrayUtils.add(methd.getArgumentTypes(), 0, target);
- } else {
- ctorArgs = methd.getArgumentTypes();
- }
- final Type actionType = new ActionGenerator(access, methd, exceptions, PrivilizingVisitor.this).build();
- newInstance(actionType);
- dup();
- if (instanceMethod) {
- loadThis();
- }
- loadArgs();
- invokeConstructor(actionType, new Method("<init>", Type.VOID_TYPE, ctorArgs));
-
- final boolean exc = ArrayUtils.isNotEmpty(exceptions);
- // mark try if needed
- final Label privTry = exc ? mark() : null;
-
- // execute action
- final Type arg =
- exc ? Type.getType(PrivilegedExceptionAction.class) : Type.getType(PrivilegedAction.class);
- final Method doPrivileged = new Method("doPrivileged", Type.getType(Object.class), new Type[] { arg });
- invokeStatic(Type.getType(AccessController.class), doPrivileged);
-
- unbox(methd.getReturnType());
- returnValue();
-
- if (exc) {
- final Type caught = Type.getType(PrivilegedActionException.class);
- // end try
- final Label privCatch = mark();
- // catch
- catchException(privTry, privCatch, caught);
- // unwrap
- invokeVirtual(caught, new Method("getException", Type.getType(Exception.class),
- Privilizer.EMPTY_TYPE_ARRAY));
- // throw
- throwException();
- }
-
- // end original method
- endMethod();
-
- // substitute an impl visitor and continue
- mv = cv.visitMethod(AccessLevel.PRIVATE.merge(access), impl, desc, signature, exceptions);
- mv.visitCode();
- }
- };
-
- }
-
- @Override
- public void visitEnd() {
- annotate();
- if (privilizer().policy == Policy.ON_INIT) {
- final String fieldName = privilizer().generateName("hasSecurityManager");
-
- visitField(Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL, fieldName,
- Type.BOOLEAN_TYPE.getDescriptor(), null, null).visitEnd();
-
- final GeneratorAdapter mgen =
- new GeneratorAdapter(Opcodes.ACC_STATIC, new Method("<clinit>", "()V"), null,
- Privilizer.EMPTY_TYPE_ARRAY, this);
- checkSecurityManager(mgen);
- mgen.putStatic(target, fieldName, Type.BOOLEAN_TYPE);
- mgen.returnValue();
- mgen.endMethod();
- }
- super.visitEnd();
- }
-
- /**
- * Generates the instructions to push onto the stack whether there is a
- * security manager available.
- * @param mgen to control
- */
- private static void checkSecurityManager(final GeneratorAdapter mgen) {
- final Label setFalse = new Label();
- final Label done = new Label();
- mgen.invokeStatic(Type.getType(System.class),
- new Method("getSecurityManager", Type.getType(SecurityManager.class), Privilizer.EMPTY_TYPE_ARRAY));
- mgen.ifNull(setFalse);
- mgen.push(true);
- mgen.goTo(done);
- mgen.mark(setFalse);
- mgen.push(false);
- mgen.mark(done);
- }
-}
diff --git a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/package-info.java b/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/package-info.java
deleted file mode 100644
index 3b74d58..0000000
--- a/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Defines the Privilizer Weaver.
- */
-package org.apache.commons.weaver.privilizer;
\ No newline at end of file
diff --git a/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Cleaner b/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Cleaner
deleted file mode 100644
index 0d22498..0000000
--- a/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Cleaner
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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 class gets picked up by the CleanProcessor
-org.apache.commons.weaver.privilizer.PrivilizerCleaner
diff --git a/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver b/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver
deleted file mode 100644
index 1324768..0000000
--- a/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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 class gets picked up by the WeaveProcessor
-org.apache.commons.weaver.privilizer.PrivilizerWeaver
diff --git a/trunk/modules/src/site/markdown/index.md b/trunk/modules/src/site/markdown/index.md
deleted file mode 100644
index ee51390..0000000
--- a/trunk/modules/src/site/markdown/index.md
+++ /dev/null
@@ -1,23 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-## Apache Commons Weaver Modules
-
-This is the parent Apache Maven module for the weaver modules provided
-with Apache Commons Weaver. See [Modules](modules.html).
diff --git a/trunk/pom.xml b/trunk/pom.xml
deleted file mode 100644
index 3d320d8..0000000
--- a/trunk/pom.xml
+++ /dev/null
@@ -1,641 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-parent</artifactId>
- <version>33</version>
- </parent>
-
- <artifactId>commons-weaver-parent</artifactId>
- <version>1.0</version>
- <packaging>pom</packaging>
-
- <name>Apache Commons Weaver</name>
-
- <description>
- Apache Commons Weaver provides an easy way to enhance compiled classes with
- new functionality by generating ("weaving") bytecode into those classes.
- </description>
-
- <url>http://commons.apache.org/proper/commons-weaver</url>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
-
- <commons.componentid>weaver</commons.componentid>
- <commons.release.version>1.0</commons.release.version>
- <commons.rc.version>RC2</commons.rc.version>
- <commons.jira.id>WEAVER</commons.jira.id>
- <commons.jira.pid>12315320</commons.jira.pid>
- <commons.site.path>commons-weaver</commons.site.path>
- <asm.version>4.2</asm.version>
- <commons.scmPubUrl>https://svn.apache.org/repos/infra/websites/production/commons/content/proper/${commons.site.path}</commons.scmPubUrl>
- <commons.project-info.version>2.6</commons.project-info.version>
-
- <ant.version>1.9.3</ant.version>
- <checkstyle.version>2.11</checkstyle.version>
- </properties>
-
- <developers>
- <developer>
- <id>mbenson</id>
- <name>Matt Benson</name>
- <email>mbenson AT apache DOT org</email>
- <organization>Apache</organization>
- </developer>
- <developer>
- <id>struberg</id>
- <name>Mark Struberg</name>
- <email>struberg AT apache DOT org</email>
- <organization>Apache</organization>
- </developer>
- </developers>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2</url>
- </scm>
-
- <distributionManagement>
- <site>
- <id>commons.site</id>
- <name>Apache Commons Site SVN</name>
- <url>scm:svn:${commons.scmPubUrl}</url>
- </site>
- </distributionManagement>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-processor</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-processor</artifactId>
- <classifier>sources</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-processor</artifactId>
- <classifier>javadoc</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-api</artifactId>
- <classifier>sources</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-api</artifactId>
- <classifier>javadoc</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer</artifactId>
- <classifier>sources</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer</artifactId>
- <classifier>javadoc</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-normalizer</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-normalizer</artifactId>
- <classifier>sources</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-normalizer</artifactId>
- <classifier>javadoc</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-maven-plugin</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-maven-plugin</artifactId>
- <classifier>sources</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-maven-plugin</artifactId>
- <classifier>javadoc</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-antlib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-antlib</artifactId>
- <classifier>sources</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-antlib</artifactId>
- <classifier>javadoc</classifier>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-finder-shaded</artifactId>
- <version>3.14</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.2</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.4</version>
- </dependency>
- <dependency>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.17.1-GA</version>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm</artifactId>
- <version>${asm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-commons</artifactId>
- <version>${asm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-tree</artifactId>
- <version>${asm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-util</artifactId>
- <version>${asm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-analysis</artifactId>
- <version>${asm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-debug-all</artifactId>
- <version>${asm.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.8</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-pmd-plugin</artifactId>
- <version>3.0.1</version>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.8</version>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <version>2.5.3</version>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-notices</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target xmlns:if="ant:if" xmlns:unless="ant:unless">
- <presetdef name="truth">
- <condition value="true" else="false" />
- </presetdef>
-
- <macrodef name="seek">
- <attribute name="name" />
- <attribute name="addto" />
- <sequential>
- <union id="@{name}-ws" />
- <step dir="${user.dir}" name="@{name}" addto="@{addto}" ws="@{name}-ws" />
- </sequential>
- </macrodef>
-
- <macrodef name="step">
- <attribute name="name" />
- <attribute name="dir" />
- <attribute name="addto" />
- <attribute name="ws" />
- <sequential>
- <local name="seenDir" />
- <truth property="seenDir">
- <resourcecount when="gt" count="0">
- <intersect id="intersection">
- <resources refid="@{ws}" />
- <file name="@{dir}" />
- </intersect>
- </resourcecount>
- </truth>
- <sequential unless:true="${seenDir}">
- <augment id="@{ws}">
- <file file="@{dir}" />
- </augment>
- <local name="exists" />
- <truth property="exists">
- <available file="@{dir}/@{name}" />
- </truth>
-
- <sequential if:true="${exists}">
- <augment id="@{addto}">
- <file file="@{dir}/@{name}" />
- </augment>
- </sequential>
- <sequential unless:true="${exists}">
- <local name="parent.dir" />
- <dirname property="parent.dir" file="@{dir}" />
- <step dir="${parent.dir}" name="@{name}" addto="@{addto}" ws="@{ws}" />
- </sequential>
- </sequential>
- </sequential>
- </macrodef>
-
- <truth property="pom-only">
- <equals arg1="${project.packaging}" arg2="pom" />
- </truth>
- <sequential unless:true="${pom-only}">
- <union id="notices" />
- <seek name="LICENSE.txt" addto="notices" />
- <seek name="NOTICE.txt" addto="notices" />
-
- <mkdir dir="${project.build.directory}/generated-resources/notices/META-INF" />
- <copy verbose="true" todir="${project.build.directory}/generated-resources/notices/META-INF">
- <resources refid="notices" />
- </copy>
-
- <mkdir dir="${project.build.directory}/generated-test-resources/notices/META-INF" />
- <copy verbose="true" todir="${project.build.directory}/generated-test-resources/notices/META-INF">
- <resources refid="notices" />
- </copy>
-
- <mkdir dir="${project.build.directory}/apidocs/META-INF" />
- <copy verbose="true" todir="${project.build.directory}/apidocs/META-INF">
- <resources refid="notices" />
- </copy>
- </sequential>
- </target>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${ant.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>commons-weaver-build-tools</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <configuration>
- <configLocation>org/apache/commons/weaver/checkstyle.xml</configLocation>
- <headerLocation>org/apache/commons/weaver/license-header.txt</headerLocation>
- </configuration>
- </plugin>
- <!-- Unfortunately the much simpler
- <prerequisites><maven>3.0</maven></prerequisites>
- is not inherited so we have to use the enforcer plugin
- -->
- <plugin>
- <inherited>true</inherited>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <version>1.3.1</version>
- <executions>
- <execution>
- <id>enforce-maven-3</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <requireMavenVersion>
- <version>3.0.0</version>
- </requireMavenVersion>
- </rules>
- <fail>true</fail>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-test-jar</id>
- <phase>package</phase>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <skipIfEmpty>true</skipIfEmpty>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <executions>
- <execution>
- <id>create-javadoc-jar</id>
- <goals>
- <goal>javadoc</goal>
- <goal>jar</goal>
- </goals>
- <phase>package</phase>
- </execution>
- </executions>
- <configuration>
- <source>${maven.compiler.source}</source>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-pmd-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>commons-weaver-build-tools</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <configuration>
- <rulesets>
- <ruleset>/org/apache/commons/weaver/pmd.xml</ruleset>
- </rulesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <autoVersionSubmodules>true</autoVersionSubmodules>
- <tag>${commons.release.version}_${commons.rc.version}</tag>
- <preparationGoals>changes:changes-check</preparationGoals>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-scm-publish-plugin</artifactId>
- <configuration>
- <content>${project.build.directory}/staging</content>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>3.3</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-markdown</artifactId>
- <version>1.3</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- <execution>
- <id>attach-test-sources</id>
- <goals>
- <goal>test-jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-source-notices</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>add-resource</goal>
- </goals>
- <configuration>
- <resources>
- <resource>
- <directory>${project.build.directory}/generated-resources/notices</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- <execution>
- <id>add-test-notices</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>add-test-resource</goal>
- </goals>
- <configuration>
- <resources>
- <resource>
- <directory>${project.build.directory}/generated-test-resources/notices</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>commons-weaver-build-tools</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <configuration>
- <excludeFilterFile>/org/apache/commons/weaver/findbugs-exclude-filter.xml</excludeFilterFile>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <configuration>
- <aggregate>true</aggregate>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-
- <profiles>
- <profile>
- <id>release</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <inherited>false</inherited>
- <executions>
- <execution>
- <goals>
- <goal>single</goal>
- </goals>
- <!-- disable assembly:single from commons-parent
- release profile; multimodule assembly handled
- by dist module -->
- <phase />
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>create-source-jar</id>
- <!-- suppress execution specified by parent profile -->
- <phase />
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>site</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <aggregate>true</aggregate>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <modules>
- <module>build-tools</module>
- <module>processor</module>
- <module>modules</module>
- <module>maven-plugin</module>
- <module>example</module>
- <module>ant</module>
- <module>dist</module>
- </modules>
-</project>
diff --git a/trunk/processor/pom.xml b/trunk/processor/pom.xml
deleted file mode 100644
index 7fb69cd..0000000
--- a/trunk/processor/pom.xml
+++ /dev/null
@@ -1,87 +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.
--->
-<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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-parent</artifactId>
- <version>1.0</version>
- </parent>
-
- <artifactId>commons-weaver-processor</artifactId>
- <name>Apache Commons Weaver Processor</name>
- <description>
- Defines the Apache Commons Weaver SPI as well as the basic build-time
- (filesystem-based) processors that detect, configure, and invoke
- available modules.
- </description>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/processor</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/weaver/tags/1.0_RC2/processor</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/proper/weaver/tags/1.0_RC2/processor</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-finder-shaded</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <rulesets>
- <ruleset>/org/apache/commons/weaver/pmd.xml</ruleset>
- </rulesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
- <configuration>
- <configLocation>org/apache/commons/weaver/checkstyle.xml</configLocation>
- <headerLocation>org/apache/commons/weaver/license-header.txt</headerLocation>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <configuration>
- <xmlOutput>true</xmlOutput>
- <excludeFilterFile>/org/apache/commons/weaver/findbugs-exclude-filter.xml</excludeFilterFile>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-</project>
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/CleanProcessor.java b/trunk/processor/src/main/java/org/apache/commons/weaver/CleanProcessor.java
deleted file mode 100644
index 00075f8..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/CleanProcessor.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.commons.weaver;
-
-import java.io.File;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-import org.apache.commons.weaver.spi.Cleaner;
-import org.apache.commons.weaver.utils.URLArray;
-import org.apache.xbean.finder.archive.FileArchive;
-
-/**
- * This class discovers and invokes available {@link Cleaner} plugins.
- */
-public class CleanProcessor {
- private static final Logger LOG = Logger.getLogger(CleanProcessor.class.getName());
-
- /**
- * List of picked up cleaner plugins.
- */
- private static final List<Cleaner> CLEANERS;
-
- static {
- final List<Cleaner> cleaners = new ArrayList<Cleaner>();
- for (final Cleaner cleaner : ServiceLoader.load(Cleaner.class)) {
- cleaners.add(cleaner);
- }
- CLEANERS = Collections.unmodifiableList(cleaners);
- }
-
- /**
- * The classpath which will be used to look up cross references during cleaning.
- */
- private final List<String> classpath;
-
- /**
- * The actual path to be woven, replacing any affected classes.
- */
- private final File target;
-
- /**
- * Properties for configuring discovered plugin modules.
- */
- private final Properties configuration;
-
- /**
- * Create a new {@link CleanProcessor} instance.
- *
- * @param classpath not {@code null}
- * @param target not {@code null}
- * @param configuration not {@code null}
- */
- public CleanProcessor(final List<String> classpath, final File target, final Properties configuration) {
- super();
- this.classpath = Validate.notNull(classpath, "classpath");
- this.target = Validate.notNull(target, "target");
- Validate.isTrue(!target.exists() || target.isDirectory(), "%s is not a directory", target);
- this.configuration = Validate.notNull(configuration, "configuration");
- }
-
- /**
- * Clean specified targets.
- */
- public void clean() {
- if (!target.exists()) {
- LOG.warning("Target directory " + target + " does not exist; nothing to do!");
- }
- final Set<String> finderClasspath = new LinkedHashSet<String>();
- finderClasspath.add(target.getAbsolutePath());
- finderClasspath.addAll(classpath);
- final ClassLoader classLoader = new URLClassLoader(URLArray.fromPaths(finderClasspath));
- final Finder finder = new Finder(new FileArchive(classLoader, target));
- for (final Cleaner cleaner : CLEANERS) {
- final WeaveEnvironment env =
- new LocalWeaveEnvironment(target, classLoader, configuration, Logger.getLogger(cleaner.getClass()
- .getName()));
- cleaner.clean(env, finder);
- }
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/Finder.java b/trunk/processor/src/main/java/org/apache/commons/weaver/Finder.java
deleted file mode 100644
index 2a6d624..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/Finder.java
+++ /dev/null
@@ -1,746 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.IdentityHashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.weaver.model.ScanRequest;
-import org.apache.commons.weaver.model.ScanResult;
-import org.apache.commons.weaver.model.Scanner;
-import org.apache.commons.weaver.model.WeaveInterest;
-import org.apache.commons.weaver.utils.Annotations;
-import org.apache.xbean.asm4.AnnotationVisitor;
-import org.apache.xbean.asm4.ClassReader;
-import org.apache.xbean.asm4.ClassVisitor;
-import org.apache.xbean.asm4.FieldVisitor;
-import org.apache.xbean.asm4.MethodVisitor;
-import org.apache.xbean.asm4.Opcodes;
-import org.apache.xbean.asm4.Type;
-import org.apache.xbean.finder.Annotated;
-import org.apache.xbean.finder.AnnotationFinder;
-import org.apache.xbean.finder.Parameter;
-import org.apache.xbean.finder.archive.Archive;
-
-/**
- * Scanner implementation.
- */
-class Finder extends AnnotationFinder implements Scanner {
-
- private abstract class AnnotationInflater extends AnnotationCapturer {
- final Class<? extends Annotation> annotationType;
- final Map<String, Object> elements = new LinkedHashMap<String, Object>();
-
- AnnotationInflater(final String desc, final AnnotationVisitor wrapped) {
- super(wrapped);
- this.annotationType = toClass(Type.getType(desc)).asSubclass(Annotation.class);
- }
-
- Annotation inflate() {
- return Annotations.instanceOf(annotationType, elements);
- }
-
- @Override
- protected void storeValue(final String name, final Object value) {
- Object toStore = value;
- Validate.notNull(toStore, "null annotation element");
- if (toStore.getClass().isArray()) {
- final Class<?> requiredType;
- try {
- requiredType = annotationType.getDeclaredMethod(name).getReturnType();
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- if (!requiredType.isInstance(toStore)) {
- final int len = Array.getLength(toStore);
- final Object typedArray = Array.newInstance(requiredType.getComponentType(), len);
- for (int i = 0; i < len; i++) {
- Object element = Array.get(toStore, i);
- if (element instanceof Type) {
- element = toClass((Type) element);
- }
- Array.set(typedArray, i, element);
- }
- toStore = typedArray;
- }
- } else if (toStore instanceof Type) {
- toStore = toClass((Type) toStore);
- }
- elements.put(name, toStore);
- }
- }
-
- private abstract class AnnotationCapturer extends AnnotationVisitor {
- public AnnotationCapturer(final AnnotationVisitor wrapped) {
- super(Opcodes.ASM4, wrapped);
- }
-
- /**
- * Template method for storing an annotation value.
- * @param name
- * @param value
- */
- protected abstract void storeValue(String name, Object value);
-
- @Override
- public void visit(final String name, final Object value) {
- storeValue(name, value);
- }
-
- @Override
- public AnnotationVisitor visitAnnotation(final String name, final String desc) {
- final AnnotationCapturer owner = this;
- return new AnnotationInflater(desc, super.visitAnnotation(name, desc)) {
-
- @Override
- public void visitEnd() {
- owner.storeValue(name, inflate());
- }
- };
- }
-
- @Override
- public AnnotationVisitor visitArray(final String name) {
- final AnnotationCapturer owner = this;
- final List<Object> values = new ArrayList<Object>();
- return new AnnotationCapturer(super.visitArray(name)) {
-
- @Override
- public void visitEnd() {
- owner.storeValue(name, values.toArray());
- super.visitEnd();
- }
-
- @Override
- protected void storeValue(final String name, final Object value) {
- values.add(value);
- }
- };
- }
-
- @Override
- public void visitEnum(final String name, final String desc, final String value) {
- super.visitEnum(name, desc, value);
- @SuppressWarnings("rawtypes")
- final Class<? extends Enum> enumType;
- try {
- enumType = Class.forName(Type.getType(desc).getClassName()).asSubclass(Enum.class);
- } catch (final ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
- @SuppressWarnings("unchecked")
- final Enum<?> enumValue = Enum.valueOf(enumType, value);
- storeValue(name, enumValue);
- }
-
- }
-
- private class TopLevelAnnotationInflater extends AnnotationInflater {
- private final Info info;
-
- TopLevelAnnotationInflater(final String desc, final AnnotationVisitor wrapped, final Info info) {
- super(desc, wrapped);
- this.info = info;
- }
-
- @Override
- public void visitEnd() {
- super.visitEnd();
- classfileAnnotationsFor(info).add(inflate());
- }
-
- private List<Annotation> classfileAnnotationsFor(final Info info) {
- synchronized (CLASSFILE_ANNOTATIONS) {
- if (!CLASSFILE_ANNOTATIONS.get().containsKey(info)) {
- final List<Annotation> result = new ArrayList<Annotation>();
- CLASSFILE_ANNOTATIONS.get().put(info, result);
- return result;
- }
- }
- return CLASSFILE_ANNOTATIONS.get().get(info);
- }
- }
-
- /**
- * Specialized {@link ClassVisitor} to inflate annotations for the info
- * objects built by a wrapped {@link InfoBuildingVisitor}.
- */
- public class Visitor extends ClassVisitor {
- private final InfoBuildingVisitor wrapped;
-
- public Visitor(final InfoBuildingVisitor wrapped) {
- super(Opcodes.ASM4, wrapped);
- this.wrapped = wrapped;
- }
-
- @Override
- public FieldVisitor visitField(final int access, final String name, final String desc, final String signature,
- final Object value) {
- final FieldVisitor toWrap = wrapped.visitField(access, name, desc, signature, value);
- final ClassInfo classInfo = (ClassInfo) wrapped.getInfo();
- FieldInfo testFieldInfo = null;
- // should be the most recently added field, so iterate backward:
- for (int i = classInfo.getFields().size() - 1; i >= 0; i--) {
- final FieldInfo atI = classInfo.getFields().get(i);
- if (atI.getName().equals(name) && atI.getType().equals(desc)) {
- testFieldInfo = atI;
- break;
- }
- }
- if (testFieldInfo == null) {
- return toWrap;
- }
- final FieldInfo fieldInfo = testFieldInfo;
- return new FieldVisitor(Opcodes.ASM4, toWrap) {
- @Override
- public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
- final AnnotationVisitor toWrap = super.visitAnnotation(desc, visible);
- return visible ? toWrap : new TopLevelAnnotationInflater(desc, toWrap, fieldInfo);
- }
- };
- }
-
- @Override
- public MethodVisitor visitMethod(final int access, final String name, final String desc,
- final String signature, final String[] exceptions) {
- final MethodVisitor toWrap = wrapped.visitMethod(access, name, desc, signature, exceptions);
- final ClassInfo classInfo = (ClassInfo) wrapped.getInfo();
-
- // MethodInfo may not always come from a descriptor, so we must go by the
- // Member represented. Make sure the method either has a valid name or is a constructor:
- final MethodInfo compareMethodInfo = new MethodInfo(classInfo, name, desc);
- if (!compareMethodInfo.isConstructor() && !isJavaIdentifier(name)) {
- return toWrap;
- }
- MethodInfo testMethodInfo = null;
- final Member member;
- try {
- member = compareMethodInfo.get();
- // should be the most recently added method, so iterate backward:
- for (int i = classInfo.getMethods().size() - 1; i >= 0; i--) {
- final MethodInfo atI = classInfo.getMethods().get(i);
- if (atI.getName().equals(name) && atI.get().equals(member)) {
- testMethodInfo = atI;
- break;
- }
- }
- } catch (final ClassNotFoundException e) {
- return toWrap;
- }
- if (testMethodInfo == null) {
- return toWrap;
- }
- final MethodInfo methodInfo = testMethodInfo;
- return new MethodVisitor(Opcodes.ASM4, toWrap) {
- @Override
- public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
- final AnnotationVisitor toWrap = super.visitAnnotation(desc, visible);
- return visible ? toWrap : new TopLevelAnnotationInflater(desc, toWrap, methodInfo);
- }
-
- @Override
- public AnnotationVisitor visitParameterAnnotation(final int param, final String desc,
- final boolean visible) {
- final AnnotationVisitor toWrap = super.visitParameterAnnotation(param, desc, visible);
- if (visible) {
- return toWrap;
- }
- ParameterInfo parameterInfo = null;
-
- // should be the most recently added parameter, so iterate backward:
- for (int i = methodInfo.getParameters().size() - 1; i >= 0; i--) {
- final ParameterInfo atI = methodInfo.getParameters().get(i);
- try {
- if (atI.get().getIndex() == param) {
- parameterInfo = atI;
- break;
- }
- } catch (final ClassNotFoundException e) {
- continue;
- }
- }
- return parameterInfo == null ? toWrap : new TopLevelAnnotationInflater(desc, toWrap, parameterInfo);
- }
- };
- }
-
- @Override
- public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
- final AnnotationVisitor toWrap = super.visitAnnotation(desc, visible);
- return visible ? toWrap : new TopLevelAnnotationInflater(desc, toWrap, wrapped.getInfo());
- }
-
- private boolean isJavaIdentifier(final String toCheck) {
- if (toCheck.isEmpty() || !Character.isJavaIdentifierStart(toCheck.charAt(0))) {
- return false;
- }
- for (final char chr : toCheck.substring(1).toCharArray()) {
- if (!Character.isJavaIdentifierPart(chr)) {
- return false;
- }
- }
- return true;
- }
- }
-
- private static class IncludesClassfile<T extends AnnotatedElement> implements Annotated<T> {
- private final T target;
- private final Annotation[] annotations;
-
- IncludesClassfile(final T target, final List<Annotation> classfileAnnotations) {
- this(target, classfileAnnotations.toArray(new Annotation[classfileAnnotations.size()]));
- }
-
- IncludesClassfile(final T target, final Annotation[] classfileAnnotations) {
- super();
- this.target = target;
- this.annotations = ArrayUtils.addAll(target.getAnnotations(), classfileAnnotations);
- }
-
- @Override
- public <A extends Annotation> A getAnnotation(final Class<A> annotationType) {
- for (final Annotation prospect : annotations) {
- if (prospect.annotationType().equals(annotationType)) {
- @SuppressWarnings("unchecked")
- final A result = (A) prospect;
- return result;
- }
- }
- return null;
- }
-
- @Override
- public Annotation[] getAnnotations() {
- final Annotation[] result = new Annotation[annotations.length];
- System.arraycopy(annotations, 0, result, 0, annotations.length);
- return result;
- }
-
- @Override
- public Annotation[] getDeclaredAnnotations() {
- return getAnnotations();
- }
-
- @Override
- public boolean isAnnotationPresent(final Class<? extends Annotation> annotationType) {
- return getAnnotation(annotationType) != null;
- }
-
- @Override
- public T get() {
- return target;
- }
-
- }
-
- /**
- * Helper class for finding elements with annotations (including those with classfile-level retention).
- */
- public final class WithAnnotations {
- private static final String INIT = "<init>";
-
- private WithAnnotations() {
- }
-
- public List<Annotated<Package>> findAnnotatedPackages(final Class<? extends Annotation> annotation) {
- Finder.this.findAnnotatedPackages(annotation);
- final List<Annotated<Package>> result = new ArrayList<Annotated<Package>>();
- for (final Info info : getAnnotationInfos(annotation.getName())) {
- if (info instanceof PackageInfo) {
- final PackageInfo packageInfo = (PackageInfo) info;
- try {
- final IncludesClassfile<Package> annotated =
- new IncludesClassfile<Package>(packageInfo.get(), classfileAnnotationsFor(packageInfo));
- if (annotated.isAnnotationPresent(annotation)) {
- result.add(annotated);
- }
- } catch (final ClassNotFoundException e) {
- continue;
- }
- }
- }
- return result;
- }
-
- public List<Annotated<Class<?>>> findAnnotatedClasses(final Class<? extends Annotation> annotation) {
- Finder.this.findAnnotatedClasses(annotation);
- final List<Annotated<Class<?>>> result = new ArrayList<Annotated<Class<?>>>();
- for (final Info info : getAnnotationInfos(annotation.getName())) {
- if (info instanceof ClassInfo) {
- final ClassInfo classInfo = (ClassInfo) info;
-
- IncludesClassfile<Class<?>> annotated;
- try {
- annotated =
- new IncludesClassfile<Class<?>>(classInfo.get(), classfileAnnotationsFor(classInfo));
- } catch (final ClassNotFoundException e) {
- continue;
- }
- if (annotated.isAnnotationPresent(annotation)) {
- result.add(annotated);
- }
- }
- }
- return result;
- }
-
- public List<Annotated<Class<?>>> findAssignableTypes(final Class<?> supertype) {
- final List<Annotated<Class<?>>> result = new ArrayList<Annotated<Class<?>>>();
- final List<?> assignableTypes;
- if (supertype.isInterface()) {
- assignableTypes = Finder.this.findImplementations(supertype);
- } else {
- assignableTypes = Finder.this.findSubclasses(supertype);
- }
-
- for (final Object object : assignableTypes) {
- final ClassInfo classInfo = classInfos.get(((Class<?>) object).getName());
- final IncludesClassfile<Class<?>> annotated;
- try {
- annotated = new IncludesClassfile<Class<?>>(classInfo.get(), classfileAnnotationsFor(classInfo));
- } catch (final ClassNotFoundException e) {
- continue;
- }
- result.add(annotated);
- }
- return result;
- }
-
- public List<Annotated<Method>> findAnnotatedMethods(final Class<? extends Annotation> annotation) {
- Finder.this.findAnnotatedMethods(annotation);
- final List<Annotated<Method>> result = new ArrayList<Annotated<Method>>();
- for (final Info info : getAnnotationInfos(annotation.getName())) {
- if (info instanceof MethodInfo) {
- final MethodInfo methodInfo = (MethodInfo) info;
- if (INIT.equals(methodInfo.getName())) {
- continue;
- }
- IncludesClassfile<Method> annotated;
- try {
- annotated =
- new IncludesClassfile<Method>((Method) methodInfo.get(),
- classfileAnnotationsFor(methodInfo));
- } catch (final ClassNotFoundException e) {
- continue;
- }
- if (annotated.isAnnotationPresent(annotation)) {
- result.add(annotated);
- }
- }
- }
- return result;
-
- }
-
- public List<Annotated<Parameter<Method>>> findAnnotatedMethodParameters(
- final Class<? extends Annotation> annotationType) {
- Finder.this.findAnnotatedMethodParameters(annotationType);
- final List<Annotated<Parameter<Method>>> result = new ArrayList<Annotated<Parameter<Method>>>();
- for (final Info info : getAnnotationInfos(annotationType.getName())) {
- if (info instanceof ParameterInfo) {
- final ParameterInfo parameterInfo = (ParameterInfo) info;
- if (INIT.equals(parameterInfo.getDeclaringMethod().getName())) {
- continue;
- }
- Parameter<Method> parameter;
- try {
- @SuppressWarnings("unchecked")
- final Parameter<Method> unchecked = (Parameter<Method>) parameterInfo.get();
- parameter = unchecked;
- } catch (final ClassNotFoundException e) {
- continue;
- }
- final IncludesClassfile<Parameter<Method>> annotated =
- new IncludesClassfile<Parameter<Method>>(parameter, classfileAnnotationsFor(parameterInfo));
- if (annotated.isAnnotationPresent(annotationType)) {
- result.add(annotated);
- }
- }
- }
- return result;
- }
-
- public List<Annotated<Constructor<?>>> findAnnotatedConstructors(final Class<? extends Annotation> annotation) {
- Finder.this.findAnnotatedConstructors(annotation);
- final List<Annotated<Constructor<?>>> result = new ArrayList<Annotated<Constructor<?>>>();
- for (final Info info : getAnnotationInfos(annotation.getName())) {
- if (info instanceof MethodInfo) {
- final MethodInfo methodInfo = (MethodInfo) info;
- if (!INIT.equals(methodInfo.getName())) {
- continue;
- }
- final IncludesClassfile<Constructor<?>> annotated;
- try {
- annotated =
- new IncludesClassfile<Constructor<?>>((Constructor<?>) methodInfo.get(),
- classfileAnnotationsFor(methodInfo));
- } catch (final ClassNotFoundException e) {
- continue;
- }
- if (annotated.isAnnotationPresent(annotation)) {
- result.add(annotated);
- }
- }
- }
- return result;
- }
-
- public List<Annotated<Parameter<Constructor<?>>>> findAnnotatedConstructorParameters(
- final Class<? extends Annotation> annotation) {
- Finder.this.findAnnotatedConstructorParameters(annotation);
- final List<Annotated<Parameter<Constructor<?>>>> result =
- new ArrayList<Annotated<Parameter<Constructor<?>>>>();
- for (final Info info : getAnnotationInfos(annotation.getName())) {
- if (info instanceof ParameterInfo) {
- final ParameterInfo parameterInfo = (ParameterInfo) info;
- if (!INIT.equals(parameterInfo.getDeclaringMethod().getName())) {
- continue;
- }
- Parameter<Constructor<?>> parameter;
- try {
- @SuppressWarnings("unchecked")
- final Parameter<Constructor<?>> unchecked = (Parameter<Constructor<?>>) parameterInfo.get();
- parameter = unchecked;
- } catch (final ClassNotFoundException e) {
- continue;
- }
- final IncludesClassfile<Parameter<Constructor<?>>> annotated =
- new IncludesClassfile<Parameter<Constructor<?>>>(parameter,
- classfileAnnotationsFor(parameterInfo));
- if (annotated.isAnnotationPresent(annotation)) {
- result.add(annotated);
- }
- }
- }
- return result;
- }
-
- public List<Annotated<Field>> findAnnotatedFields(final Class<? extends Annotation> annotation) {
- Finder.this.findAnnotatedFields(annotation);
- final List<Annotated<Field>> result = new ArrayList<Annotated<Field>>();
- for (final Info info : getAnnotationInfos(annotation.getName())) {
- if (info instanceof FieldInfo) {
- final FieldInfo fieldInfo = (FieldInfo) info;
- try {
- final IncludesClassfile<Field> annotated =
- new IncludesClassfile<Field>((Field) fieldInfo.get(), classfileAnnotationsFor(fieldInfo));
- if (annotated.isAnnotationPresent(annotation)) {
- result.add(annotated);
- }
- } catch (final ClassNotFoundException e) {
- continue;
- }
- }
- }
- return result;
- }
-
- private List<Annotation> classfileAnnotationsFor(final Info info) {
- synchronized (classfileAnnotations) {
- if (!classfileAnnotations.containsKey(info)) {
- final List<Annotation> result = new ArrayList<Annotation>();
- classfileAnnotations.put(info, result);
- return result;
- }
- }
- return classfileAnnotations.get(info);
- }
-
- }
-
- private static final int ASM_FLAGS = ClassReader.SKIP_CODE + ClassReader.SKIP_DEBUG + ClassReader.SKIP_FRAMES;
-
- /**
- * The {@link #classfileAnnotations} member stores these; however the scanning takes place in the scope of the super
- * constructor call, thus there is no opportunity to set the reference beforehand. To work around this, we use a
- * static ThreadLocal with an initializer and pull/clear its value when we return from the super constructor. :P
- */
- private static final ThreadLocal<Map<Info, List<Annotation>>> CLASSFILE_ANNOTATIONS =
- new ThreadLocal<Map<Info, List<Annotation>>>() {
- @Override
- protected Map<Info, List<Annotation>> initialValue() {
- return new IdentityHashMap<AnnotationFinder.Info, List<Annotation>>();
- }
- };
-
- private final WithAnnotations withAnnotations = new WithAnnotations();
- private final Map<Info, List<Annotation>> classfileAnnotations;
- private final Inflater inflater;
-
- /**
- * Create a new {@link Finder} instance.
- * @param archive
- */
- public Finder(final Archive archive) {
- super(archive, false);
- classfileAnnotations = CLASSFILE_ANNOTATIONS.get();
- CLASSFILE_ANNOTATIONS.remove();
- inflater = new Inflater(classfileAnnotations);
- enableFindImplementations();
- enableFindSubclasses();
- }
-
- /**
- * Fluent "finder with annotations".
- * @return {@link WithAnnotations}
- */
- public WithAnnotations withAnnotations() {
- return withAnnotations;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void readClassDef(final InputStream bytecode) throws IOException {
- try {
- final ClassReader classReader = new ClassReader(bytecode);
- classReader.accept(new Visitor(new InfoBuildingVisitor()), ASM_FLAGS);
- } finally {
- bytecode.close();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public AnnotationFinder select(final Class<?>... arg0) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public AnnotationFinder select(final Iterable<String> clazz) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public AnnotationFinder select(final String... clazz) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ScanResult scan(final ScanRequest request) {
- final ScanResult result = new ScanResult();
-
- for (final WeaveInterest interest : request.getInterests()) {
- switch (interest.target) {
- case PACKAGE:
- for (final Annotated<Package> pkg : this.withAnnotations().findAnnotatedPackages(
- interest.annotationType)) {
- result.getWeavable(pkg.get()).addAnnotations(pkg.getAnnotations());
- }
- break;
- case TYPE:
- for (final Annotated<Class<?>> type : this.withAnnotations().findAnnotatedClasses(
- interest.annotationType)) {
- result.getWeavable(type.get()).addAnnotations(type.getAnnotations());
- }
- break;
- case METHOD:
- for (final Annotated<Method> method : this.withAnnotations().findAnnotatedMethods(
- interest.annotationType)) {
- result.getWeavable(method.get()).addAnnotations(method.getAnnotations());
- }
- break;
- case CONSTRUCTOR:
- for (final Annotated<Constructor<?>> ctor : this.withAnnotations().findAnnotatedConstructors(
- interest.annotationType)) {
- result.getWeavable(ctor.get()).addAnnotations(ctor.getAnnotations());
- }
- break;
- case FIELD:
- for (final Annotated<Field> fld : this.withAnnotations().findAnnotatedFields(interest.annotationType)) {
- result.getWeavable(fld.get()).addAnnotations(fld.getAnnotations());
- }
- break;
- case PARAMETER:
- for (final Annotated<Parameter<Method>> parameter : this.withAnnotations()
- .findAnnotatedMethodParameters(interest.annotationType)) {
- result.getWeavable(parameter.get().getDeclaringExecutable())
- .getWeavableParameter(parameter.get().getIndex()).addAnnotations(parameter.getAnnotations());
- }
- for (final Annotated<Parameter<Constructor<?>>> parameter : this.withAnnotations()
- .findAnnotatedConstructorParameters(interest.annotationType)) {
- result.getWeavable(parameter.get().getDeclaringExecutable())
- .getWeavableParameter(parameter.get().getIndex()).addAnnotations(parameter.getAnnotations());
- }
- break;
- default:
- // should we log something?
- break;
- }
- }
- for (final Class<?> supertype : request.getSupertypes()) {
- for (final Annotated<Class<?>> type : this.withAnnotations().findAssignableTypes(supertype)) {
- result.getWeavable(type.get()).addAnnotations(type.getAnnotations());
- }
- }
- return inflater.inflate(result);
- }
-
- private Class<?> toClass(final Type type) {
- final String className;
- if (type.getSort() == Type.ARRAY) {
- className = type.getElementType().getClassName();
- } else {
- className = type.getClassName();
- }
- Class<?> result;
- try {
- result = Class.forName(className);
- } catch (final ClassNotFoundException e) {
- try {
- result = getArchive().loadClass(className);
- } catch (final ClassNotFoundException e1) {
- throw new RuntimeException(e1);
- }
- }
- if (type.getSort() == Type.ARRAY) {
- final int[] dims = new int[type.getDimensions()];
- Arrays.fill(dims, 0);
- result = Array.newInstance(result, dims).getClass();
- }
- return result;
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/Inflater.java b/trunk/processor/src/main/java/org/apache/commons/weaver/Inflater.java
deleted file mode 100644
index 0b1dae4..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/Inflater.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.weaver.model.ScanResult;
-import org.apache.commons.weaver.model.WeavableClass;
-import org.apache.commons.weaver.model.WeavableConstructor;
-import org.apache.commons.weaver.model.WeavableConstructorParameter;
-import org.apache.commons.weaver.model.WeavableField;
-import org.apache.commons.weaver.model.WeavableMethod;
-import org.apache.commons.weaver.model.WeavableMethodParameter;
-import org.apache.commons.weaver.model.WeavablePackage;
-import org.apache.xbean.finder.AnnotationFinder.ClassInfo;
-import org.apache.xbean.finder.AnnotationFinder.FieldInfo;
-import org.apache.xbean.finder.AnnotationFinder.Info;
-import org.apache.xbean.finder.AnnotationFinder.MethodInfo;
-import org.apache.xbean.finder.AnnotationFinder.PackageInfo;
-import org.apache.xbean.finder.AnnotationFinder.ParameterInfo;
-import org.apache.xbean.finder.Parameter;
-
-/**
- * Adds all classfile annotations to a ScanResult.
- */
-class Inflater {
- private class InfoMatcher {
- final Class<? extends Info> type;
-
- InfoMatcher(final Class<? extends Info> type) {
- super();
- this.type = type;
- }
-
- boolean test(final Info info) {
- return type.isInstance(info);
- }
-
- }
-
- private class MethodMatcher extends InfoMatcher {
- final boolean isCtor;
-
- MethodMatcher(final boolean isCtor) {
- super(MethodInfo.class);
- this.isCtor = isCtor;
- }
-
- @Override
- boolean test(final Info info) {
- return super.test(info) && ((MethodInfo) info).isConstructor() == isCtor;
- }
- }
-
- private class ParameterMatcher extends InfoMatcher {
- final boolean isCtor;
-
- ParameterMatcher(final boolean isCtor) {
- super(ParameterInfo.class);
- this.isCtor = isCtor;
- }
-
- @Override
- boolean test(final Info info) {
- return super.test(info) && ((ParameterInfo) info).getDeclaringMethod().isConstructor() == isCtor;
- }
- }
-
- final Map<PackageInfo, List<Annotation>> packageAnnotations;
- final Map<ClassInfo, List<Annotation>> classAnnotations;
- final Map<FieldInfo, List<Annotation>> fieldAnnotations;
- final Map<MethodInfo, List<Annotation>> ctorAnnotations;
- final Map<MethodInfo, List<Annotation>> methodAnnotations;
- final Map<ParameterInfo, List<Annotation>> ctorParameterAnnotations;
- final Map<ParameterInfo, List<Annotation>> methodParameterAnnotations;
-
- Inflater(final Map<Info, List<Annotation>> annotationMap) {
- super();
-
- this.packageAnnotations = subMap(annotationMap, new InfoMatcher(PackageInfo.class));
- this.classAnnotations = subMap(annotationMap, new InfoMatcher(ClassInfo.class));
- this.fieldAnnotations = subMap(annotationMap, new InfoMatcher(FieldInfo.class));
- this.ctorAnnotations = subMap(annotationMap, new MethodMatcher(true));
- this.methodAnnotations = subMap(annotationMap, new MethodMatcher(false));
- this.ctorParameterAnnotations = subMap(annotationMap, new ParameterMatcher(true));
- this.methodParameterAnnotations = subMap(annotationMap, new ParameterMatcher(false));
- }
-
- static <I extends Info> Map<I, List<Annotation>> subMap(final Map<Info, List<Annotation>> source,
- final InfoMatcher matcher) {
- final HashMap<I, List<Annotation>> result = new HashMap<I, List<Annotation>>();
- for (final Map.Entry<Info, List<Annotation>> entry : source.entrySet()) {
- if (matcher.test(entry.getKey())) {
- @SuppressWarnings("unchecked")
- final I key = (I) entry.getKey();
- result.put(key, entry.getValue());
- }
- }
- return result;
- }
-
- ScanResult inflate(final ScanResult scanResult) {
- for (final WeavablePackage pkg : scanResult.getPackages()) {
- for (final Map.Entry<PackageInfo, List<Annotation>> entry : packageAnnotations.entrySet()) {
- if (entry.getKey().getName().equals(pkg.getTarget().getName())) {
- pkg.addAnnotations(entry.getValue());
- }
- }
- for (final WeavableClass<?> cls : pkg.getClasses()) {
- for (final Map.Entry<ClassInfo, List<Annotation>> entry : classAnnotations.entrySet()) {
- if (entry.getKey().getName().equals(cls.getTarget().getName())) {
- cls.addAnnotations(entry.getValue());
- }
- }
- for (final WeavableField<?> fld : cls.getFields()) {
- for (final Map.Entry<FieldInfo, List<Annotation>> entry : fieldAnnotations.entrySet()) {
- try {
- if (entry.getKey().get().equals(fld.getTarget())) {
- fld.addAnnotations(entry.getValue());
- }
- } catch (final ClassNotFoundException cnfe) {
- continue;
- }
- }
- }
- for (final WeavableConstructor<?> ctor : cls.getConstructors()) {
- for (final Map.Entry<MethodInfo, List<Annotation>> entry : ctorAnnotations.entrySet()) {
- try {
- if (entry.getKey().get().equals(ctor.getTarget())) {
- ctor.addAnnotations(entry.getValue());
- }
- } catch (final ClassNotFoundException cnfe) {
- continue;
- }
- }
- for (final WeavableConstructorParameter<?> param : ctor.getParameters()) {
- for (final Map.Entry<ParameterInfo, List<Annotation>> entry : ctorParameterAnnotations
- .entrySet()) {
- try {
- final Parameter<?> parameter = entry.getKey().get();
- if (parameter.getDeclaringExecutable().equals(ctor.getTarget())
- && param.getTarget().intValue() == parameter.getIndex()) {
- param.addAnnotations(entry.getValue());
- }
- } catch (final ClassNotFoundException cnfe) {
- continue;
- }
- }
- }
- }
- for (final WeavableMethod<?> methd : cls.getMethods()) {
- for (final Map.Entry<MethodInfo, List<Annotation>> entry : methodAnnotations.entrySet()) {
- try {
- if (entry.getKey().get().equals(methd.getTarget())) {
- methd.addAnnotations(entry.getValue());
- }
- } catch (final ClassNotFoundException cnfe) {
- continue;
- }
- }
- for (final WeavableMethodParameter<?> param : methd.getParameters()) {
- for (final Map.Entry<ParameterInfo, List<Annotation>> entry : methodParameterAnnotations
- .entrySet()) {
- try {
- final Parameter<?> parameter = entry.getKey().get();
- if (parameter.getDeclaringExecutable().equals(methd.getTarget())
- && param.getTarget().intValue() == parameter.getIndex()) {
- param.addAnnotations(entry.getValue());
- }
- } catch (final ClassNotFoundException cnfe) {
- continue;
- }
- }
- }
- }
- }
- }
- return scanResult;
- }
-
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/LocalWeaveEnvironment.java b/trunk/processor/src/main/java/org/apache/commons/weaver/LocalWeaveEnvironment.java
deleted file mode 100644
index fe00404..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/LocalWeaveEnvironment.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.commons.weaver;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-
-class LocalWeaveEnvironment extends WeaveEnvironment {
-
- private final File target;
-
- protected LocalWeaveEnvironment(final File target, final ClassLoader classLoader, final Properties config,
- final Logger log) {
- super(classLoader, config, log);
- Validate.notNull(target, "target");
- this.target = target;
- }
-
- @Override
- public boolean deleteResource(final String name) {
- return new File(target, name).delete();
- }
-
- @Override
- protected OutputStream getOutputStream(final String resourceName) throws IOException {
- final File file = new File(target, resourceName);
- final File parent = file.getParentFile();
- if (parent.exists()) {
- Validate.validState(parent.isDirectory(), "Cannot write %s to non-directory parent", file);
- } else {
- Validate.validState(parent.mkdirs(), "Unable to create output directory %s", parent);
- }
- return new FileOutputStream(file);
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java b/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java
deleted file mode 100644
index 9de2975..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.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.commons.weaver;
-
-import java.io.File;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.ServiceLoader;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-import org.apache.commons.weaver.spi.Weaver;
-import org.apache.commons.weaver.utils.URLArray;
-import org.apache.xbean.finder.archive.FileArchive;
-
-/**
- * This class discovers and invokes available {@link Weaver} plugins.
- */
-public class WeaveProcessor {
-
- private static final Logger LOG = Logger.getLogger(WeaveProcessor.class.getName());
-
- /**
- * List of picked up weaver plugins.
- */
- private static final List<Weaver> WEAVERS;
-
- static {
- final List<Weaver> weavers = new ArrayList<Weaver>();
- for (final Weaver weaver : ServiceLoader.load(Weaver.class)) {
- weavers.add(weaver);
- }
- WEAVERS = Collections.unmodifiableList(weavers);
- }
-
- /**
- * The classpath which will be used to look up cross references during weaving.
- */
- private final List<String> classpath;
-
- /**
- * The actual path to be woven, replacing any affected classes.
- */
- private final File target;
-
- /**
- * Properties for configuring discovered plugin modules.
- */
- private final Properties configuration;
-
- /**
- * Create a new {@link WeaveProcessor} instance.
- *
- * @param classpath not {@code null}
- * @param target not {@code null}
- * @param configuration not {@code null}
- */
- public WeaveProcessor(final List<String> classpath, final File target, final Properties configuration) {
- super();
- this.classpath = Validate.notNull(classpath, "classpath");
- this.target = Validate.notNull(target, "target");
- Validate.isTrue(!target.exists() || target.isDirectory(), "%s is not a directory", target);
- this.configuration = Validate.notNull(configuration, "configuration");
- }
-
- /**
- * Weave classes in target directory.
- */
- public void weave() {
- if (!target.exists()) {
- LOG.warning("Target directory " + target + " does not exist; nothing to do!");
- }
- final Set<String> finderClasspath = new LinkedHashSet<String>();
- finderClasspath.add(target.getAbsolutePath());
- finderClasspath.addAll(classpath);
- final ClassLoader classLoader = new URLClassLoader(URLArray.fromPaths(finderClasspath));
- final Finder finder = new Finder(new FileArchive(classLoader, target));
- for (final Weaver weaver : WEAVERS) {
- final WeaveEnvironment env =
- new LocalWeaveEnvironment(target, classLoader, configuration, Logger.getLogger(weaver.getClass()
- .getName()));
- weaver.process(env, finder);
- }
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/AnnotatedElements.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/AnnotatedElements.java
deleted file mode 100644
index 376f865..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/AnnotatedElements.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.commons.weaver.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.reflect.AnnotatedElement;
-
-/**
- * Interface defining a means of iterating over a particular type of
- * {@link AnnotatedElement} as well as filtering by annotation type (including
- * annotations with {@link RetentionPolicy#CLASS} retention in addition to those
- * with {@link RetentionPolicy#RUNTIME} retention.
- * @param <T> element type
- */
-public interface AnnotatedElements<T extends AnnotatedElement> extends Iterable<T> {
- /**
- * Filter by annotation type.
- * @param annotationType filter
- * @return {@link AnnotatedElements}, narrowed
- */
- AnnotatedElements<T> with(Class<? extends Annotation> annotationType);
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/NestedWeavable.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/NestedWeavable.java
deleted file mode 100644
index 7a0ef76..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/NestedWeavable.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.commons.weaver.model;
-
-/**
- * Describes a {@link Weavable} that lives inside some other {@link Weavable}.
- * @param <SELF> own type
- * @param <TARGET> weavable target type
- * @param <PARENT> enclosing weavable type
- * @param <PARENT_TARGET> parent target type
- */
-public abstract class NestedWeavable
- <SELF extends NestedWeavable<SELF, TARGET, PARENT, PARENT_TARGET>,
- TARGET,
- PARENT extends Weavable<PARENT, PARENT_TARGET>,
- PARENT_TARGET>
- extends Weavable<SELF, TARGET> {
-
- private final PARENT parent;
-
- /**
- * Create a new {@link NestedWeavable} instance.
- * @param target element
- * @param parent enclosing
- */
- protected NestedWeavable(final TARGET target, final PARENT parent) {
- super(target);
- this.parent = parent;
- }
-
- /**
- * Get the parent.
- * @return {@code PARENT}
- */
- public PARENT getParent() {
- return parent;
- }
-
- /**
- * Implement {@link Comparable}.
- * @param obj {@code SELF}
- * @return int per {@link Comparable#compareTo(Object)} contract
- */
- @Override
- public final int compareTo(final SELF obj) {
- final int result = getParent().compareTo(obj.getParent());
- return result == 0 ? localCompareTo(obj) : result;
- }
-
- /**
- * Compare against {@code o} without respect to {@link #getParent()}.
- * @param obj SELF{@code SELF}
- * @return int per {@link Comparable#compareTo(Object)} contract
- */
- protected abstract int localCompareTo(SELF obj);
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanRequest.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanRequest.java
deleted file mode 100644
index 08de040..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanRequest.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.commons.weaver.model;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.weaver.spi.Cleaner;
-import org.apache.commons.weaver.spi.Weaver;
-
-/**
- * Scan request object describing the types of elements in which a given {@link Weaver} or {@link Cleaner} is
- * interested.
- */
-public class ScanRequest {
-
- private final List<WeaveInterest> interests = new ArrayList<WeaveInterest>();
- private final Set<Class<?>> supertypes = new LinkedHashSet<Class<?>>();
-
- /**
- * Register a {@link WeaveInterest}.
- * @param interest {@link WeaveInterest} to add
- * @return {@code this}, fluently
- */
- public ScanRequest add(final WeaveInterest interest) {
- if (interest == null) {
- throw new NullPointerException();
- }
- interests.add(interest);
- return this;
- }
-
- /**
- * Register one or more types whose subtypes you are looking for.
- * @param types {@link Class}es to add
- * @return {@code this}, fluently
- */
- public ScanRequest addSupertypes(final Class<?>... types) {
- Collections.addAll(supertypes, Validate.noNullElements(types, "null element at [%s]"));
- return this;
- }
-
- /**
- * Get registered {@link WeaveInterest}s.
- * @return {@link Iterable}
- */
- public Iterable<WeaveInterest> getInterests() {
- return Collections.unmodifiableList(interests);
- }
-
- /**
- * Get registered {@link Class}es whose subtypes will be returned.
- * @return {@link Set}
- */
- public Set<Class<?>> getSupertypes() {
- return Collections.unmodifiableSet(supertypes);
- }
-
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanResult.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanResult.java
deleted file mode 100644
index 4798374..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/ScanResult.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.commons.weaver.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import java.util.concurrent.ConcurrentNavigableMap;
-import java.util.concurrent.ConcurrentSkipListMap;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.weaver.WeaveProcessor;
-import org.apache.commons.weaver.spi.Weaver;
-
-/**
- * <p>Encapsulates the result of scanning based on a {@link ScanRequest}. The
- * scan results are available in a structure corresponding to the Java class
- * hierarchy; i.e.:
- * <pre>
- * package
- * |_class
- * |_field
- * |_method
- * | |_method parameter
- * |_constructor
- * |_constructor parameter
- * </pre>
- * </p><p>
- * The tree of results can be iterated in this manner using
- * {@link #getPackages()}. However, if a given {@link Weaver} is known not to
- * handle packages but some other element, convenience methods are provided
- * here giving direct access to the various elements that may have been
- * discovered.
- * </p>
- */
-public class ScanResult {
- private abstract static class Projection<PARENT, CHILD extends AnnotatedElement> implements
- AnnotatedElements<CHILD> {
- private final Iterable<PARENT> parents;
-
- Projection(final Iterable<PARENT> parents) {
- super();
- this.parents = parents;
- }
-
- protected abstract Iterable<CHILD> childrenOf(PARENT parent);
-
- @Override
- public Iterator<CHILD> iterator() {
- final Iterator<PARENT> parentIterator = parents.iterator();
- return new Iterator<CHILD>() {
- private Iterator<CHILD> children = nextChildren();
-
- @Override
- public synchronized boolean hasNext() {
- return children != null;
- }
-
- @Override
- public synchronized CHILD next() {
- if (children == null) {
- throw new NoSuchElementException();
- }
- try {
- return children.next();
- } finally {
- if (!children.hasNext()) {
- children = nextChildren();
- }
- }
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- private Iterator<CHILD> nextChildren() {
- while (parentIterator.hasNext()) {
- final Iterator<CHILD> prospect = childrenOf(parentIterator.next()).iterator();
- if (prospect.hasNext()) {
- return prospect;
- }
- }
- return null;
- }
- };
- }
-
- @Override
- public AnnotatedElements<CHILD> with(final Class<? extends Annotation> annotationType) {
- return new AnnotatedWith<CHILD>(this, annotationType);
- }
- }
-
- private static class AnnotatedWith<W extends AnnotatedElement> implements AnnotatedElements<W> {
- final Iterable<W> wrapped;
- final Class<? extends Annotation> annotationType;
-
- AnnotatedWith(final Iterable<W> wrapped, final Class<? extends Annotation> annotationType) {
- super();
- this.wrapped = wrapped;
- this.annotationType = annotationType;
- }
-
- @Override
- public Iterator<W> iterator() {
- final Iterator<W> iter = wrapped.iterator();
- return new Iterator<W>() {
- W next = read();
-
- private W read() {
- while (iter.hasNext()) {
- final W element = iter.next();
- if (element.isAnnotationPresent(annotationType)) {
- return element;
- }
- }
- return null;
- }
-
- @Override
- public boolean hasNext() {
- return next != null;
- }
-
- @Override
- public W next() {
- if (next == null) {
- throw new NoSuchElementException();
- }
- try {
- return next;
- } finally {
- next = read();
- }
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- @Override
- public AnnotatedElements<W> with(final Class<? extends Annotation> annotationType) {
- return new AnnotatedWith<W>(this, annotationType);
- }
-
- }
-
- private final ConcurrentNavigableMap<String, WeavablePackage> packages =
- new ConcurrentSkipListMap<String, WeavablePackage>();
-
- /**
- * Public for use by {@link WeaveProcessor}.
- * @param pkg to wrap
- * @return {@link WeavablePackage}
- */
- public WeavablePackage getWeavable(final Package pkg) {
- final String key = pkg.getName();
- if (packages.containsKey(key)) {
- return packages.get(key);
- }
- final WeavablePackage result = new WeavablePackage(pkg);
- final WeavablePackage faster = packages.putIfAbsent(key, result);
- return faster == null ? result : faster;
- }
-
- /**
- * Public for use by {@link WeaveProcessor}.
- * @param cls to wrap
- * @param <T> type
- * @return {@link WeavableClass}
- */
- public <T> WeavableClass<T> getWeavable(final Class<T> cls) {
- return getWeavable(cls.getPackage()).getWeavable(cls);
- }
-
- /**
- * Public for use by {@link WeaveProcessor}.
- * @param fld to wrap
- * @return {@link WeavableField}
- */
- public WeavableField<?> getWeavable(final Field fld) {
- return getWeavable(fld.getDeclaringClass()).getWeavable(fld);
- }
-
- /**
- * Public for use by {@link WeaveProcessor}.
- * @param methd to wrap
- * @return {@link WeavableMethod}
- */
- public WeavableMethod<?> getWeavable(final Method methd) {
- return getWeavable(methd.getDeclaringClass()).getWeavable(methd);
- }
-
- /**
- * Public for use by {@link WeaveProcessor}.
- * @param ctor to wrap
- * @param <T> type
- * @return {@link WeavableConstructor}
- */
- public <T> WeavableConstructor<T> getWeavable(final Constructor<T> ctor) {
- return getWeavable(ctor.getDeclaringClass()).getWeavable(ctor);
- }
-
- /**
- * Iterate or filter {@link WeavablePackage}s.
- * @return {@link AnnotatedElements}
- */
- public AnnotatedElements<WeavablePackage> getPackages() {
- return new AnnotatedElements<WeavablePackage>() {
-
- @Override
- public Iterator<WeavablePackage> iterator() {
- return packages.values().iterator();
- }
-
- @Override
- public AnnotatedElements<WeavablePackage> with(final Class<? extends Annotation> annotationType) {
- return new AnnotatedWith<WeavablePackage>(packages.values(), annotationType);
- }
- };
- }
-
- /**
- * Iterate or filter {@link WeavableClass}es.
- * @return {@link AnnotatedElements}
- */
- public AnnotatedElements<WeavableClass<?>> getClasses() {
- return new Projection<WeavablePackage, WeavableClass<?>>(getPackages()) {
-
- @Override
- protected Iterable<WeavableClass<?>> childrenOf(final WeavablePackage parent) {
- return parent.getClasses();
- }
- };
- }
-
- /**
- * Iterate or filter {@link WeavableClass}es assignable to {@code supertype}.
- * @param supertype {@link Class} whose subtypes are sought
- * @return {@link AnnotatedElements}
- */
- public AnnotatedElements<WeavableClass<?>> getClassesAssignableTo(final Class<?> supertype) {
- Validate.notNull(supertype, "supertype");
-
- return new Projection<WeavablePackage, WeavableClass<?>>(getPackages()) {
-
- @Override
- protected Iterable<WeavableClass<?>> childrenOf(final WeavablePackage parent) {
- return parent.getClasses();
- }
-
- @Override
- public Iterator<WeavableClass<?>> iterator() {
- final Iterator<WeavableClass<?>> toWrap = super.iterator();
- return new Iterator<WeavableClass<?>>() {
- {
- read();
- }
-
- private WeavableClass<?> next;
-
- private void read() {
- while (toWrap.hasNext()) {
- final WeavableClass<?> test = toWrap.next();
- if (supertype.isAssignableFrom(test.getTarget())) {
- next = test;
- return;
- }
- }
- next = null;
- }
-
- @Override
- public boolean hasNext() {
- return next != null;
- }
-
- @Override
- public WeavableClass<?> next() {
- try {
- return next;
- } finally {
- read();
- }
- }
-
- @Override
- public void remove() {
- toWrap.remove();
- }
- };
- }
- };
- }
-
- /**
- * Iterate or filter {@link WeavableField}s.
- * @return {@link AnnotatedElements}
- */
- public AnnotatedElements<WeavableField<?>> getFields() {
- return new Projection<WeavableClass<?>, WeavableField<?>>(getClasses()) {
-
- @Override
- protected Iterable<WeavableField<?>> childrenOf(final WeavableClass<?> parent) {
- @SuppressWarnings({ "unchecked", "rawtypes" })
- final Iterable<WeavableField<?>> result = ((WeavableClass) parent).getFields();
- return result;
- }
- };
- }
-
- /**
- * Iterate or filter {@link WeavableConstructor}s.
- * @return {@link AnnotatedElements}
- */
- public AnnotatedElements<WeavableConstructor<?>> getConstructors() {
- return new Projection<WeavableClass<?>, WeavableConstructor<?>>(getClasses()) {
-
- @Override
- protected Iterable<WeavableConstructor<?>> childrenOf(final WeavableClass<?> parent) {
- @SuppressWarnings({ "unchecked", "rawtypes" })
- final Iterable<WeavableConstructor<?>> result = ((WeavableClass) parent).getConstructors();
- return result;
- }
- };
- }
-
- /**
- * Iterate or filter {@link WeavableMethod}s.
- * @return {@link AnnotatedElements}
- */
- public AnnotatedElements<WeavableMethod<?>> getMethods() {
- return new Projection<WeavableClass<?>, WeavableMethod<?>>(getClasses()) {
-
- @Override
- protected Iterable<WeavableMethod<?>> childrenOf(final WeavableClass<?> parent) {
- @SuppressWarnings({ "unchecked", "rawtypes" })
- final Iterable<WeavableMethod<?>> result = ((WeavableClass) parent).getMethods();
- return result;
- }
- };
- }
-
- /**
- * Iterate or filter {@link WeavableMethodParameter}s.
- * @return {@link AnnotatedElements}
- */
- public AnnotatedElements<WeavableMethodParameter<?>> getMethodParameters() {
- return new Projection<WeavableMethod<?>, WeavableMethodParameter<?>>(getMethods()) {
-
- @Override
- protected Iterable<WeavableMethodParameter<?>> childrenOf(final WeavableMethod<?> parent) {
- @SuppressWarnings({ "unchecked", "rawtypes" })
- final Iterable<WeavableMethodParameter<?>> result = ((WeavableMethod) parent).getParameters();
- return result;
- }
- };
- }
-
- /**
- * Iterate or filter {@link WeavableConstructorParameter}s.
- * @return {@link AnnotatedElements}
- */
- public AnnotatedElements<WeavableConstructorParameter<?>> getConstructorParameters() {
-
- return new Projection<WeavableConstructor<?>, WeavableConstructorParameter<?>>(getConstructors()) {
-
- @Override
- protected Iterable<WeavableConstructorParameter<?>> childrenOf(final WeavableConstructor<?> parent) {
- @SuppressWarnings({ "unchecked", "rawtypes" })
- final Iterable<WeavableConstructorParameter<?>> result = ((WeavableConstructor) parent).getParameters();
- return result;
- }
- };
- }
-
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/Scanner.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/Scanner.java
deleted file mode 100644
index 23069b6..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/Scanner.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.model;
-
-/**
- * Scanner interface.
- */
-public interface Scanner {
-
- /**
- * Perform the requested scan.
- *
- * @param request to process
- * @return {@link ScanResult}
- */
- ScanResult scan(ScanRequest request);
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/Weavable.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/Weavable.java
deleted file mode 100644
index 5d8ff69..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/Weavable.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.reflect.AnnotatedElement;
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-
-/**
- * {@link Weavable} extends {@link AnnotatedElement} to include
- * {@link RetentionPolicy#CLASS} annotations.
- *
- * @param <SELF> own type
- * @param <TARGET> target type
- */
-public abstract class Weavable<SELF extends Weavable<SELF, TARGET>, TARGET> implements Comparable<SELF>,
- AnnotatedElement {
- private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
-
- private final TARGET target;
- private Set<Annotation> annotations;
-
- /**
- * Create a new {@link Weavable} instance.
- * @param target {@code TARGET}
- */
- protected Weavable(final TARGET target) {
- this.target = target;
- if (target instanceof AnnotatedElement) {
- addAnnotations(((AnnotatedElement) target).getAnnotations());
- }
- }
-
- /**
- * Add one or more annotations.
- * @param toAdd {@link Annotation}[]
- * @return whether any change was made
- */
- public final boolean addAnnotations(final Annotation... toAdd) {
- Validate.noNullElements(toAdd);
- return addAnnotations(Arrays.asList(toAdd));
- }
-
- /**
- * Add annotations from an {@link Iterable}.
- * @param toAdd {@link Iterable} of {@link Annotation}
- * @return whether any change was made
- */
- public final boolean addAnnotations(final Iterable<Annotation> toAdd) {
- if (toAdd == null) {
- return false;
- }
- synchronized (this) {
- if (annotations == null) {
- annotations = new LinkedHashSet<Annotation>();
- }
- boolean result = false;
- for (final Annotation ann : toAdd) {
- if (ann == null) {
- continue;
- }
- result = annotations.add(ann) || result;
- }
- return result;
- }
- }
-
- /**
- * Get the target of this {@link Weavable}.
- * @return {@code TARGET}
- */
- public TARGET getTarget() {
- return target;
- }
-
- /**
- * Get all {@link Annotation}s associated with this element.
- * @return {@link Annotation}[]
- */
- @Override
- public final synchronized Annotation[] getAnnotations() {
- if (annotations == null) {
- return EMPTY_ANNOTATION_ARRAY; //NOPMD - no problem sharing zero-length array
- }
- return annotations.toArray(new Annotation[annotations.size()]);
- }
-
- /**
- * Get any instance of {@code annotationClass} attached to {@link #getTarget()}.
- * @param annotationClass {@link Class} annotation type
- * @param <T> annotation type
- * @return {@code T} instance if available, else {@code null}
- */
- @Override
- public synchronized <T extends Annotation> T getAnnotation(final Class<T> annotationClass) {
- if (annotations == null) {
- return null;
- }
- for (final Annotation prospect : annotations) {
- if (annotationClass.equals(prospect.annotationType())) {
- @SuppressWarnings("unchecked")
- final T result = (T) prospect;
- return result;
- }
- }
- return null;
- }
-
- /**
- * Overridden to return {@link #getAnnotations()}.
- * @return {@link Annotation}[]
- */
- @Override
- public final Annotation[] getDeclaredAnnotations() {
- return getAnnotations();
- }
-
- /**
- * Learn whether an annotation of type {@code annotationClass} is present.
- * @param annotationClass to find
- * @return {@code boolean}
- */
- @Override
- public boolean isAnnotationPresent(final Class<? extends Annotation> annotationClass) {
- return getAnnotation(annotationClass) != null;
- }
-
- /**
- * Return a {@link String} representation of this {@link Weavable}.
- * @return {@link String}
- */
- @Override
- public String toString() {
- return "Weavable " + getTarget().toString();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(final Object obj) {
- if (obj == this) {
- return true;
- }
- if (!getClass().isInstance(obj)) {
- return false;
- }
- return getTarget().equals(((Weavable<?, ?>) obj).getTarget());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(getTarget()).toHashCode();
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableClass.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableClass.java
deleted file mode 100644
index 38f579e..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableClass.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.
- */
-package org.apache.commons.weaver.model;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.concurrent.ConcurrentNavigableMap;
-import java.util.concurrent.ConcurrentSkipListMap;
-
-import org.apache.commons.weaver.utils.Args;
-
-/**
- * {@link Weavable} {@link Class}.
- *
- * @param <T> type
- */
-public class WeavableClass<T> extends NestedWeavable<WeavableClass<T>, Class<T>, WeavablePackage, Package> {
- private final ConcurrentNavigableMap<String, WeavableField<T>> fields =
- new ConcurrentSkipListMap<String, WeavableField<T>>();
-
- private final ConcurrentNavigableMap<Constructor<T>, WeavableConstructor<T>> ctors =
- new ConcurrentSkipListMap<Constructor<T>, WeavableConstructor<T>>(new Comparator<Constructor<?>>() {
-
- @Override
- public int compare(final Constructor<?> ctor1, final Constructor<?> ctor2) {
- return Args.compare(ctor1.getParameterTypes(), ctor2.getParameterTypes());
- }
- });
-
- private final ConcurrentNavigableMap<Method, WeavableMethod<T>> methods =
- new ConcurrentSkipListMap<Method, WeavableMethod<T>>(new Comparator<Method>() {
-
- @Override
- public int compare(final Method methd1, final Method methd2) {
- final int result = methd1.getName().compareTo(methd2.getName());
- return result == 0 ? Args.compare(methd1.getParameterTypes(), methd2.getParameterTypes()) : result;
- }
- });
-
- /**
- * Create a new {@link WeavableClass} instance.
- * @param target {@link Class}
- * @param parent {@link WeavablePackage} enclosing
- */
- public WeavableClass(final Class<T> target, final WeavablePackage parent) {
- super(target, parent);
- }
-
- /**
- * Get a {@link WeavableField} representing {@code fld}.
- * @param fld to wrap
- * @return {@link WeavableField}
- */
- public WeavableField<T> getWeavable(final Field fld) {
- final String key = fld.getName();
- if (fields.containsKey(key)) {
- final WeavableField<T> result = fields.get(key);
- return result;
- }
- final WeavableField<T> result = new WeavableField<T>(fld, this);
- final WeavableField<T> faster = fields.putIfAbsent(key, result);
- return faster == null ? result : faster;
- }
-
- /**
- * Get a {@link WeavableMethod} representing {@code mt}.
- * @param methd to wrap
- * @return {@link WeavableMethod}
- */
- public WeavableMethod<T> getWeavable(final Method methd) {
- if (methods.containsKey(methd)) {
- final WeavableMethod<T> result = methods.get(methd);
- return result;
- }
- final WeavableMethod<T> result = new WeavableMethod<T>(methd, this);
- final WeavableMethod<T> faster = methods.putIfAbsent(methd, result);
- return faster == null ? result : faster;
- }
-
- /**
- * Get a {@link WeavableConstructor} representing {@code ctor}.
- * @param ctor to wrap
- * @return {@link WeavableConstructor}
- */
- public WeavableConstructor<T> getWeavable(final Constructor<T> ctor) {
- if (ctors.containsKey(ctor)) {
- final WeavableConstructor<T> result = ctors.get(ctor);
- return result;
- }
- final WeavableConstructor<T> result = new WeavableConstructor<T>(ctor, this);
- final WeavableConstructor<T> faster = ctors.putIfAbsent(ctor, result);
- return faster == null ? result : faster;
- }
-
- /**
- * Get {@link WeavableField}s of this {@link WeavableClass}.
- * @return {@link Iterable}
- */
- public Iterable<WeavableField<T>> getFields() {
- return Collections.unmodifiableCollection(fields.values());
- }
-
- /**
- * Get {@link WeavableConstructor}s of this {@link WeavableClass}.
- * @return {@link Iterable}
- */
- public Iterable<WeavableConstructor<T>> getConstructors() {
- return Collections.unmodifiableCollection(ctors.values());
- }
-
- /**
- * Get {@link WeavableMethod}s of this {@link WeavableClass}.
- * @return {@link Iterable}
- */
- public Iterable<WeavableMethod<T>> getMethods() {
- return Collections.unmodifiableCollection(methods.values());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected int localCompareTo(final WeavableClass<T> obj) {
- return getTarget().getName().compareTo(obj.getTarget().getName());
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableConstructor.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableConstructor.java
deleted file mode 100644
index 79c1cb0..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableConstructor.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.commons.weaver.model;
-
-import java.lang.reflect.Constructor;
-
-/**
- * {@link Weavable} {@link Constructor}.
- *
- * @param <T> type constructed
- */
-public class WeavableConstructor<T> extends
- WeavableExecutable<WeavableConstructor<T>, Constructor<T>, T, WeavableConstructorParameter<T>> {
-
- /**
- * Create a new {@link WeavableConstructor} instance.
- * @param target {@link Constructor}
- * @param parent enclosing {@link WeavableClass}
- */
- public WeavableConstructor(final Constructor<T> target, final WeavableClass<T> parent) {
- super(target, parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Class<?>[] getParameterTypes() {
- return getTarget().getParameterTypes();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected WeavableConstructorParameter<T> createParameter(final int index) {
- return new WeavableConstructorParameter<T>(Integer.valueOf(index), this);
- }
-
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableConstructorParameter.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableConstructorParameter.java
deleted file mode 100644
index 5ca5cc9..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableConstructorParameter.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.commons.weaver.model;
-
-import java.lang.reflect.Constructor;
-
-/**
- * {@link Weavable} {@link Constructor} parameter.
- *
- * @param <T> constructed type
- */
-public class WeavableConstructorParameter<T> extends
- WeavableParameter<WeavableConstructorParameter<T>, WeavableConstructor<T>, Constructor<T>, T> {
-
- /**
- * Create a new {@link WeavableConstructorParameter} instance.
- * @param target parameter index
- * @param parent declaring {@link WeavableConstructor}
- */
- public WeavableConstructorParameter(final Integer target, final WeavableConstructor<T> parent) {
- super(target, parent);
- }
-
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableExecutable.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableExecutable.java
deleted file mode 100644
index 4a8b90f..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableExecutable.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.model;
-
-import java.lang.reflect.Member;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.weaver.utils.Args;
-
-/**
- * Represents a {@link Weavable} "executable".
- *
- * @param <SELF> own type
- * @param <TARGET> target executable type
- * @param <T> owning type
- * @param <P> parameter type
- */
-public abstract class WeavableExecutable
- <SELF extends WeavableExecutable<SELF, TARGET, T, P>,
- TARGET extends Member,
- T,
- P extends WeavableParameter<P, SELF, TARGET, T>>
- extends NestedWeavable<SELF, TARGET, WeavableClass<T>, Class<T>> {
-
- private final List<P> parameters;
-
- /**
- * Create a new {@link WeavableExecutable} instance.
- * @param target executable
- * @param parent enclosing {@link WeavableClass}
- */
- protected WeavableExecutable(final TARGET target, final WeavableClass<T> parent) {
- super(target, parent);
- final List<P> params = new ArrayList<P>();
- final int paramCount = getParameterTypes().length;
- for (int i = 0; i < paramCount; i++) {
- params.add(createParameter(i));
- }
- parameters = Collections.unmodifiableList(params);
- }
-
- /**
- * Create an appropriate {@link WeavableParameter} object.
- * @param index of parameter
- * @return {@code P}
- */
- protected abstract P createParameter(int index);
-
- /**
- * Get the parameter types of {@link #getTarget()}.
- * @return {@link Class}[]
- */
- protected abstract Class<?>[] getParameterTypes();
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected int localCompareTo(final SELF obj) {
- return Args.compare(getParameterTypes(), obj.getParameterTypes());
- }
-
- /**
- * Get the parameter at the specified index.
- * @param index {@code int}
- * @return {@code P}
- */
- public P getWeavableParameter(final int index) {
- return parameters.get(index);
- }
-
- /**
- * Get the parameters declared by this {@link WeavableExecutable}.
- * @return {@link Iterable} of {@code P}
- */
- public Iterable<P> getParameters() {
- return parameters;
- }
-
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableField.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableField.java
deleted file mode 100644
index 034ed81..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableField.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.commons.weaver.model;
-
-import java.lang.reflect.Field;
-
-/**
- * Represents a {@link Weavable} {@link Field}.
- *
- * @param <T> enclosing type
- */
-public class WeavableField<T> extends NestedWeavable<WeavableField<T>, Field, WeavableClass<T>, Class<T>> {
-
- /**
- * Create a new {@link WeavableField} instance.
- * @param target field
- * @param parent enclosing {@link WeavableClass}
- */
- public WeavableField(final Field target, final WeavableClass<T> parent) {
- super(target, parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected int localCompareTo(final WeavableField<T> obj) {
- return getTarget().getName().compareTo(obj.getTarget().getName());
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableMethod.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableMethod.java
deleted file mode 100644
index eb79dec..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableMethod.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.commons.weaver.model;
-
-import java.lang.reflect.Method;
-
-/**
- * Represents a {@link Weavable} {@link Method}.
- *
- * @param <T> enclosing type
- */
-public class WeavableMethod<T> extends WeavableExecutable<WeavableMethod<T>, Method, T, WeavableMethodParameter<T>> {
-
- /**
- * Create a new {@link WeavableMethod} instance.
- * @param target method
- * @param parent enclosing {@link WeavableClass}
- */
- public WeavableMethod(final Method target, final WeavableClass<T> parent) {
- super(target, parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Class<?>[] getParameterTypes() {
- return getTarget().getParameterTypes();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected int localCompareTo(final WeavableMethod<T> obj) {
- final int result = getTarget().getName().compareTo(obj.getTarget().getName());
- return result == 0 ? super.localCompareTo(obj) : result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected WeavableMethodParameter<T> createParameter(final int index) {
- return new WeavableMethodParameter<T>(Integer.valueOf(index), this);
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableMethodParameter.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableMethodParameter.java
deleted file mode 100644
index 642119a..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableMethodParameter.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.commons.weaver.model;
-
-import java.lang.reflect.Method;
-
-/**
- * {@link Weavable} {@link Method} parameter.
- *
- * @param <T> type of enclosing class
- */
-public class WeavableMethodParameter<T> extends
- WeavableParameter<WeavableMethodParameter<T>, WeavableMethod<T>, Method, T> {
-
- /**
- * Create a new {@link WeavableMethodParameter} instance.
- * @param target index
- * @param parent declaring {@link WeavableMethod}
- */
- public WeavableMethodParameter(final Integer target, final WeavableMethod<T> parent) {
- super(target, parent);
- }
-
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavablePackage.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavablePackage.java
deleted file mode 100644
index 993ac26..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavablePackage.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.commons.weaver.model;
-
-import java.util.Collections;
-import java.util.concurrent.ConcurrentNavigableMap;
-import java.util.concurrent.ConcurrentSkipListMap;
-
-/**
- * {@link Weavable} {@link Package}.
- */
-public class WeavablePackage extends Weavable<WeavablePackage, Package> {
-
- private final ConcurrentNavigableMap<String, WeavableClass<?>> clazzes =
- new ConcurrentSkipListMap<String, WeavableClass<?>>();
-
- /**
- * Create a new {@link WeavablePackage} instance.
- * @param target package
- */
- public WeavablePackage(final Package target) {
- super(target);
- }
-
- /**
- * Get a {@link WeavableClass} representing {@code cls}.
- * @param cls to wrap
- * @param <T> generic type of {@code cls}
- * @return {@link WeavableClass}
- */
- public synchronized <T> WeavableClass<T> getWeavable(final Class<T> cls) {
- final String key = cls.getName();
- if (clazzes.containsKey(key)) {
- @SuppressWarnings("unchecked")
- final WeavableClass<T> result = (WeavableClass<T>) clazzes.get(key);
- return result;
- }
- final WeavableClass<T> result = new WeavableClass<T>(cls, this);
- @SuppressWarnings("unchecked")
- final WeavableClass<T> faster = (WeavableClass<T>) clazzes.putIfAbsent(key, result);
- return faster == null ? result : faster;
- }
-
- /**
- * Get enclosed {@link WeavableClass}es.
- * @return {@link Iterable}
- */
- public Iterable<WeavableClass<?>> getClasses() {
- return Collections.unmodifiableCollection(clazzes.values());
- }
-
- /**
- * Implement {@link Comparable}.
- * @param arg0 {@link WeavablePackage} to compare against
- * @return int per {@link Comparable#compareTo(Object)} contract
- */
- @Override
- public int compareTo(final WeavablePackage arg0) {
- return getTarget().getName().compareTo(arg0.getTarget().getName());
- }
-
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableParameter.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableParameter.java
deleted file mode 100644
index 9ea5659..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeavableParameter.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.commons.weaver.model;
-
-import java.lang.reflect.Member;
-
-/**
- * Represents the parameter of an executable.
- *
- * @param <SELF> own type
- * @param <PARENT> {@link WeavableExecutable} type
- * @param <PARENT_TARGET> target executable of parent
- * @param <T> executable's owning type
- */
-public abstract class WeavableParameter
- <SELF extends WeavableParameter<SELF, PARENT, PARENT_TARGET, T>,
- PARENT extends WeavableExecutable<PARENT, PARENT_TARGET, T, SELF>,
- PARENT_TARGET extends Member,
- T>
- extends NestedWeavable<SELF, Integer, PARENT, PARENT_TARGET> {
-
- /**
- * Create a new {@link WeavableParameter} instance.
- * @param target index
- * @param parent executable
- */
- protected WeavableParameter(final Integer target, final PARENT parent) {
- super(target, parent);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected int localCompareTo(final SELF obj) {
- return getTarget().compareTo(getTarget());
- }
-
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeaveEnvironment.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeaveEnvironment.java
deleted file mode 100644
index e851127..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeaveEnvironment.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.commons.weaver.model;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-import javax.activation.DataSource;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.weaver.spi.Cleaner;
-import org.apache.commons.weaver.spi.Weaver;
-
-/**
- * Encapsulates the environment in which a {@link Weaver} or {@link Cleaner} must operate.
- */
-public abstract class WeaveEnvironment {
- private static final String CONTENT_TYPE = "application/octet-stream";
-
- private class Resource implements DataSource {
- private final String name;
-
- Resource(final String name) {
- this.name = name;
- }
-
- /**
- * Get the content type, always "application/octet-stream".
- * @return {@link String}
- */
- @Override
- public String getContentType() {
- return CONTENT_TYPE;
- }
-
- /**
- * Get an {@link InputStream} for reading this {@link Resource}.
- */
- @Override
- public InputStream getInputStream() throws IOException {
- return classLoader.getResourceAsStream(name);
- }
-
- /**
- * Get the name of this {@link Resource}.
- * @return {@link String}
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Get an {@link OutputStream} for writing to this {@link Resource}.
- * @return {@link OutputStream}
- */
- @Override
- public OutputStream getOutputStream() throws IOException {
- return WeaveEnvironment.this.getOutputStream(name);
- }
- }
-
- /**
- * ClassLoader containing scannable and weavable classes.
- */
- public final ClassLoader classLoader;
-
- /**
- * Configuration properties. By convention, any configuration property should start with its name, e.g.
- * "privilizer".
- */
- public final Properties config;
-
- private final Logger log;
-
- /**
- * Create a new {@link WeaveEnvironment}.
- * @param classLoader property
- * @param config property
- * @param log property
- */
- protected WeaveEnvironment(final ClassLoader classLoader, final Properties config, final Logger log) {
- super();
- this.classLoader = classLoader;
- this.config = (Properties) Validate.notNull(config, "config").clone();
- this.log = log;
- }
-
- /**
- * Handle a debug message.
- * @param message text
- * @param args format
- * @see String#format(String, Object...)
- */
- public void debug(final String message, final Object... args) {
- log.fine(String.format(message, args));
- }
-
- /**
- * Handle a verbose message.
- * @param message text
- * @param args format
- * @see String#format(String, Object...)
- */
- public void verbose(final String message, final Object... args) {
- log.fine(String.format(message, args));
- }
-
- /**
- * Handle a warning message.
- * @param message text
- * @param args format
- * @see String#format(String, Object...)
- */
- public void warn(final String message, final Object... args) {
- log.warning(String.format(message, args));
- }
-
- /**
- * Handle an info message.
- * @param message text
- * @param args format
- * @see String#format(String, Object...)
- */
- public void info(final String message, final Object... args) {
- log.info(String.format(message, args));
- }
-
- /**
- * Handle an error message.
- * @param message text
- * @param args format
- * @see String#format(String, Object...)
- */
- public void error(final String message, final Object... args) {
- log.severe(String.format(message, args));
- }
-
- /**
- * Get a {@link DataSource} representing {@code cls}.
- * @param cls type
- * @return {@link DataSource}
- */
- public final DataSource getClassfile(final Class<?> cls) {
- return getClassfile(cls.getName());
- }
-
- /**
- * Get a {@link DataSource} for the specified class.
- * @param classname of type
- * @return {@link DataSource}
- */
- public final DataSource getClassfile(final String classname) {
- return getResource(getResourceName(classname));
- }
-
- /**
- * Get a {@link DataSource} for the specified resource.
- * @param name of resource
- * @return {@link DataSource}
- */
- public final DataSource getResource(final String name) {
- return new Resource(name);
- }
-
- /**
- * Delete the classfile for {@code cls}.
- * @param cls type
- * @return whether successful
- */
- public final boolean deleteClassfile(final Class<?> cls) {
- return deleteClassfile(cls.getName());
- }
-
- /**
- * Delete the classfile for the specified class.
- * @param classname of type
- * @return whether successful
- */
- public final boolean deleteClassfile(final String classname) {
- return deleteResource(getResourceName(classname));
- }
-
- /**
- * Delete the specified resource.
- * @param name to delete
- * @return whether successful
- */
- public abstract boolean deleteResource(String name);
-
- /**
- * Open an {@link OutputStream} for the specified resource.
- * @param resourceName to open
- * @return {@link OutputStream}
- * @throws IOException on error
- */
- protected abstract OutputStream getOutputStream(String resourceName) throws IOException;
-
- /**
- * Convert a classname into a resource name.
- * @param classname to convert
- * @return String
- */
- protected static String getResourceName(final String classname) {
- return classname.replace('.', '/') + ".class";
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeaveInterest.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeaveInterest.java
deleted file mode 100644
index 6b23fac..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/WeaveInterest.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.commons.weaver.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.ElementType;
-
-/**
- * Weave interest composed of annotation type and target element type.
- */
-public final class WeaveInterest {
-
- /**
- * Observed annotation type.
- */
- public final Class<? extends Annotation> annotationType;
-
- /**
- * Attached element type.
- */
- public final ElementType target;
-
- private WeaveInterest(final Class<? extends Annotation> annotationType, final ElementType target) {
- super();
- this.annotationType = annotationType;
- this.target = target;
- }
-
- /**
- * Get a {@link WeaveInterest}.
- * @param annotationType observed annotation type
- * @param target attached element type
- * @return {@link WeaveInterest}
- */
- public static WeaveInterest of(final Class<? extends Annotation> annotationType, final ElementType target) {
- return new WeaveInterest(annotationType, target);
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/model/package-info.java b/trunk/processor/src/main/java/org/apache/commons/weaver/model/package-info.java
deleted file mode 100644
index 630c424..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/model/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Defines a domain model for weaving operations.
- */
-package org.apache.commons.weaver.model;
\ No newline at end of file
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/package-info.java b/trunk/processor/src/main/java/org/apache/commons/weaver/package-info.java
deleted file mode 100644
index 60bb59a..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Defines the objects needed to perform filesystem-based weaving.
- */
-package org.apache.commons.weaver;
\ No newline at end of file
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/spi/Cleaner.java b/trunk/processor/src/main/java/org/apache/commons/weaver/spi/Cleaner.java
deleted file mode 100644
index edcd29c..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/spi/Cleaner.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.commons.weaver.spi;
-
-import org.apache.commons.weaver.model.Scanner;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-
-/**
- * SPI to provide a means for a weaver module to remove woven classes during
- * incremental builds, if necessary.
- */
-public interface Cleaner {
- /**
- * Using the supplied {@link Scanner}, clean a {@link WeaveEnvironment}.
- * @param environment to use
- * @param scanner to use
- * @return whether any work was done.
- */
- boolean clean(WeaveEnvironment environment, Scanner scanner);
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/spi/Weaver.java b/trunk/processor/src/main/java/org/apache/commons/weaver/spi/Weaver.java
deleted file mode 100644
index db90cea..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/spi/Weaver.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.commons.weaver.spi;
-
-import org.apache.commons.weaver.model.Scanner;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-
-/**
- * A {@link Weaver} implementation performs the byte code enhancement in the
- * classes.
- */
-public interface Weaver {
- /**
- * Using the supplied {@link Scanner}, process a {@link WeaveEnvironment}.
- * @param environment to use
- * @param scanner to use
- * @return whether any work was done.
- */
- boolean process(WeaveEnvironment environment, Scanner scanner);
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/spi/package-info.java b/trunk/processor/src/main/java/org/apache/commons/weaver/spi/package-info.java
deleted file mode 100644
index 68c10fb..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/spi/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Defines the weaver module service provider interface (SPI).
- */
-package org.apache.commons.weaver.spi;
\ No newline at end of file
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/utils/Annotations.java b/trunk/processor/src/main/java/org/apache/commons/weaver/utils/Annotations.java
deleted file mode 100644
index bd7e26c..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/utils/Annotations.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.commons.weaver.utils;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Arrays;
-import java.util.Map;
-
-import org.apache.commons.lang3.AnnotationUtils;
-import org.apache.commons.lang3.Validate;
-
-/**
- * Provide annotation-related utility methods.
- */
-public final class Annotations {
- private Annotations() {
- }
-
- /**
- * Create an annotation instance.
- * @param annotationType type
- * @param elements values
- * @param <A> generic annotation type
- * @return {@code A}
- */
- public static <A extends Annotation> A instanceOf(final Class<A> annotationType, final Map<String, ?> elements) {
- final ClassLoader proxyClassLoader = Validate.notNull(annotationType, "annotationType").getClassLoader();
- final InvocationHandler invocationHandler = new InvocationHandler() {
-
- @Override
- public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
- if (method.getDeclaringClass().equals(annotationType)) {
- if (elements.containsKey(method.getName())) {
- return elements.get(method.getName());
- }
- return method.getDefaultValue();
- }
- if ("annotationType".equals(method.getName()) && method.getParameterTypes().length == 0) {
- return annotationType;
- }
- if ("equals".equals(method.getName())
- && Arrays.equals(method.getParameterTypes(), new Class[] { Object.class })) {
- return AnnotationUtils.equals((Annotation) proxy, (Annotation) args[0]);
- }
- if ("hashCode".equals(method.getName()) && method.getParameterTypes().length == 0) {
- return AnnotationUtils.hashCode((Annotation) proxy);
- }
- if ("toString".equals(method.getName()) && method.getParameterTypes().length == 0) {
- return AnnotationUtils.toString((Annotation) proxy);
- }
- throw new UnsupportedOperationException();
- }
- };
- @SuppressWarnings("unchecked")
- final A result =
- (A) Proxy.newProxyInstance(proxyClassLoader, new Class[] { annotationType }, invocationHandler);
- return result;
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/utils/Args.java b/trunk/processor/src/main/java/org/apache/commons/weaver/utils/Args.java
deleted file mode 100644
index ba0c2f3..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/utils/Args.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.commons.weaver.utils;
-
-/**
- * Argument/Parameter-related utilities.
- */
-public final class Args {
-
- private Args() {
- }
-
- /**
- * Compare two parameter type arrays.
- * @param paramTypes1 lhs
- * @param paramTypes2 rhs
- * @return {@code int} as specified by
- * {@link java.util.Comparator#compare(Object, Object)}
- */
- public static int compare(final Class<?>[] paramTypes1, final Class<?>[] paramTypes2) {
- final int param = 0;
- while (param < paramTypes1.length) {
- if (param >= paramTypes2.length) {
- return 1;
- }
- final int test = paramTypes1[param].getName().compareTo(paramTypes2[param].getName());
- if (test == 0) {
- continue;
- }
- return test;
- }
- if (paramTypes1.length == paramTypes2.length) {
- return 0;
- }
- return -1;
- }
-
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/utils/URLArray.java b/trunk/processor/src/main/java/org/apache/commons/weaver/utils/URLArray.java
deleted file mode 100644
index 5a36acb..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/utils/URLArray.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.commons.weaver.utils;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- * {@link URL} Array utilities.
- */
-public final class URLArray {
- private URLArray() {
- }
-
- /**
- * Convert an {@link Iterable} of filesystem paths.
- * @param files to convert
- * @return URL[]
- */
- public static URL[] fromPaths(final Iterable<String> files) {
- return fromFiles(new Iterable<File>() {
-
- @Override
- public Iterator<File> iterator() {
- final Iterator<String> path = files.iterator();
- return new Iterator<File>() {
-
- @Override
- public boolean hasNext() {
- return path.hasNext();
- }
-
- @Override
- public File next() {
- final String element = path.next();
- return element == null ? null : new File(element);
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
- });
- }
-
- /**
- * Convert an {@link Iterable} of {@link File}s.
- * @param files to convert
- * @return URL[]
- */
- public static URL[] fromFiles(final Iterable<File> files) {
- final ArrayList<URL> result = new ArrayList<URL>();
- for (final File file : files) {
- if (file == null) {
- result.add(null);
- continue;
- }
- try {
- result.add(file.toURI().toURL());
- } catch (final MalformedURLException e) {
- // this shouldn't happen
- throw new RuntimeException(e);
- }
- }
- return result.toArray(new URL[result.size()]);
- }
-}
diff --git a/trunk/processor/src/main/java/org/apache/commons/weaver/utils/package-info.java b/trunk/processor/src/main/java/org/apache/commons/weaver/utils/package-info.java
deleted file mode 100644
index 490bf46..0000000
--- a/trunk/processor/src/main/java/org/apache/commons/weaver/utils/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Provides helpful utility classes.
- */
-package org.apache.commons.weaver.utils;
\ No newline at end of file
diff --git a/trunk/processor/src/site/markdown/index.md b/trunk/processor/src/site/markdown/index.md
deleted file mode 100644
index 84efa25..0000000
--- a/trunk/processor/src/site/markdown/index.md
+++ /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.
--->
-
-## Apache Commons Weaver Processor
-
-This module provides the `org.apache.commons:commons-weaver` artifact.
-It defines the Apache Commons Weaver SPI as well as the basic build-time
-(filesystem-based) processors that detect, configure, and invoke available
-modules.
-
-### WeaveProcessor
-The [WeaveProcessor][wp] invokes available implementations of the
-[Weaver][weaver] SPI.
-
-### CleanProcessor
-The [CleanProcessor][cp] invokes available implementations of the
-[Cleaner][cleaner] SPI.
-
-[cp]: apidocs/org/apache/commons/weaver/CleanProcessor.html
-[wp]: apidocs/org/apache/commons/weaver/WeaveProcessor.html
-[cleaner]: apidocs/org/apache/commons/weaver/spi/Cleaner.html
-[weaver]: apidocs/org/apache/commons/weaver/spi/Weaver.html
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/FinderTest.java b/trunk/processor/src/test/java/org/apache/commons/weaver/FinderTest.java
deleted file mode 100644
index 3037b41..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/FinderTest.java
+++ /dev/null
@@ -1,267 +0,0 @@
-package org.apache.commons.weaver;
-
-import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.CURLY;
-import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.LARRY;
-import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.MOE;
-import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.SHEMP;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.net.URLClassLoader;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.weaver.test.WeaverTestBase;
-import org.apache.commons.weaver.test.beans.AbstractTestBean;
-import org.apache.commons.weaver.test.beans.ComplexAnnotations;
-import org.apache.commons.weaver.test.beans.ComplexAnnotations.NestAnnotation;
-import org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge;
-import org.apache.commons.weaver.test.beans.ComplexAnnotations.TestAnnotation;
-import org.apache.commons.weaver.test.beans.TestBeanInterface;
-import org.apache.commons.weaver.test.beans.TestBeanWithClassAnnotation;
-import org.apache.commons.weaver.test.beans.TestBeanWithMethodAnnotation;
-import org.apache.commons.weaver.utils.URLArray;
-import org.apache.xbean.finder.Annotated;
-import org.apache.xbean.finder.archive.FileArchive;
-import org.junit.Test;
-
-public class FinderTest extends WeaverTestBase {
-
- private Finder finder() {
- final ClassLoader classLoader = new URLClassLoader(URLArray.fromPaths(getClassPathEntries()));
- return new Finder(new FileArchive(classLoader, getTargetFolder()));
- }
-
- /**
- * The point of this is to prove that we can correctly hydate instances of
- * annotations with class retention.
- *
- * @throws IOException
- */
- @Test
- public void testElements() throws IOException {
- addClassForScanning(ComplexAnnotations.class);
- Map<String, Annotated<Field>> fields = new HashMap<String, Annotated<Field>>();
- for (Annotated<Field> annotated : finder().withAnnotations().findAnnotatedFields(
- ComplexAnnotations.TestAnnotation.class)) {
- fields.put(annotated.get().getName(), annotated);
- }
- assertEquals(2, fields.size());
-
- TestAnnotation anno1 = fields.get("dummy1").getAnnotation(TestAnnotation.class);
-
- assertFalse(anno1.booleanValue());
- assertTrue(Arrays.equals(new boolean[] { false }, anno1.booleanValues()));
- assertEquals((byte) 0, anno1.byteValue());
- assertArrayEquals(new byte[] { 0 }, anno1.byteValues());
- assertEquals((char) 0, anno1.charValue());
- assertArrayEquals(new char[] { 0 }, anno1.charValues());
- assertEquals(Double.valueOf(0.0), Double.valueOf(anno1.doubleValue()));
- assertTrue(Arrays.equals(new double[] { 0.0 }, anno1.doubleValues()));
- assertEquals(Float.valueOf(0.0f), Float.valueOf(anno1.floatValue()));
- assertTrue(Arrays.equals(new float[] { 0.0f }, anno1.floatValues()));
- assertEquals(0, anno1.intValue());
- assertArrayEquals(new int[] { 0 }, anno1.intValues());
- assertEquals(0L, anno1.longValue());
- assertArrayEquals(new long[] { 0L }, anno1.longValues());
-
- NestAnnotation nest1 = anno1.nest();
- assertFalse(nest1.booleanValue());
- assertTrue(Arrays.equals(new boolean[] { false }, nest1.booleanValues()));
- assertEquals((byte) 0, nest1.byteValue());
- assertArrayEquals(new byte[] { 0 }, nest1.byteValues());
- assertEquals((char) 0, nest1.charValue());
- assertArrayEquals(new char[] { 0 }, nest1.charValues());
- assertEquals(Double.valueOf(0.0), Double.valueOf(nest1.doubleValue()));
- assertTrue(Arrays.equals(new double[] { 0.0 }, nest1.doubleValues()));
- assertEquals(Float.valueOf(0.0f), Float.valueOf(nest1.floatValue()));
- assertTrue(Arrays.equals(new float[] { 0.0f }, nest1.floatValues()));
- assertEquals(0, nest1.intValue());
- assertArrayEquals(new int[] { 0 }, nest1.intValues());
- assertEquals(0L, nest1.longValue());
- assertArrayEquals(new long[] { 0L }, nest1.longValues());
- assertEquals((short) 0, nest1.shortValue());
- assertArrayEquals(new short[] { 0 }, nest1.shortValues());
- assertSame(CURLY, nest1.stooge());
- assertArrayEquals(new Stooge[] { MOE, LARRY, SHEMP }, nest1.stooges());
- assertEquals("", nest1.string());
- assertArrayEquals(new String[] { "" }, nest1.strings());
- assertEquals(Object.class, nest1.type());
- assertArrayEquals(new Class[] { Object.class }, nest1.types());
-
- assertEquals(1, anno1.nests().length);
- NestAnnotation nest1_0 = anno1.nests()[0];
- assertFalse(nest1_0.booleanValue());
- assertTrue(Arrays.equals(new boolean[] { false }, nest1_0.booleanValues()));
- assertEquals((byte) 0, nest1_0.byteValue());
- assertArrayEquals(new byte[] { 0 }, nest1_0.byteValues());
- assertEquals((char) 0, nest1_0.charValue());
- assertArrayEquals(new char[] { 0 }, nest1_0.charValues());
- assertEquals(Double.valueOf(0.0), Double.valueOf(nest1_0.doubleValue()));
- assertTrue(Arrays.equals(new double[] { 0.0 }, nest1_0.doubleValues()));
- assertEquals(Float.valueOf(0.0f), Float.valueOf(nest1_0.floatValue()));
- assertTrue(Arrays.equals(new float[] { 0.0f }, nest1_0.floatValues()));
- assertEquals(0, nest1_0.intValue());
- assertArrayEquals(new int[] { 0 }, nest1_0.intValues());
- assertEquals(0L, nest1_0.longValue());
- assertArrayEquals(new long[] { 0L }, nest1_0.longValues());
- assertEquals((short) 0, nest1_0.shortValue());
- assertArrayEquals(new short[] { 0 }, nest1_0.shortValues());
- assertSame(CURLY, nest1_0.stooge());
- assertArrayEquals(new Stooge[] { MOE, LARRY, SHEMP }, nest1_0.stooges());
- assertEquals("", nest1_0.string());
- assertArrayEquals(new String[] { "" }, nest1_0.strings());
- assertEquals(Object[].class, nest1_0.type());
- assertArrayEquals(new Class[] { Object[].class }, nest1_0.types());
-
- assertEquals((short) 0, anno1.shortValue());
- assertArrayEquals(new short[] { 0 }, anno1.shortValues());
- assertSame(SHEMP, anno1.stooge());
- assertArrayEquals(new Stooge[] { MOE, LARRY, CURLY }, anno1.stooges());
- assertEquals("", anno1.string());
- assertArrayEquals(new String[] { "" }, anno1.strings());
- assertEquals(Object.class, anno1.type());
- assertArrayEquals(new Class[] { Object.class }, anno1.types());
-
- TestAnnotation anno2 = fields.get("dummy2").getAnnotation(TestAnnotation.class);
- assertFalse(anno2.booleanValue());
- assertTrue(Arrays.equals(new boolean[] { false }, anno2.booleanValues()));
- assertEquals((byte) 0, anno2.byteValue());
- assertArrayEquals(new byte[] { 0 }, anno2.byteValues());
- assertEquals((char) 0, anno2.charValue());
- assertArrayEquals(new char[] { 0 }, anno2.charValues());
- assertEquals(Double.valueOf(0.0), Double.valueOf(anno2.doubleValue()));
- assertTrue(Arrays.equals(new double[] { 0.0 }, anno2.doubleValues()));
- assertEquals(Float.valueOf(0.0f), Float.valueOf(anno2.floatValue()));
- assertTrue(Arrays.equals(new float[] { 0.0f }, anno2.floatValues()));
- assertEquals(0, anno2.intValue());
- assertArrayEquals(new int[] { 0 }, anno2.intValues());
- assertEquals(0L, anno2.longValue());
- assertArrayEquals(new long[] { 0L }, anno2.longValues());
-
- NestAnnotation nest2 = anno2.nest();
- assertFalse(nest2.booleanValue());
- assertTrue(Arrays.equals(new boolean[] { false }, nest2.booleanValues()));
- assertEquals((byte) 0, nest2.byteValue());
- assertArrayEquals(new byte[] { 0 }, nest2.byteValues());
- assertEquals((char) 0, nest2.charValue());
- assertArrayEquals(new char[] { 0 }, nest2.charValues());
- assertEquals(Double.valueOf(0.0), Double.valueOf(nest2.doubleValue()));
- assertTrue(Arrays.equals(new double[] { 0.0 }, nest2.doubleValues()));
- assertEquals(Float.valueOf(0.0f), Float.valueOf(nest2.floatValue()));
- assertTrue(Arrays.equals(new float[] { 0.0f }, nest2.floatValues()));
- assertEquals(0, nest2.intValue());
- assertArrayEquals(new int[] { 0 }, nest2.intValues());
- assertEquals(0L, nest2.longValue());
- assertArrayEquals(new long[] { 0L }, nest2.longValues());
- assertEquals((short) 0, nest2.shortValue());
- assertArrayEquals(new short[] { 0 }, nest2.shortValues());
- assertSame(CURLY, nest2.stooge());
- assertArrayEquals(new Stooge[] { MOE, LARRY, SHEMP }, nest2.stooges());
- assertEquals("", nest2.string());
- assertArrayEquals(new String[] { "" }, nest2.strings());
- assertEquals(Object.class, nest2.type());
- assertArrayEquals(new Class[] { Object.class }, nest2.types());
-
- assertEquals(2, anno2.nests().length);
- NestAnnotation nest2_0 = anno2.nests()[0];
- assertFalse(nest2_0.booleanValue());
- assertTrue(Arrays.equals(new boolean[] { false }, nest2_0.booleanValues()));
- assertEquals((byte) 0, nest2_0.byteValue());
- assertArrayEquals(new byte[] { 0 }, nest2_0.byteValues());
- assertEquals((char) 0, nest2_0.charValue());
- assertArrayEquals(new char[] { 0 }, nest2_0.charValues());
- assertEquals(Double.valueOf(0.0), Double.valueOf(nest2_0.doubleValue()));
- assertTrue(Arrays.equals(new double[] { 0.0 }, nest2_0.doubleValues()));
- assertEquals(Float.valueOf(0.0f), Float.valueOf(nest2_0.floatValue()));
- assertTrue(Arrays.equals(new float[] { 0.0f }, nest2_0.floatValues()));
- assertEquals(0, nest2_0.intValue());
- assertArrayEquals(new int[] { 0 }, nest2_0.intValues());
- assertEquals(0L, nest2_0.longValue());
- assertArrayEquals(new long[] { 0L }, nest2_0.longValues());
- assertEquals((short) 0, nest2_0.shortValue());
- assertArrayEquals(new short[] { 0 }, nest2_0.shortValues());
- assertSame(CURLY, nest2_0.stooge());
- assertArrayEquals(new Stooge[] { MOE, LARRY, SHEMP }, nest2_0.stooges());
- assertEquals("", nest2_0.string());
- assertArrayEquals(new String[] { "" }, nest2_0.strings());
- assertEquals(Object[].class, nest2_0.type());
- assertArrayEquals(new Class[] { Object[].class }, nest2_0.types());
-
- NestAnnotation nest2_1 = anno2.nests()[1];
- assertFalse(nest2_1.booleanValue());
- assertTrue(Arrays.equals(new boolean[] { false }, nest2_1.booleanValues()));
- assertEquals((byte) 0, nest2_1.byteValue());
- assertArrayEquals(new byte[] { 0 }, nest2_1.byteValues());
- assertEquals((char) 0, nest2_1.charValue());
- assertArrayEquals(new char[] { 0 }, nest2_1.charValues());
- assertEquals(Double.valueOf(0.0), Double.valueOf(nest2_1.doubleValue()));
- assertTrue(Arrays.equals(new double[] { 0.0 }, nest2_1.doubleValues()));
- assertEquals(Float.valueOf(0.0f), Float.valueOf(nest2_1.floatValue()));
- assertTrue(Arrays.equals(new float[] { 0.0f }, nest2_1.floatValues()));
- assertEquals(0, nest2_1.intValue());
- assertArrayEquals(new int[] { 0 }, nest2_1.intValues());
- assertEquals(0L, nest2_1.longValue());
- assertArrayEquals(new long[] { 0L }, nest2_1.longValues());
- assertEquals((short) 0, nest2_1.shortValue());
- assertArrayEquals(new short[] { 0 }, nest2_1.shortValues());
- assertSame(CURLY, nest2_1.stooge());
- assertArrayEquals(new Stooge[] { MOE, LARRY, SHEMP }, nest2_1.stooges());
- assertEquals("", nest2_1.string());
- assertArrayEquals(new String[] { "" }, nest2_1.strings());
- assertEquals(Object[].class, nest2_1.type());
- assertArrayEquals(new Class[] { Object[].class }, nest2_1.types());
-
- assertEquals((short) 0, anno2.shortValue());
- assertArrayEquals(new short[] { 0 }, anno2.shortValues());
- assertSame(SHEMP, anno2.stooge());
- assertArrayEquals(new Stooge[] { MOE, LARRY, CURLY }, anno2.stooges());
- assertEquals("", anno2.string());
- assertArrayEquals(new String[] { "" }, anno2.strings());
- assertEquals(Object.class, anno2.type());
- assertArrayEquals(new Class[] { Object.class }, anno2.types());
- }
-
- @Test
- public void testObjectMethods() throws IOException {
- addClassForScanning(ComplexAnnotations.class);
- for (Annotated<Field> annotated : finder().withAnnotations().findAnnotatedFields(
- ComplexAnnotations.TestAnnotation.class)) {
- TestAnnotation anno = annotated.getAnnotation(TestAnnotation.class);
- assertFalse(anno.toString().isEmpty());
- assertFalse(anno.hashCode() == 0);
- assertTrue(anno.equals(anno));
- }
- }
-
- @Test
- public void testFindAssignableTypes() throws IOException {
- addClassForScanning(TestBeanInterface.class);
- addClassForScanning(AbstractTestBean.class);
- addClassForScanning(TestBeanWithClassAnnotation.class);
- addClassForScanning(TestBeanWithMethodAnnotation.class);
-
- final Set<Class<?>> implementors = new HashSet<Class<?>>();
- for (Annotated<Class<?>> annotated : finder().withAnnotations().findAssignableTypes(TestBeanInterface.class)) {
- implementors.add(annotated.get());
- }
- assertEquals(1, implementors.size());
- assertTrue(implementors.contains(TestBeanWithClassAnnotation.class));
-
- final Set<Class<?>> subclasses = new HashSet<Class<?>>();
- for (Annotated<Class<?>> annotated : finder().withAnnotations().findAssignableTypes(AbstractTestBean.class)) {
- subclasses.add(annotated.get());
- }
- assertEquals(2, subclasses.size());
- assertTrue(subclasses.contains(TestBeanWithClassAnnotation.class));
- assertTrue(subclasses.contains(TestBeanWithMethodAnnotation.class));
- }
-}
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/test/CleanProcessorTest.java b/trunk/processor/src/test/java/org/apache/commons/weaver/test/CleanProcessorTest.java
deleted file mode 100644
index 6db0889..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/test/CleanProcessorTest.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.commons.weaver.test;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.apache.commons.weaver.CleanProcessor;
-import org.apache.commons.weaver.test.beans.TestBeanWithClassAnnotation;
-import org.apache.commons.weaver.test.beans.TestBeanWithMethodAnnotation;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Test the {@link CleanProcessor}
- */
-public class CleanProcessorTest extends WeaverTestBase {
-
- @Test
- public void testWeaveVisiting() throws Exception {
- addClassForScanning(TestBeanWithMethodAnnotation.class);
- addClassForScanning(TestBeanWithClassAnnotation.class);
-
- final Properties config = new Properties();
- config.put("configKey", "configValue");
-
- final CleanProcessor cp = new CleanProcessor(getClassPathEntries(), getTargetFolder(), config);
- cp.clean();
-
- Assert.assertFalse(new File(getTargetFolder(), TestBeanWithMethodAnnotation.class.getName().replace('.',
- File.separatorChar)
- + ".class").exists());
- Assert.assertFalse(new File(getTargetFolder(), TestBeanWithClassAnnotation.class.getName().replace('.',
- File.separatorChar)
- + ".class").exists());
- }
-}
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/test/WeaveProcessorTest.java b/trunk/processor/src/test/java/org/apache/commons/weaver/test/WeaveProcessorTest.java
deleted file mode 100644
index cae41fb..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/test/WeaveProcessorTest.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.commons.weaver.test;
-
-import java.util.Arrays;
-import java.util.Properties;
-
-import org.apache.commons.weaver.test.beans.TestBeanWithClassAnnotation;
-import org.apache.commons.weaver.test.beans.TestBeanWithMethodAnnotation;
-import org.apache.commons.weaver.test.weaver.TestWeaver;
-import org.apache.commons.weaver.WeaveProcessor;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Test the {@link WeaveProcessor}
- */
-public class WeaveProcessorTest extends WeaverTestBase {
-
- @Test
- public void testWeaveVisiting() throws Exception {
- addClassForScanning(TestBeanWithMethodAnnotation.class);
- addClassForScanning(TestBeanWithClassAnnotation.class);
-
- final Properties config = new Properties();
- config.put("configKey", "configValue");
-
- WeaveProcessor wp = new WeaveProcessor(getClassPathEntries(), getTargetFolder(), config);
-
- TestWeaver.wovenClasses.clear();
- TestWeaver.wovenMethods.clear();
-
- wp.weave();
-
- Assert.assertEquals(1, TestWeaver.wovenClasses.size());
- Assert.assertEquals(TestBeanWithClassAnnotation.class, TestWeaver.wovenClasses.get(0));
-
- Assert.assertEquals(1, TestWeaver.wovenMethods.size());
- Assert.assertEquals(TestBeanWithMethodAnnotation.class, TestWeaver.wovenMethods.get(0).getDeclaringClass());
-
- Assert.assertEquals(1, TestWeaver.implementors.size());
- Assert.assertEquals(TestBeanWithClassAnnotation.class, TestWeaver.implementors.get(0));
-
- Assert.assertEquals(2, TestWeaver.subclasses.size());
- Assert.assertTrue(TestWeaver.subclasses.containsAll(Arrays.<Class<?>> asList(
- TestBeanWithClassAnnotation.class, TestBeanWithMethodAnnotation.class)));
- }
-}
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/test/WeaverTestBase.java b/trunk/processor/src/test/java/org/apache/commons/weaver/test/WeaverTestBase.java
deleted file mode 100644
index e2e2cb1..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/test/WeaverTestBase.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.test;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
-
-/**
- * Base class for Weaver tests.
- */
-public abstract class WeaverTestBase {
-
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- private File targetFolder;
-
- private List<String> classPathEntries;
-
- private static final String TARGET_FOLDER = "target";
-
- public void cleanup() {
- targetFolder = null;
- }
-
- /**
- * Add a class (and its inner classes) to the temporary folder.
- *
- * @param clazz
- */
- protected void addClassForScanning(Class<?> clazz) throws IOException {
- String clazzDirName = clazz.getPackage().getName().replace(".", "/");
- File targetDirFile = new File(getTargetFolder(), clazzDirName);
- targetDirFile.mkdirs();
-
- String fileName = baseName(clazz) + ".class";
- String clazzFileName = clazzDirName + "/" + fileName;
- URL clazzUrl = getClass().getClassLoader().getResource(clazzFileName);
- File targetClazzFile = new File(targetDirFile, fileName);
-
- byte[] buffer = new byte[0xFFFF];
-
- FileOutputStream fos = new FileOutputStream(targetClazzFile);
-
- InputStream inputStream = clazzUrl.openStream();
- int len;
- while ((len = inputStream.read(buffer)) > 0) {
- fos.write(buffer, 0, len);
- }
- fos.flush();
- fos.close();
-
- for (Class<?> inner : clazz.getClasses()) {
- addClassForScanning(inner);
- }
- }
-
- private String baseName(Class<?> clazz) {
- if (clazz.getDeclaringClass() == null) {
- return clazz.getSimpleName();
- }
- final StringBuilder result = new StringBuilder();
- Class<?> current = clazz;
- while (current != null) {
- if (result.length() > 0) {
- result.insert(0, '$');
- }
- result.insert(0, current.getSimpleName());
- current = current.getDeclaringClass();
- }
- return result.toString();
- }
-
- /**
- * Resolves the 'target' folder where the classes should get placed
- */
- protected File getTargetFolder() {
- if (targetFolder == null) {
- targetFolder = new File(temporaryFolder.getRoot(), TARGET_FOLDER);
- }
- return targetFolder;
- }
-
- protected List<String> getClassPathEntries() {
- if (classPathEntries == null) {
- classPathEntries = new ArrayList<String>(1);
- try {
- classPathEntries.add(getTargetFolder().getCanonicalPath());
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- }
-
- return classPathEntries;
- }
-
-}
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/AbstractTestBean.java b/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/AbstractTestBean.java
deleted file mode 100644
index 4159ddf..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/AbstractTestBean.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.test.beans;
-
-public abstract class AbstractTestBean {
-
-}
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/ComplexAnnotations.java b/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/ComplexAnnotations.java
deleted file mode 100644
index c6e8b0f..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/ComplexAnnotations.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.commons.weaver.test.beans;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.CURLY;
-import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.LARRY;
-import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.MOE;
-import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.SHEMP;
-
-import java.lang.annotation.Target;
-
-public class ComplexAnnotations {
- @TestAnnotation(
- booleanValue = false,
- booleanValues = { false },
- byteValue = 0,
- byteValues = { 0 },
- charValue = 0,
- charValues = { 0 },
- doubleValue = 0,
- doubleValues = { 0 },
- floatValue = 0,
- floatValues = { 0 },
- intValue = 0,
- intValues = { 0 },
- longValue = 0,
- longValues = { 0 },
- nest = @NestAnnotation(
- booleanValue = false,
- booleanValues = { false },
- byteValue = 0,
- byteValues = { 0 },
- charValue = 0,
- charValues = { 0 },
- doubleValue = 0,
- doubleValues = { 0 },
- floatValue = 0,
- floatValues = { 0 },
- intValue = 0,
- intValues = { 0 },
- longValue = 0,
- longValues = { 0 },
- shortValue = 0,
- shortValues = { 0 },
- stooge = CURLY,
- stooges = { MOE, LARRY, SHEMP },
- string = "",
- strings = { "" },
- type = Object.class,
- types = { Object.class }
- ),
- nests = {
- @NestAnnotation(
- booleanValue = false,
- booleanValues = { false },
- byteValue = 0,
- byteValues = { 0 },
- charValue = 0,
- charValues = { 0 },
- doubleValue = 0,
- doubleValues = { 0 },
- floatValue = 0,
- floatValues = { 0 },
- intValue = 0,
- intValues = { 0 },
- longValue = 0,
- longValues = { 0 },
- shortValue = 0,
- shortValues = { 0 },
- stooge = CURLY,
- stooges = { MOE, LARRY, SHEMP },
- string = "",
- strings = { "" },
- type = Object[].class,
- types = { Object[].class }
- )
- },
- shortValue = 0,
- shortValues = { 0 },
- stooge = SHEMP,
- stooges = { MOE, LARRY, CURLY },
- string = "",
- strings = { "" },
- type = Object.class,
- types = { Object.class }
- )
- public Object dummy1;
-
- @TestAnnotation(
- booleanValue = false,
- booleanValues = { false },
- byteValue = 0,
- byteValues = { 0 },
- charValue = 0,
- charValues = { 0 },
- doubleValue = 0,
- doubleValues = { 0 },
- floatValue = 0,
- floatValues = { 0 },
- intValue = 0,
- intValues = { 0 },
- longValue = 0,
- longValues = { 0 },
- nest = @NestAnnotation(
- booleanValue = false,
- booleanValues = { false },
- byteValue = 0,
- byteValues = { 0 },
- charValue = 0,
- charValues = { 0 },
- doubleValue = 0,
- doubleValues = { 0 },
- floatValue = 0,
- floatValues = { 0 },
- intValue = 0,
- intValues = { 0 },
- longValue = 0,
- longValues = { 0 },
- shortValue = 0,
- shortValues = { 0 },
- stooge = CURLY,
- stooges = { MOE, LARRY, SHEMP },
- string = "",
- strings = { "" },
- type = Object.class,
- types = { Object.class }
- ),
- nests = {
- @NestAnnotation(
- booleanValue = false,
- booleanValues = { false },
- byteValue = 0,
- byteValues = { 0 },
- charValue = 0,
- charValues = { 0 },
- doubleValue = 0,
- doubleValues = { 0 },
- floatValue = 0,
- floatValues = { 0 },
- intValue = 0,
- intValues = { 0 },
- longValue = 0,
- longValues = { 0 },
- shortValue = 0,
- shortValues = { 0 },
- stooge = CURLY,
- stooges = { MOE, LARRY, SHEMP },
- string = "",
- strings = { "" },
- type = Object[].class,
- types = { Object[].class }
- ),
- //add a second NestAnnotation:
- @NestAnnotation(
- booleanValue = false,
- booleanValues = { false },
- byteValue = 0,
- byteValues = { 0 },
- charValue = 0,
- charValues = { 0 },
- doubleValue = 0,
- doubleValues = { 0 },
- floatValue = 0,
- floatValues = { 0 },
- intValue = 0,
- intValues = { 0 },
- longValue = 0,
- longValues = { 0 },
- shortValue = 0,
- shortValues = { 0 },
- stooge = CURLY,
- stooges = { MOE, LARRY, SHEMP },
- string = "",
- strings = { "" },
- type = Object[].class,
- types = { Object[].class }
- )
- },
- shortValue = 0,
- shortValues = { 0 },
- stooge = SHEMP,
- stooges = { MOE, LARRY, CURLY },
- string = "",
- strings = { "" },
- type = Object.class,
- types = { Object.class }
- )
- public Object dummy2;
-
- @Target(FIELD)
- public @interface TestAnnotation {
- String string();
- String[] strings();
- Class<?> type();
- Class<?>[] types();
- byte byteValue();
- byte[] byteValues();
- short shortValue();
- short[] shortValues();
- int intValue();
- int[] intValues();
- char charValue();
- char[] charValues();
- long longValue();
- long[] longValues();
- float floatValue();
- float[] floatValues();
- double doubleValue();
- double[] doubleValues();
- boolean booleanValue();
- boolean[] booleanValues();
- Stooge stooge();
- Stooge[] stooges();
- NestAnnotation nest();
- NestAnnotation[] nests();
- }
-
- public @interface NestAnnotation {
- String string();
- String[] strings();
- Class<?> type();
- Class<?>[] types();
- byte byteValue();
- byte[] byteValues();
- short shortValue();
- short[] shortValues();
- int intValue();
- int[] intValues();
- char charValue();
- char[] charValues();
- long longValue();
- long[] longValues();
- float floatValue();
- float[] floatValues();
- double doubleValue();
- double[] doubleValues();
- boolean booleanValue();
- boolean[] booleanValues();
- Stooge stooge();
- Stooge[] stooges();
- }
-
- public static enum Stooge {
- MOE, LARRY, CURLY, SHEMP, JOE;
- }
-
-}
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestAnnotation.java b/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestAnnotation.java
deleted file mode 100644
index 7a959a0..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestAnnotation.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.commons.weaver.test.beans;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Test marker annotation to test the scanning
- */
-@Target({ElementType.METHOD, ElementType.TYPE})
-@Retention(RetentionPolicy.CLASS)
-public @interface TestAnnotation {
-}
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestBeanInterface.java b/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestBeanInterface.java
deleted file mode 100644
index 0f8e475..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestBeanInterface.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.commons.weaver.test.beans;
-
-public interface TestBeanInterface {
-
-}
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestBeanWithClassAnnotation.java b/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestBeanWithClassAnnotation.java
deleted file mode 100644
index d7808a5..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestBeanWithClassAnnotation.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.commons.weaver.test.beans;
-
-/**
- * Simple test bean
- */
-@TestAnnotation
-public class TestBeanWithClassAnnotation extends AbstractTestBean implements TestBeanInterface {
- @SuppressWarnings("unused")
- private int someMethod() {
- return 42;
- }
-}
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestBeanWithMethodAnnotation.java b/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestBeanWithMethodAnnotation.java
deleted file mode 100644
index 4b70c9e..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/test/beans/TestBeanWithMethodAnnotation.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.
- */
-package org.apache.commons.weaver.test.beans;
-
-/**
- * Simple test bean
- */
-public class TestBeanWithMethodAnnotation extends AbstractTestBean {
- @TestAnnotation
- private int annotatedMethod() {
- return 42;
- }
-
- @SuppressWarnings("unused")
- private int nonAnnotatedMethod() {
- return 21;
- }
-}
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/test/weaver/TestCleaner.java b/trunk/processor/src/test/java/org/apache/commons/weaver/test/weaver/TestCleaner.java
deleted file mode 100644
index 894d1af..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/test/weaver/TestCleaner.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.commons.weaver.test.weaver;
-
-import java.lang.annotation.ElementType;
-
-import org.apache.commons.weaver.model.ScanRequest;
-import org.apache.commons.weaver.model.Scanner;
-import org.apache.commons.weaver.model.WeavableClass;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-import org.apache.commons.weaver.model.WeaveInterest;
-import org.apache.commons.weaver.spi.Cleaner;
-import org.apache.commons.weaver.test.beans.TestAnnotation;
-
-public class TestCleaner implements Cleaner {
-
- @Override
- public boolean clean(WeaveEnvironment environment, Scanner scanner) {
- boolean result = false;
-
- final ScanRequest scanRequest =
- new ScanRequest().add(WeaveInterest.of(TestAnnotation.class, ElementType.TYPE)).add(
- WeaveInterest.of(TestAnnotation.class, ElementType.METHOD));
-
- for (WeavableClass<?> weavableClass : scanner.scan(scanRequest).getClasses()) {
- if (environment.deleteClassfile(weavableClass.getTarget())) {
- result = true;
- } else {
- break;
- }
- }
- return result;
- }
-
-}
diff --git a/trunk/processor/src/test/java/org/apache/commons/weaver/test/weaver/TestWeaver.java b/trunk/processor/src/test/java/org/apache/commons/weaver/test/weaver/TestWeaver.java
deleted file mode 100644
index 8295ecc..0000000
--- a/trunk/processor/src/test/java/org/apache/commons/weaver/test/weaver/TestWeaver.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.commons.weaver.test.weaver;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.weaver.model.ScanRequest;
-import org.apache.commons.weaver.model.ScanResult;
-import org.apache.commons.weaver.model.Scanner;
-import org.apache.commons.weaver.model.WeavableClass;
-import org.apache.commons.weaver.model.WeavableMethod;
-import org.apache.commons.weaver.model.WeaveEnvironment;
-import org.apache.commons.weaver.model.WeaveInterest;
-import org.apache.commons.weaver.spi.Weaver;
-import org.apache.commons.weaver.test.beans.AbstractTestBean;
-import org.apache.commons.weaver.test.beans.TestAnnotation;
-import org.apache.commons.weaver.test.beans.TestBeanInterface;
-import org.junit.Assert;
-
-/**
- *
- */
-public class TestWeaver implements Weaver {
- public static List<Method> wovenMethods = new ArrayList<Method>();
- public static List<Class<?>> wovenClasses = new ArrayList<Class<?>>();
- public static List<Class<?>> implementors = new ArrayList<Class<?>>();
- public static List<Class<?>> subclasses = new ArrayList<Class<?>>();
-
- @Override
- public boolean process(WeaveEnvironment environment, Scanner scanner) {
- Assert.assertNotNull(environment.config);
- Assert.assertEquals(1, environment.config.size());
-
- String configValue = environment.config.getProperty("configKey");
-
- Assert.assertEquals("configValue", configValue);
- boolean result = false;
-
- final ScanRequest scanRequest =
- new ScanRequest().add(WeaveInterest.of(TestAnnotation.class, ElementType.TYPE))
- .add(WeaveInterest.of(TestAnnotation.class, ElementType.METHOD))
- .addSupertypes(AbstractTestBean.class, TestBeanInterface.class);
-
- final ScanResult scanResult = scanner.scan(scanRequest);
-
- for (WeavableClass<?> weavableClass : scanResult.getClasses().with(TestAnnotation.class)) {
- if (wovenClasses.add(weavableClass.getTarget())) {
- result = true;
- }
- }
- for (WeavableMethod<?> weavableMethod : scanResult.getMethods().with(TestAnnotation.class)) {
- if (wovenMethods.add(weavableMethod.getTarget())) {
- result = true;
- }
- }
- for (WeavableClass<?> weavableClass : scanResult.getClassesAssignableTo(TestBeanInterface.class)) {
- if (implementors.add(weavableClass.getTarget())) {
- result = true;
- }
- }
- for (WeavableClass<?> weavableClass : scanResult.getClassesAssignableTo(AbstractTestBean.class)) {
- if (subclasses.add(weavableClass.getTarget())) {
- result = true;
- }
- }
- return result;
- }
-
-}
diff --git a/trunk/processor/src/test/resources/META-INF/services/org.apache.commons.weaver.spi.Cleaner b/trunk/processor/src/test/resources/META-INF/services/org.apache.commons.weaver.spi.Cleaner
deleted file mode 100644
index 5fafbc4..0000000
--- a/trunk/processor/src/test/resources/META-INF/services/org.apache.commons.weaver.spi.Cleaner
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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 class gets picked up by the CleanProcessor
-org.apache.commons.weaver.test.weaver.TestCleaner
diff --git a/trunk/processor/src/test/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver b/trunk/processor/src/test/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver
deleted file mode 100644
index c9e19ef..0000000
--- a/trunk/processor/src/test/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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 class gets picked up by the WeaveProcessor
-org.apache.commons.weaver.test.weaver.TestWeaver
diff --git a/trunk/src/changes/changes.xml b/trunk/src/changes/changes.xml
deleted file mode 100644
index 7f3dbad..0000000
--- a/trunk/src/changes/changes.xml
+++ /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.
- -->
-<document xmlns="http://maven.apache.org/changes/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd">
- <properties>
- <title>Apache Commons Weaver Changes</title>
- <author email="mbenson@apache.org">Matt Benson</author>
- </properties>
- <body>
- <release version="1.0" date="2014-03-03" description="Initial release" />
- </body>
-</document>
diff --git a/trunk/src/changes/release-notes.vm b/trunk/src/changes/release-notes.vm
deleted file mode 100644
index a94a43c..0000000
--- a/trunk/src/changes/release-notes.vm
+++ /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.
-##
- Apache Commons Weaver ${version}
- RELEASE NOTES
-
-The Apache Commons team is pleased to announce the release of Apache Commons Weaver ${version}
-
-$introduction.replaceAll("(?<!\015)\012", "
-").replaceAll("(?m)^ +","")
-
-## N.B. the available variables are described here:
-## http://maven.apache.org/plugins/maven-changes-plugin/examples/using-a-custom-announcement-template.html
-##
-## Hack to improve layout: replace all pairs of spaces with a single new-line
-$release.description.replaceAll(" ", "
-")
-
-## set up indent sizes. Only change indent1
-#set($props=${project.properties})
-#set($jiralen=$props.get("commons.jira.id").length())
-## indent1 = POOL-nnnn:
-#set($blanklen=$jiralen+6)## +6 for "-nnnn:"
-## must be at least as long as the longest JIRA id
-#set($blanks=" ")
-#set($indent1=$blanks.substring(0,$blanklen))
-## indent2 allows for issue wrapper
-#set($indent2="$indent1 ")
-##
-#macro ( processaction )
-## Use replaceAll to fix up LF-only line ends on Windows.
-#set($action=$actionItem.getAction().replaceAll("\n","
-"))
-## Replace < with < so can embed tag markup
-#set($action=$action.replaceAll("<","<"))
-## use an empty date to mean don't format the entry
-## TODO how to enable leading spaces without compromising html report
-## unfortunately leading spaces are trimmed even from CDATA sections
-#if ($actionItem.getDate() && $actionItem.getDate().length()==0)
-$action
-#else
-## Fix up indentation for multi-line action descriptions
-#set($action=$action.replaceAll("(?m)^ +",$indent2))
-#if ($actionItem.getIssue())
-#set($issue="$actionItem.getIssue():")
-## Pad shorter issue numbers
-#if ($issue.length() < $indent1.length())#set ($issue="$issue ")#end
-#if ($issue.length() < $indent1.length())#set ($issue="$issue ")#end
-#if ($issue.length() < $indent1.length())#set ($issue="$issue ")#end
-#else
-#set($issue=$indent1)
-#end
-#if ($actionItem.getDueTo())
-#set($dueto=" Thanks to $actionItem.getDueTo().")
-#else
-#set($dueto="")
-#end
-o $issue ${action}$dueto
-#end
-#set($action="")
-#set($issue="")
-#set($dueto="")
-#end
-##
-#if ($release.getActions().size() == 0)
-No changes defined in this version.
-#else
-Changes in this version include:
-
-#if ($release.getActions('add').size() !=0)
-New features:
-#foreach($actionItem in $release.getActions('add'))
-#processaction()
-#end
-
-#end
-##
-#if ($release.getActions('fix').size() !=0)
-Fixed Bugs:
-#foreach($actionItem in $release.getActions('fix'))
-#processaction()
-#end
-
-#end
-##
-#if ($release.getActions('update').size() !=0)
-Changes:
-#foreach($actionItem in $release.getActions('update'))
-#processaction()
-#end
-
-#end
-##
-#if ($release.getActions('remove').size() !=0)
-Removed:
-#foreach($actionItem in $release.getActions('remove'))
-#processaction()
-#end
-#end
-## End of main loop
-#end
-
-Historical list of changes: ${project.url}changes-report.html
-
-For complete information on ${project.name}, including instructions on how to submit bug reports,
-patches, or suggestions for improvement, see the Apache ${project.name} website:
-
-${project.url}
diff --git a/trunk/src/site/markdown/building.md b/trunk/src/site/markdown/building.md
deleted file mode 100644
index 53c1213..0000000
--- a/trunk/src/site/markdown/building.md
+++ /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.
--->
-
-Apache Maven 3 is required to build Apache Commons Weaver. Things to know:
-
-### Self-referential multimodule build
-Commons Weaver provides a Maven plugin as one of its submodules; the plugin
-is itself required by the modules which demonstrate the provided "weaver
-modules." This means that Commons Weaver requires, at minimum, the
-`package` phase to be specified when building the project. This makes the
-various modules visible to one another using the Maven reactor, detailed
-[here](http://maven.apache.org/guides/mini/guide-multiple-modules.html).
-Without installing to your local Maven repository, however, certain items
-will always fail; e.g. `mvn clean` without `package`, `mvn dependency:list`,
-`mvn dependency:tree`, and probably others. In general, `mvn install` will
-avoid further surprises down the line.
-
-### Testing with security enabled
-The Privilizer is the fundamental "guinea pig" weaver module.
-Since the whole point of the Privilizer relates to Java security, it is only
-natural that its tests be executable with Java security enabled. It is also
-reasonable to test without security enabled, to show that your code works as
-always. The `example` and `ant/test` modules each have a `sec` profile defined;
-You can run their tests with this profile enabled to turn on Java security.
-
-### Antlib Test module
-Located at `ant/test`, this module\'s tests are implemented by unpacking the
-source of the `example` module and reusing it. For this reason, the
-`example` module must have been packaged previously to executing the `ant/test`
-tests, so in a multimodule build you should at least specify the `package`
-phase of the default lifecycle. Alternatively, you can disable this module\'s
-tests by deactivating the profile in which they are set up: `antlib-test`.
-
-Similarly, when building the project site you should deactivate the
-`antlib-test` profile, to stop this module\'s tests from requiring the
-`example` module to have been previously packaged.
diff --git a/trunk/src/site/markdown/index.md b/trunk/src/site/markdown/index.md
deleted file mode 100644
index d62722d..0000000
--- a/trunk/src/site/markdown/index.md
+++ /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.
--->
-
-# Apache Commons Weaver
-
-## What is this thing?
-Occasionally, as Java developers, we encounter a problem whose solution
-simply cannot be expressed in the Java language. Often, the Java annotation
-processing tools can be used to great effect, and they should not be
-dismissed as your first line of defense when you need to generate additional
-classes. Occasionally, however, our only recourse is to manipulate existing
-class files. It is these situations which Apache Commons Weaver was designed
-to address.
-
-Apache Commons Weaver consists of:
-
-## Core Framework
-The [Commons Weaver Processor](commons-weaver-processor/index.html)
-defines a "weaver module" service provider interface (SPI) as well as
-the facilities that use the Java `ServiceLoader` to discover and invoke
-defined weaver modules for simple filesystem-based bytecode weaving.
-
-## Weaver Modules
-A number of [Weaver Modules](commons-weaver-modules-parent/index.html)
-are provided by the Commons Weaver project.
-Typically a weaver module may respect a set of configuration
-properties which should be documented along with that module.
-
-### What can these do for me?
-The canonical example is the [privilizer module](commons-weaver-modules-parent/commons-weaver-privilizer-parent/index.html).
-
-## Integration
-The weaver module(s) applicable to your codebase should be available
-on the classpath of whatever Java-based processing mechanism you select.
-Your responsibilities are to:
-
- - trigger weave processing in some way
- - make the desired weaver module(s) available for processing
- - (optionally) provide configuration properties for applicable modules
-
-There are two provided mechanisms for invoking Weaving facilities:
-
-### Maven Plugin
-The [Commons Weaver plugin for Apache Maven][mvnplugin] aims to integrate
-Weaver as smoothly as possible for Maven users. Here is an example
-of configuring the `privilizer` module:
-
- <plugin>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-maven-plugin</artifactId>
- <version>${commons.weaver.version}</version>
- <configuration>
- <weaverConfig>
- <privilizer.accessLevel>${privilizer.accessLevel}</privilizer.accessLevel>
- <privilizer.policy>${privilizer.policy}</privilizer.policy>
- <privilizer.verify>${privilizer.verify}</privilizer.verify>
- </weaverConfig>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>prepare</goal>
- <goal>weave</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer-api</artifactId>
- <version>${commons.weaver.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-weaver-privilizer</artifactId>
- <version>${commons.weaver.version}</version>
- </dependency>
- </dependencies>
- </plugin>
-
-### Antlib
-The [Commons Weaver Antlib][antlib] provides tasks and types to
-facilitate the integration of Commons Weaver into your Apache Ant-based
-build process. Here the user will make the `commons-weaver-antlib` `jar`
-(which includes the Apache Commons Weaver processor and its dependencies),
-along with the `jar` files of the desired modules, available to
-the Ant build using one of the various mechanisms supported. More
-information on this is available [here][antxt]. Having done this the
-basic approach will be to parameterize one of the provided tasks
-(`clean`|`weave`) with a `settings` element. If both `weave` and `clean`
-tasks are used, defining a [reference][antref] to the `settings` object
-and referencing it using the `settingsref` attribute is recommended, as
-seen here:
-
- <settings id="weavesettings"
- target="target/classes"
- classpathref="maincp">
- <properties>
- <privilizer.accessLevel>${privilizer.accessLevel}</privilizer.accessLevel>
- <privilizer.policy>${privilizer.policy}</privilizer.policy>
- <privilizer.verify>${privilizer.verify}</privilizer.verify>
- </properties>
- </settings>
-
- <clean settingsref="weavesettings" />
- <weave settingsref="weavesettings" />
-
-Multiple weaving targets (e.g. `main` vs. `test`) are of course woven
-using different `settings`.
-
-## Custom Weaver Modules
-As discussed, some modules are provided for common cases, and the developers
-welcome suggestions for useful modules, but there is no reason not to get
-started writing your own weaver module (assuming you are sure this is the right
-solution, or just want to do this for fun) now! When the processor framework
-invokes your custom `Weaver`, it will pass in a `Scanner` that can be used to
-find the classes you are interested in. Request the original bytecode from the
-`WeaveEnvironment` and make your changes (for this task you will save time and
-frustration using one of the available open source Java bytecode manipulation
-libraries). Save your changes back to the `WeaveEnvironment`. Rinse, repeat.
-Hint: if your `Weaver` uses configuration parameters to dictate its
-behavior, it can leave a scannable "footprint" in your woven classes. Then
-implement the `Cleaner` SPI to find and delete these in the case that the
-current configuration is incompatible with the results of an earlier "weaving."
-
-##FAQ
-
-* *Q*: Why not just use [AspectJ](http://eclipse.org/aspectj/)?
-
- *A*: The original motivation to develop the codebase that evolved into
- Commons Weaver instead of simply using AspectJ was to avoid the
- runtime dependency, however small, introduced by the use of AspectJ.
- Additionally, later versions of AspectJ are licensed under the
- [EPL](http://eclipse.org/legal/epl-v10.html) which can be
- considered less permissive than the Apache license. Choice is
- A Good Thing.
-
-[mvnplugin]: commons-weaver-maven-plugin/plugin-info.html
-[antlib]: commons-weaver-antlib-parent/commons-weaver-antlib/index.html
-[antxt]: http://ant.apache.org/manual/using.html#external-tasks
-[antref]: http://ant.apache.org/manual/using.html#references
diff --git a/trunk/src/site/resources/images/weaver-logo-white.png b/trunk/src/site/resources/images/weaver-logo-white.png
deleted file mode 100644
index 690b921..0000000
--- a/trunk/src/site/resources/images/weaver-logo-white.png
+++ /dev/null
Binary files differ
diff --git a/trunk/src/site/resources/images/weaver-logo-white.xcf b/trunk/src/site/resources/images/weaver-logo-white.xcf
deleted file mode 100644
index 3ebaf2b..0000000
--- a/trunk/src/site/resources/images/weaver-logo-white.xcf
+++ /dev/null
Binary files differ
diff --git a/trunk/src/site/site.xml b/trunk/src/site/site.xml
deleted file mode 100644
index e6a290c..0000000
--- a/trunk/src/site/site.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project name="Commons Weaver">
- <bannerRight>
- <name>Commons Weaver</name>
- <src>/images/weaver-logo-white.png</src>
- <href>/index.html</href>
- </bannerRight>
- <body>
- <menu name="Commons Weaver">
- <item name="Overview" href="/index.html"/>
- <item name="Javadoc" href="apidocs/index.html"/>
- <item name="Mailing lists" href="/mail-lists.html"/>
- <item name="Issue Tracking" href="/issue-tracking.html"/>
- </menu>
- <menu name="Development">
- <item name="Team" href="/team-list.html"/>
- <item name="SVN" href="/source-repository.html"/>
- <item name="Building" href="/building.html"/>
- </menu>
- </body>
-</project>
diff --git a/trunk/src/site/xdoc/download_weaver.xml b/trunk/src/site/xdoc/download_weaver.xml
deleted file mode 100644
index fc8484c..0000000
--- a/trunk/src/site/xdoc/download_weaver.xml
+++ /dev/null
@@ -1,138 +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 IS GENERATED BY THE COMMONS BUILD PLUGIN ****|
- |**** DO NOT EDIT DIRECTLY ****|
- |**** ****|
- +======================================================================+
- | TEMPLATE FILE: download-page-template.xml |
- | commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
- +======================================================================+
- | |
- | 1) Re-generate using: mvn commons:download-page |
- | |
- | 2) Set the following properties in the component's pom: |
- | - commons.componentid (required, alphabetic, lower case) |
- | - commons.release.version (required) |
- | - commons.binary.suffix (optional) |
- | (defaults to "-bin", set to "" for pre-maven2 releases) |
- | |
- | 3) Example Properties |
- | |
- | <properties> |
- | <commons.componentid>math</commons.componentid> |
- | <commons.release.version>1.2</commons.release.version> |
- | </properties> |
- | |
- +======================================================================+
--->
-<document>
- <properties>
- <title>Download Apache Commons Weaver Parent POM</title>
- <author email="dev@commons.apache.org">Commons Documentation Team</author>
- </properties>
- <body>
- <section name="Download Apache Commons Weaver Parent POM">
- <subsection name="Using a Mirror">
- <p>
- We recommend you use a mirror to download our release
- builds, but you <strong>must</strong> verify the integrity of
- the downloaded files using signatures downloaded from our main
- distribution directories. Recent releases (48 hours) may not yet
- be available from the mirrors.
- </p>
-
- <p>
- You are currently using <b>[preferred]</b>. If you
- encounter a problem with this mirror, please select another
- mirror. If all mirrors are failing, there are <i>backup</i>
- mirrors (at the end of the mirrors list) that should be
- available.
- <br></br>
- [if-any logo]<a href="[link]"><img align="right" src="[logo]" border="0"></img></a>[end]
- </p>
-
- <form action="[location]" method="get" id="SelectMirror">
- <p>
- Other mirrors:
- <select name="Preferred">
- [if-any http]
- [for http]<option value="[http]">[http]</option>[end]
- [end]
- [if-any ftp]
- [for ftp]<option value="[ftp]">[ftp]</option>[end]
- [end]
- [if-any backup]
- [for backup]<option value="[backup]">[backup] (backup)</option>[end]
- [end]
- </select>
- <input type="submit" value="Change"></input>
- </p>
- </form>
-
- <p>
- The <a href="http://www.apache.org/dist/commons/KEYS">KEYS</a>
- link links to the code signing keys used to sign the product.
- The <code>PGP</code> link downloads the OpenPGP compatible signature from our main site.
- The <code>MD5</code> link downloads the checksum from the main site.
- </p>
- </subsection>
- </section>
- <section name="Apache Commons Weaver Parent POM 1.0 ">
- <subsection name="Binaries">
- <table>
- <tr>
- <td><a href="[preferred]/commons/weaver/binaries/commons-weaver-parent-1.0-bin.tar.gz">commons-weaver-parent-1.0-bin.tar.gz</a></td>
- <td><a href="http://www.apache.org/dist/commons/weaver/binaries/commons-weaver-parent-1.0-bin.tar.gz.md5">md5</a></td>
- <td><a href="http://www.apache.org/dist/commons/weaver/binaries/commons-weaver-parent-1.0-bin.tar.gz.asc">pgp</a></td>
- </tr>
- <tr>
- <td><a href="[preferred]/commons/weaver/binaries/commons-weaver-parent-1.0-bin.zip">commons-weaver-parent-1.0-bin.zip</a></td>
- <td><a href="http://www.apache.org/dist/commons/weaver/binaries/commons-weaver-parent-1.0-bin.zip.md5">md5</a></td>
- <td><a href="http://www.apache.org/dist/commons/weaver/binaries/commons-weaver-parent-1.0-bin.zip.asc">pgp</a></td>
- </tr>
- </table>
- </subsection>
- <subsection name="Source">
- <table>
- <tr>
- <td><a href="[preferred]/commons/weaver/source/commons-weaver-parent-1.0-src.tar.gz">commons-weaver-parent-1.0-src.tar.gz</a></td>
- <td><a href="http://www.apache.org/dist/commons/weaver/source/commons-weaver-parent-1.0-src.tar.gz.md5">md5</a></td>
- <td><a href="http://www.apache.org/dist/commons/weaver/source/commons-weaver-parent-1.0-src.tar.gz.asc">pgp</a></td>
- </tr>
- <tr>
- <td><a href="[preferred]/commons/weaver/source/commons-weaver-parent-1.0-src.zip">commons-weaver-parent-1.0-src.zip</a></td>
- <td><a href="http://www.apache.org/dist/commons/weaver/source/commons-weaver-parent-1.0-src.zip.md5">md5</a></td>
- <td><a href="http://www.apache.org/dist/commons/weaver/source/commons-weaver-parent-1.0-src.zip.asc">pgp</a></td>
- </tr>
- </table>
- </subsection>
- </section>
- <section name="Archives">
- <p>
- Older releases can be obtained from the archives.
- </p>
- <ul>
- <li class="download"><a href="[preferred]/commons/weaver/">browse download area</a></li>
- <li><a href="http://archive.apache.org/dist/commons/weaver/">archives...</a></li>
- </ul>
- </section>
- </body>
-</document>