You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by st...@apache.org on 2012/12/18 21:24:30 UTC

svn commit: r1423618 [1/2] - in /commons/sandbox/privilizer/trunk: ant/ ant/lib/ ant/lib/src/main/java/org/apache/commons/privilizer/ ant/lib/src/main/java/org/apache/commons/weaver/ ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ ant/lib/s...

Author: struberg
Date: Tue Dec 18 20:24:23 2012
New Revision: 1423618

URL: http://svn.apache.org/viewvc?rev=1423618&view=rev
Log:
fix module structure

of course this will now break the build temporarily :/

Added:
    commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/
    commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/
    commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/
    commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrepareTask.java   (with props)
    commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrivilegedTask.java   (with props)
    commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/WeaveTask.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/NoArgs.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Overloading.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/PrivateMethods.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticNoArgs.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticOverloading.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethods.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/NoArgsTest.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/OverloadingTest.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/PrivateMethodsTest.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticNoArgsTest.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticOverloadingTest.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethodsTest.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgsTest.java   (with props)
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingArgsTest.java   (with props)
    commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/
    commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/
    commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/
    commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/AbstractPrivilegedMojo.java   (with props)
    commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrepareMojo.java   (with props)
    commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrivilegedMojo.java   (with props)
    commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrepareMojo.java   (with props)
    commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrivilegedMojo.java   (with props)
    commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestWeaveMojo.java   (with props)
    commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/WeaveMojo.java   (with props)
Removed:
    commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/privilizer/
    commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/
    commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/
    commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/
    commons/sandbox/privilizer/trunk/modules/privilizer/api/src/main/java/org/apache/commons/privilizer/
    commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/privilizer/
Modified:
    commons/sandbox/privilizer/trunk/ant/lib/pom.xml
    commons/sandbox/privilizer/trunk/ant/lib/src/main/resources/org/apache/commons/privilizer/ant/antlib.xml
    commons/sandbox/privilizer/trunk/ant/pom.xml
    commons/sandbox/privilizer/trunk/ant/test/pom.xml
    commons/sandbox/privilizer/trunk/example/pom.xml
    commons/sandbox/privilizer/trunk/maven-plugin/pom.xml
    commons/sandbox/privilizer/trunk/modules/privilizer/api/pom.xml
    commons/sandbox/privilizer/trunk/modules/privilizer/weaver/pom.xml

Modified: commons/sandbox/privilizer/trunk/ant/lib/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/lib/pom.xml?rev=1423618&r1=1423617&r2=1423618&view=diff
==============================================================================
--- commons/sandbox/privilizer/trunk/ant/lib/pom.xml (original)
+++ commons/sandbox/privilizer/trunk/ant/lib/pom.xml Tue Dec 18 20:24:23 2012
@@ -21,9 +21,10 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.commons</groupId>
-    <artifactId>commons-privilizer-antlib-parent</artifactId>
-    <version>1.0-SNAPSHOT</version>
+    <artifactId>commons-weaver-antlib-parent</artifactId>
+    <version>0.1-SNAPSHOT</version>
   </parent>
+
   <artifactId>commons-privilizer-antlib</artifactId>
   <name>Commons Privilizer Antlib</name>
   <description>Privilizing Ant tasks.</description>
@@ -35,7 +36,8 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.commons</groupId>
-      <artifactId>commons-privilizer</artifactId>
+      <artifactId>commons-weaver-processor</artifactId>
+      <version>${project.version}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.ant</groupId>
@@ -82,19 +84,19 @@
               <relocations>
                 <relocation>
                   <pattern>org.apache.commons.lang3.</pattern>
-                  <shadedPattern>org.apache.commons.privilizer.ant._lang3.</shadedPattern>
+                  <shadedPattern>org.apache.commons.weaver.privilizer.ant._lang3.</shadedPattern>
                 </relocation>
                 <relocation>
                   <pattern>org.apache.commons.io.</pattern>
-                  <shadedPattern>org.apache.commons.privilizer.ant._io.</shadedPattern>
+                  <shadedPattern>org.apache.commons.weaver.privilizer.ant._io.</shadedPattern>
                 </relocation>
                 <relocation>
                   <pattern>org.apache.xbean.</pattern>
-                  <shadedPattern>org.apache.commons.privilizer.ant._xbean.</shadedPattern>
+                  <shadedPattern>org.apache.commons.weaver.privilizer.ant._xbean.</shadedPattern>
                 </relocation>
                 <relocation>
                   <pattern>javassist.</pattern>
-                  <shadedPattern>org.apache.commons.privilizer.ant._javassist.</shadedPattern>
+                  <shadedPattern>org.apache.commons.weaver.privilizer.ant._javassist.</shadedPattern>
                 </relocation>
               </relocations>
               <artifactSet>

Added: commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrepareTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrepareTask.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrepareTask.java (added)
+++ commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrepareTask.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,38 @@
+/*
+ *  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.ant;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * Privileged method weaving preparation Ant task (deletes classfiles woven with
+ * a different policy).
+ */
+public class PrepareTask extends PrivilegedTask {
+
+    @Override
+    public void execute() throws BuildException {
+        if (!getTarget().isDirectory()) {
+            return;
+        }
+        try {
+            createWeaver().prepare();
+        } catch (Exception e) {
+            throw new BuildException(e);
+        }
+    }
+
+}

Propchange: commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrepareTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrivilegedTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrivilegedTask.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrivilegedTask.java (added)
+++ commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrivilegedTask.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,159 @@
+/*
+ *  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.ant;
+
+import java.io.File;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Validate;
+import org.apache.commons.weaver.privilizer.weaver.AccessLevel;
+import org.apache.commons.weaver.privilizer.weaver.FilesystemPrivilizer;
+import org.apache.commons.weaver.privilizer.weaver.URLArray;
+import org.apache.commons.weaver.privilizer.weaver.Privilizer.Log;
+import org.apache.commons.weaver.privilizer.weaver.Privilizer.Policy;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+
+
+/**
+ * abstract privileged method weaving Ant task.
+ */
+public abstract class PrivilegedTask extends Task {
+    private Policy policy;
+    private File target;
+    private Path classpath;
+    private String classpathref;
+    private AccessLevel accessLevel;
+
+    @Override
+    public abstract void execute() throws BuildException;
+
+    protected FilesystemPrivilizer createWeaver() {
+        Validate.notNull(getTarget(), "target");
+
+        final Path p = new Path(getProject());
+        final Path cp = getClasspath();
+        if (cp != null) {
+            p.add(cp);
+        }
+        p.add(Path.systemClasspath);
+
+        log("Using " + p.toString(), Project.MSG_DEBUG);
+        final ClassLoader loader = new URLClassLoader(URLArray.fromPaths(Arrays.asList(p.list())));
+
+        return new FilesystemPrivilizer(getPolicy(), loader, getTarget()) {
+            @Override
+            protected boolean permitMethodWeaving(AccessLevel accessLevel) {
+                return getAccessLevel().compareTo(accessLevel) <= 0;
+            }
+        }.loggingTo(new Log() {
+
+            @Override
+            public void info(String message) {
+                log(message);
+            }
+
+            @Override
+            public void error(String message) {
+                log(message, Project.MSG_ERR);
+            }
+
+            @Override
+            public void debug(String message) {
+                log(message, Project.MSG_DEBUG);
+            }
+
+            @Override
+            public void verbose(String message) {
+                log(message, Project.MSG_VERBOSE);
+            }
+
+            @Override
+            public void warn(String message) {
+                log(message, Project.MSG_WARN);
+            }
+        });
+    }
+
+    protected Path getClasspath() {
+        if (classpath == null) {
+            if (getClasspathref() != null) {
+                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;
+    }
+
+    public void setClasspath(Path classpath) {
+        if (this.classpath != null) {
+            throw new BuildException("classpath already set");
+        }
+        this.classpath = classpath;
+    }
+
+    protected Policy getPolicy() {
+        return ObjectUtils.defaultIfNull(policy, Policy.DYNAMIC);
+    }
+
+    /**
+     * Set the weaving policy (default DYNAMIC i.e. checks SecurityManager on
+     * each invocation)
+     * 
+     * @param policy
+     */
+    public void setPolicy(Policy policy) {
+        this.policy = policy;
+    }
+
+    protected File getTarget() {
+        return target;
+    }
+
+    public void setTarget(File target) {
+        this.target = target;
+    }
+
+    protected String getClasspathref() {
+        return classpathref;
+    }
+
+    public void setClasspathRef(String classpathref) {
+        this.classpathref = classpathref;
+    }
+
+    protected AccessLevel getAccessLevel() {
+        return ObjectUtils.defaultIfNull(accessLevel, AccessLevel.PACKAGE);
+    }
+
+    /**
+     * Set "minimum" access level to be woven (default PACKAGE).
+     * 
+     * @param accessLevel
+     */
+    public void setAccessLevel(AccessLevel accessLevel) {
+        this.accessLevel = accessLevel;
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/PrivilegedTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/WeaveTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/WeaveTask.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/WeaveTask.java (added)
+++ commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/WeaveTask.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,34 @@
+/*
+ *  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.ant;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * Privileged method weaving Ant task.
+ */
+public class WeaveTask extends PrivilegedTask {
+
+    @Override
+    public void execute() throws BuildException {
+        try {
+            createWeaver().weaveAll();
+        } catch (Exception e) {
+            throw new BuildException(e);
+        }
+    }
+
+}

Propchange: commons/sandbox/privilizer/trunk/ant/lib/src/main/java/org/apache/commons/weaver/privilizer/ant/WeaveTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/sandbox/privilizer/trunk/ant/lib/src/main/resources/org/apache/commons/privilizer/ant/antlib.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/lib/src/main/resources/org/apache/commons/privilizer/ant/antlib.xml?rev=1423618&r1=1423617&r2=1423618&view=diff
==============================================================================
--- commons/sandbox/privilizer/trunk/ant/lib/src/main/resources/org/apache/commons/privilizer/ant/antlib.xml (original)
+++ commons/sandbox/privilizer/trunk/ant/lib/src/main/resources/org/apache/commons/privilizer/ant/antlib.xml Tue Dec 18 20:24:23 2012
@@ -17,6 +17,6 @@
 
  -->
 <antlib>
-  <taskdef name="prepare" classname="org.apache.commons.privilizer.ant.PrepareTask" />
-  <taskdef name="weave" classname="org.apache.commons.privilizer.ant.WeaveTask" />
-</antlib>
\ No newline at end of file
+  <taskdef name="prepare" classname="org.apache.commons.weaver.privilizer.ant.PrepareTask" />
+  <taskdef name="weave" classname="org.apache.commons.weaver.privilizer.ant.WeaveTask" />
+</antlib>

Modified: commons/sandbox/privilizer/trunk/ant/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/pom.xml?rev=1423618&r1=1423617&r2=1423618&view=diff
==============================================================================
--- commons/sandbox/privilizer/trunk/ant/pom.xml (original)
+++ commons/sandbox/privilizer/trunk/ant/pom.xml Tue Dec 18 20:24:23 2012
@@ -19,25 +19,14 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.commons</groupId>
-    <artifactId>commons-privilizer-parent</artifactId>
-    <version>1.0-SNAPSHOT</version>
+    <artifactId>commons-weaver</artifactId>
+    <version>0.1-SNAPSHOT</version>
   </parent>
-  <artifactId>commons-privilizer-antlib-parent</artifactId>
+
+  <artifactId>commons-weaver-antlib-parent</artifactId>
   <name>Commons Privilizer Antlib Parent</name>
   <packaging>pom</packaging>
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-  </properties>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-site-plugin</artifactId>
-        <configuration>
-          <locales>en,fr</locales>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
+
   <modules>
     <module>lib</module>
     <module>test</module>

Modified: commons/sandbox/privilizer/trunk/ant/test/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/test/pom.xml?rev=1423618&r1=1423617&r2=1423618&view=diff
==============================================================================
--- commons/sandbox/privilizer/trunk/ant/test/pom.xml (original)
+++ commons/sandbox/privilizer/trunk/ant/test/pom.xml Tue Dec 18 20:24:23 2012
@@ -21,9 +21,10 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.commons</groupId>
-    <artifactId>commons-privilizer-antlib-parent</artifactId>
-    <version>1.0-SNAPSHOT</version>
+    <artifactId>commons-weaver-antlib-parent</artifactId>
+    <version>0.1-SNAPSHOT</version>
   </parent>
+
   <artifactId>commons-privilizer-antlib-test</artifactId>
   <name>Commons Privilizer Antlib Test</name>
   <properties>
@@ -33,11 +34,6 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.commons</groupId>
-      <artifactId>commons-privilizer-api</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
       <artifactId>commons-privilizer-example</artifactId>
       <version>${project.version}</version>
     </dependency>
@@ -149,11 +145,11 @@
                 </goals>
                 <configuration>
                   <target>
-                    <sequential xmlns:priv="antlib:org.apache.commons.privilizer.ant">
+                    <sequential xmlns:priv="antlib:org.apache.commons.weaver.privilizer.ant">
                       <path id="cp">
                         <fileset dir="${project.build.directory}/compile-classpath" />
                       </path>
-                      <taskdef uri="antlib:org.apache.commons.privilizer.ant"
+                      <taskdef uri="antlib:org.apache.commons.weaver.privilizer.ant"
                                resource="org/apache/commons/privilizer/ant/antlib.xml"
                                classpathref="cp" />
                       <priv:prepare target="${project.build.outputDirectory}"
@@ -171,11 +167,11 @@
                 </goals>
                 <configuration>
                   <target>
-                    <sequential xmlns:priv="antlib:org.apache.commons.privilizer.ant">
+                    <sequential xmlns:priv="antlib:org.apache.commons.weaver.privilizer.ant">
                       <path id="cp">
                         <fileset dir="${project.build.directory}/compile-classpath" />
                       </path>
-                      <taskdef uri="antlib:org.apache.commons.privilizer.ant"
+                      <taskdef uri="antlib:org.apache.commons.weaver.privilizer.ant"
                                resource="org/apache/commons/privilizer/ant/antlib.xml"
                                classpathref="cp" />
                       <priv:weave target="${project.build.outputDirectory}"

Modified: commons/sandbox/privilizer/trunk/example/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/pom.xml?rev=1423618&r1=1423617&r2=1423618&view=diff
==============================================================================
--- commons/sandbox/privilizer/trunk/example/pom.xml (original)
+++ commons/sandbox/privilizer/trunk/example/pom.xml Tue Dec 18 20:24:23 2012
@@ -19,9 +19,9 @@
 <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>
   <parent>
-    <artifactId>commons-privilizer-parent</artifactId>
     <groupId>org.apache.commons</groupId>
-    <version>1.0-SNAPSHOT</version>
+      <artifactId>commons-weaver</artifactId>
+    <version>0.1-SNAPSHOT</version>
   </parent>
   <artifactId>commons-privilizer-example</artifactId>
   <name>Commons Privilizer Example</name>
@@ -30,10 +30,6 @@
   </properties>
   <dependencies>
     <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-privilizer-api</artifactId>
-    </dependency>
-    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>3.8.2</version><!--$NO-MVN-MAN-VER$ -->
@@ -44,7 +40,8 @@
     <plugins>
       <plugin>
         <groupId>org.apache.commons</groupId>
-        <artifactId>commons-privilizer-maven-plugin</artifactId>
+        <artifactId>commons-weaver-maven-plugin</artifactId>
+        <version>${project.version}</version>
         <executions>
           <execution>
             <goals>

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/NoArgs.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/NoArgs.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/NoArgs.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/NoArgs.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,63 @@
+/*
+ *  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 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();
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/NoArgs.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Overloading.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Overloading.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Overloading.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Overloading.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,36 @@
+/*
+ *  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 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 }));
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/Overloading.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/PrivateMethods.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/PrivateMethods.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/PrivateMethods.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/PrivateMethods.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,29 @@
+/*
+ *  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 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);
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/PrivateMethods.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticNoArgs.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticNoArgs.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticNoArgs.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticNoArgs.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,65 @@
+/*
+ *  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 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();
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticNoArgs.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticOverloading.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticOverloading.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticOverloading.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticOverloading.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,38 @@
+/*
+ *  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 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 }));
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticOverloading.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethods.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethods.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethods.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethods.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,32 @@
+/*
+ *  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 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);
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethods.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,78 @@
+/*
+ *  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.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;
+        }
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,75 @@
+/*
+ *  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.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;
+        }
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/NoArgsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/NoArgsTest.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/NoArgsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/NoArgsTest.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,77 @@
+/*
+ *  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;
+
+import org.apache.commons.weaver.privilizer.example.NoArgs.CheckedException1;
+import org.apache.commons.weaver.privilizer.example.NoArgs.CheckedException2;
+
+import junit.framework.TestCase;
+
+
+public class NoArgsTest extends TestCase {
+    private NoArgs noArgs;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+
+            @Override
+            public Void run() {
+                System.setProperty("foo", "foo-value");
+                return null;
+            }
+        });
+        noArgs = new NoArgs();
+    }
+
+    public void testThrowAwayFoo() {
+        noArgs.throwAwayFoo();
+    }
+
+    public void testGetFoo() {
+        assertEquals("foo-value", noArgs.getFoo());
+    }
+
+    public void testGetTrue() {
+        assertSame(Boolean.TRUE, noArgs.getTrue());
+    }
+
+    public void testGetFalse() {
+        assertFalse(noArgs.getFalse());
+    }
+
+    public void testThrowingCheckedException1() {
+        try {
+            noArgs.throwingCheckedException1();
+            fail();
+        } catch (CheckedException1 e) {
+        }
+    }
+
+    public void testThrowingCheckedException2() {
+        try {
+            noArgs.throwingCheckedException2();
+        } catch (CheckedException1 e) {
+        } catch (CheckedException2 e) {
+            return;
+        }
+        fail();
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/NoArgsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/OverloadingTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/OverloadingTest.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/OverloadingTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/OverloadingTest.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,52 @@
+/*
+ *  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;
+
+import junit.framework.TestCase;
+
+public class OverloadingTest extends TestCase {
+    private Overloading overloading;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
+            public Void run() {
+                System.setProperty("foo", "foo-value");
+                System.setProperty("bar", "bar-value");
+                System.setProperty("baz", "baz-value");
+                return null;
+            }
+        });
+        overloading = new Overloading();
+    }
+
+    public void testNoArgs() {
+        assertEquals("foo-value", overloading.get());
+    }
+
+    public void testStringArg() {
+        assertEquals("bar-value", overloading.get("bar"));
+    }
+
+    public void testCharishArgs() {
+        assertEquals("baz-value", overloading.get('b', 'a', (short) 'z'));
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/OverloadingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/PrivateMethodsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/PrivateMethodsTest.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/PrivateMethodsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/PrivateMethodsTest.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,46 @@
+/*
+ *  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;
+
+import junit.framework.TestCase;
+
+public class PrivateMethodsTest extends TestCase {
+    private PrivateMethods privateMethods;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
+            public Void run() {
+                System.setProperty("foo", "foo-value");
+                System.setProperty("bar", "bar-value");
+                System.setProperty("baz", "baz-value");
+                return null;
+            }
+        });
+        privateMethods = new PrivateMethods();
+    }
+
+    public void testGet() {
+        assertEquals("foo-value", privateMethods.get("foo"));
+        assertEquals("bar-value", privateMethods.get("bar"));
+        assertEquals("baz-value", privateMethods.get("baz"));
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/PrivateMethodsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticNoArgsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticNoArgsTest.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticNoArgsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticNoArgsTest.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,74 @@
+/*
+ *  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;
+
+import org.apache.commons.weaver.privilizer.example.StaticNoArgs.CheckedException1;
+import org.apache.commons.weaver.privilizer.example.StaticNoArgs.CheckedException2;
+
+import junit.framework.TestCase;
+
+
+public class StaticNoArgsTest extends TestCase {
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+
+            @Override
+            public Void run() {
+                System.setProperty("foo", "foo-value");
+                return null;
+            }
+        });
+    }
+
+    public void testThrowAwayFoo() {
+        StaticNoArgs.throwAwayFoo();
+    }
+
+    public void testGetFoo() {
+        assertEquals("foo-value", StaticNoArgs.getFoo());
+    }
+
+    public void testGetTrue() {
+        assertSame(Boolean.TRUE, StaticNoArgs.getTrue());
+    }
+
+    public void testGetFalse() {
+        assertFalse(StaticNoArgs.getFalse());
+    }
+
+    public void testThrowingCheckedException1() {
+        try {
+            StaticNoArgs.throwingCheckedException1();
+            fail();
+        } catch (CheckedException1 e) {
+        }
+    }
+
+    public void testThrowingCheckedException2() {
+        try {
+            StaticNoArgs.throwingCheckedException2();
+        } catch (CheckedException1 e) {
+        } catch (CheckedException2 e) {
+            return;
+        }
+        fail();
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticNoArgsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticOverloadingTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticOverloadingTest.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticOverloadingTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticOverloadingTest.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,50 @@
+/*
+ *  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;
+
+import junit.framework.TestCase;
+
+public class StaticOverloadingTest extends TestCase {
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
+            public Void run() {
+                System.setProperty("foo", "foo-value");
+                System.setProperty("bar", "bar-value");
+                System.setProperty("baz", "baz-value");
+                return null;
+            }
+        });
+    }
+
+    public void testNoArgs() {
+        assertEquals("foo-value", StaticOverloading.get());
+    }
+
+    public void testStringArg() {
+        assertEquals("bar-value", StaticOverloading.get("bar"));
+    }
+
+    public void testCharishArgs() {
+        assertEquals("baz-value", StaticOverloading.get('b', 'a', (short) 'z'));
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticOverloadingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethodsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethodsTest.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethodsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethodsTest.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,44 @@
+/*
+ *  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;
+
+import junit.framework.TestCase;
+
+public class StaticPrivateMethodsTest extends TestCase {
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
+            public Void run() {
+                System.setProperty("foo", "foo-value");
+                System.setProperty("bar", "bar-value");
+                System.setProperty("baz", "baz-value");
+                return null;
+            }
+        });
+    }
+
+    public void testGet() {
+        assertEquals("foo-value", StaticPrivateMethods.get("foo"));
+        assertEquals("bar-value", StaticPrivateMethods.get("bar"));
+        assertEquals("baz-value", StaticPrivateMethods.get("baz"));
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticPrivateMethodsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgsTest.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgsTest.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,78 @@
+/*
+ *  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;
+import java.util.Arrays;
+
+import org.apache.commons.weaver.privilizer.example.StaticUsingArgs.CheckedException1;
+import org.apache.commons.weaver.privilizer.example.StaticUsingArgs.CheckedException2;
+
+import junit.framework.TestCase;
+
+
+public class StaticUsingArgsTest extends TestCase {
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
+            public Void run() {
+                System.setProperty("foo", "foo-value");
+                System.setProperty("bar", "bar-value");
+                System.setProperty("baz", "baz-value");
+                return null;
+            }
+        });
+    }
+
+    public void testGetProperty() {
+        assertEquals("foo-value", StaticUsingArgs.getProperty("foo"));
+        assertEquals("bar-value", StaticUsingArgs.getProperty("bar"));
+        assertEquals("baz-value", StaticUsingArgs.getProperty("baz"));
+    }
+
+    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));
+    }
+
+    public void testThrowAwayProperty() {
+        StaticUsingArgs.throwAwayProperty('f', "o", 'o');
+    }
+
+    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'));
+    }
+
+    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) {
+        }
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingArgsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingArgsTest.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingArgsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingArgsTest.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,80 @@
+/*
+ *  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;
+import java.util.Arrays;
+
+import org.apache.commons.weaver.privilizer.example.UsingArgs.CheckedException1;
+import org.apache.commons.weaver.privilizer.example.UsingArgs.CheckedException2;
+
+import junit.framework.TestCase;
+
+
+public class UsingArgsTest extends TestCase {
+    private UsingArgs usingArgs;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
+            public Void run() {
+                System.setProperty("foo", "foo-value");
+                System.setProperty("bar", "bar-value");
+                System.setProperty("baz", "baz-value");
+                return null;
+            }
+        });
+        usingArgs = new UsingArgs();
+    }
+
+    public void testGetProperty() {
+        assertEquals("foo-value", usingArgs.getProperty("foo"));
+        assertEquals("bar-value", usingArgs.getProperty("bar"));
+        assertEquals("baz-value", usingArgs.getProperty("baz"));
+    }
+
+    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));
+    }
+
+    public void testThrowAwayProperty() {
+        usingArgs.throwAwayProperty('f', "o", 'o');
+    }
+
+    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'));
+    }
+
+    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) {
+        }
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/weaver/privilizer/example/UsingArgsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/sandbox/privilizer/trunk/maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/pom.xml?rev=1423618&r1=1423617&r2=1423618&view=diff
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/pom.xml (original)
+++ commons/sandbox/privilizer/trunk/maven-plugin/pom.xml Tue Dec 18 20:24:23 2012
@@ -20,13 +20,16 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.commons</groupId>
-    <artifactId>commons-privilizer-parent</artifactId>
-    <version>1.0-SNAPSHOT</version>
+    <artifactId>commons-weaver</artifactId>
+    <version>0.1-SNAPSHOT</version>
   </parent>
-  <artifactId>commons-privilizer-maven-plugin</artifactId>
+
+  <artifactId>commons-weaver-maven-plugin</artifactId>
   <packaging>maven-plugin</packaging>
+
   <name>Commons Privilizer Maven Plugin</name>
   <description>Privilizing Maven goals</description>
+
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <maven.version>3.0.4</maven.version>
@@ -35,7 +38,8 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.commons</groupId>
-      <artifactId>commons-privilizer</artifactId>
+      <artifactId>commons-weaver-processor</artifactId>
+      <version>${project.version}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/AbstractPrivilegedMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/AbstractPrivilegedMojo.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/AbstractPrivilegedMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/AbstractPrivilegedMojo.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,89 @@
+/*
+ *  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.maven;
+
+import java.io.File;
+import java.net.URLClassLoader;
+import java.util.List;
+
+import org.apache.commons.weaver.privilizer.weaver.AccessLevel;
+import org.apache.commons.weaver.privilizer.weaver.FilesystemPrivilizer;
+import org.apache.commons.weaver.privilizer.weaver.URLArray;
+import org.apache.commons.weaver.privilizer.weaver.Privilizer.Log;
+import org.apache.commons.weaver.privilizer.weaver.Privilizer.Policy;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+
+/**
+ * Defines common properties.
+ */
+public abstract class AbstractPrivilegedMojo extends AbstractMojo {
+    /**
+     * Weaving policy to use.
+     */
+    @Parameter(property = "privilizer.policy", required = true, defaultValue = "DYNAMIC")
+    protected Policy policy;
+
+    @Parameter(defaultValue = "false")
+    protected boolean verbose;
+
+    protected abstract List<String> getClasspath();
+
+    protected abstract File getTarget();
+
+    protected abstract AccessLevel getAccessLevel();
+
+    protected FilesystemPrivilizer createWeaver() {
+        return new FilesystemPrivilizer(policy, new URLClassLoader(URLArray.fromPaths(getClasspath())), getTarget()) {
+            @Override
+            protected boolean permitMethodWeaving(AccessLevel accessLevel) {
+                return getAccessLevel().compareTo(accessLevel) <= 0;
+            }
+        }.loggingTo(new Log() {
+
+            @Override
+            public void info(String message) {
+                getLog().info(message);
+            }
+
+            @Override
+            public void error(String message) {
+                getLog().error(message);
+            }
+
+            @Override
+            public void debug(String message) {
+                getLog().debug(message);
+            }
+
+            @Override
+            public void verbose(String message) {
+                if (verbose) {
+                    getLog().info(message);
+                } else {
+                    getLog().debug(message);
+                }
+            }
+
+            @Override
+            public void warn(String message) {
+                getLog().warn(message);
+            }
+        });
+    }
+
+}

Propchange: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/AbstractPrivilegedMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrepareMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrepareMojo.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrepareMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrepareMojo.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,47 @@
+/*
+ *  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.maven;
+
+import javassist.NotFoundException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Prepare for weaving by deleting classes previously woven with a different
+ * policy.
+ */
+@Mojo(name = "prepare", defaultPhase = LifecyclePhase.INITIALIZE, requiresDependencyCollection = ResolutionScope.COMPILE)
+public class PrepareMojo extends PrivilegedMojo {
+    @Component
+    private MavenProject project;
+
+    @Override
+    public void execute() throws MojoExecutionException {
+        if (target.exists()) {
+            try {
+                createWeaver().prepare();
+            } catch (NotFoundException e) {
+                throw new MojoExecutionException("error", e);
+            }
+        }
+    }
+
+}

Propchange: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrepareMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrivilegedMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrivilegedMojo.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrivilegedMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrivilegedMojo.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,50 @@
+/*
+ *  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.maven;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.commons.weaver.privilizer.weaver.AccessLevel;
+import org.apache.maven.plugins.annotations.Parameter;
+
+
+public abstract class PrivilegedMojo extends AbstractPrivilegedMojo {
+
+    @Parameter(readonly = true, required = true, defaultValue = "${project.compileClasspathElements}")
+    protected List<String> classpath;
+
+    @Parameter(readonly = true, required = true, defaultValue = "${project.build.outputDirectory}")
+    protected File target;
+
+    @Parameter(readonly = false, required = true, defaultValue = "PACKAGE")
+    protected AccessLevel accessLevel;
+
+    @Override
+    protected List<String> getClasspath() {
+        return classpath;
+    }
+
+    @Override
+    protected File getTarget() {
+        return target;
+    }
+
+    @Override
+    protected AccessLevel getAccessLevel() {
+        return accessLevel;
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/PrivilegedMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrepareMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrepareMojo.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrepareMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrepareMojo.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,47 @@
+/*
+ *  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.maven;
+
+import javassist.NotFoundException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Prepare for weaving by deleting test classes previously woven with a different
+ * policy.
+ */
+@Mojo(name = "test-prepare", defaultPhase = LifecyclePhase.INITIALIZE, requiresDependencyCollection = ResolutionScope.TEST)
+public class TestPrepareMojo extends TestPrivilegedMojo {
+    @Component
+    private MavenProject project;
+
+    @Override
+    public void execute() throws MojoExecutionException {
+        if (target.exists()) {
+            try {
+                createWeaver().prepare();
+            } catch (NotFoundException e) {
+                throw new MojoExecutionException("error", e);
+            }
+        }
+    }
+
+}

Propchange: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrepareMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrivilegedMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrivilegedMojo.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrivilegedMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrivilegedMojo.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,50 @@
+/*
+ *  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.maven;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.commons.weaver.privilizer.weaver.AccessLevel;
+import org.apache.maven.plugins.annotations.Parameter;
+
+
+public abstract class TestPrivilegedMojo extends AbstractPrivilegedMojo {
+
+    @Parameter(readonly = true, required = true, defaultValue = "${project.testClasspathElements}")
+    protected List<String> classpath;
+
+    @Parameter(readonly = true, required = true, defaultValue = "${project.build.testOutputDirectory}")
+    protected File target;
+
+    @Parameter(readonly = false, required = true, defaultValue = "PUBLIC")
+    protected AccessLevel accessLevel;
+
+    @Override
+    protected List<String> getClasspath() {
+        return classpath;
+    }
+
+    @Override
+    protected File getTarget() {
+        return target;
+    }
+
+    @Override
+    protected AccessLevel getAccessLevel() {
+        return accessLevel;
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestPrivilegedMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestWeaveMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestWeaveMojo.java?rev=1423618&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestWeaveMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestWeaveMojo.java Tue Dec 18 20:24:23 2012
@@ -0,0 +1,40 @@
+/*
+ *  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.maven;
+
+import org.apache.commons.weaver.privilizer.Privileged;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+
+/**
+ * Goal to weave test classes with {@link SecurityManager} handling code for methods marked with
+ * the {@link Privileged} annotation.
+ */
+@Mojo(name = "test-weave", defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES, requiresDependencyCollection = ResolutionScope.TEST)
+public class TestWeaveMojo extends TestPrivilegedMojo {
+
+    @Override
+    public void execute() throws MojoFailureException {
+        try {
+            createWeaver().weaveAll();
+        } catch (Exception e) {
+            throw new MojoFailureException("failed", e);
+        }
+    }
+}

Propchange: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/weaver/privilizer/maven/TestWeaveMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native