commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1411058 [2/3] - in /commons/sandbox/privilizer/trunk: ./ ant/ ant/lib/ ant/lib/src/ ant/lib/src/main/ ant/lib/src/main/java/ ant/lib/src/main/java/org/ ant/lib/src/main/java/org/apache/ ant/lib/src/main/java/org/apache/commons/ ant/lib/src...
Date Mon, 19 Nov 2012 03:54:40 GMT
Added: commons/sandbox/privilizer/trunk/ant/src/site/site_fr.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/src/site/site_fr.xml?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/ant/src/site/site_fr.xml (added)
+++ commons/sandbox/privilizer/trunk/ant/src/site/site_fr.xml Mon Nov 19 03:54:31 2012
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project name="Maven" xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <bannerLeft>
+    <name>Maven</name>
+    <src>http://maven.apache.org/images/apache-maven-project.png</src>
+    <href>http://maven.apache.org/</href>
+  </bannerLeft>
+  <bannerRight>
+    <src>http://maven.apache.org/images/maven-small.gif</src>
+  </bannerRight>
+
+  <body>
+    <links>
+      <item name="Apache" href="http://www.apache.org/" />
+      <item name="Maven 1.0" href="http://maven.apache.org/"/>
+      <item name="Maven 2" href="http://maven.apache.org/maven2/"/>
+    </links>
+
+    <menu name="Maven 2.0">
+      <item name="Format APT" href="format.html"/>
+      <item name="FAQ" href="faq.html"/>
+      <item name="Exemple Xdoc" href="xdoc.html"/>
+    </menu>
+  </body>
+</project>

Propchange: commons/sandbox/privilizer/trunk/ant/src/site/site_fr.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/ant/src/site/xdoc/xdoc.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/src/site/xdoc/xdoc.xml?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/ant/src/site/xdoc/xdoc.xml (added)
+++ commons/sandbox/privilizer/trunk/ant/src/site/xdoc/xdoc.xml Mon Nov 19 03:54:31 2012
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
+  <properties>
+    <title>Welcome</title>
+    <author email="dev@maven.apache.org">The Maven Team</author>
+  </properties>
+
+  <body>
+    <section name="Welcome to an XDOC file!">
+      <p>
+        This is some text for the xdoc file.
+      </p>
+    </section>
+  </body>
+</document>
+

Propchange: commons/sandbox/privilizer/trunk/ant/src/site/xdoc/xdoc.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/ant/test/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/test/pom.xml?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/ant/test/pom.xml (added)
+++ commons/sandbox/privilizer/trunk/ant/test/pom.xml Mon Nov 19 03:54:31 2012
@@ -0,0 +1,238 @@
+<?xml version="1.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.
+
+ -->
+<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>
+    <groupId>org.apache.commons</groupId>
+    <artifactId>commons-privilizer-antlib-parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>commons-privilizer-antlib-test</artifactId>
+  <name>Commons Privilizer Antlib Test</name>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <privilizer.policy>DYNAMIC</privilizer.policy>
+  </properties>
+  <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>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-privilizer-antlib</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.2</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <profiles>
+    <profile>
+      <id>sec</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <forkMode>once</forkMode>
+              <systemPropertyVariables>
+                <surefire.security.manager>java.lang.SecurityManager</surefire.security.manager>
+                <java.security.policy>${project.build.directory}/example-test-resources/java.policy</java.security.policy>
+              </systemPropertyVariables>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <id>antlib-test</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </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-dependencies</goal>
+                </goals>
+                <configuration>
+                  <classifier>sources</classifier>
+                  <includeGroupIds>org.apache.commons</includeGroupIds>
+                  <includeArtifactIds>commons-privilizer-example</includeArtifactIds>
+                  <includes>**/*.java</includes>
+                  <outputDirectory>${project.build.directory}/example-sources</outputDirectory>
+                </configuration>
+              </execution>
+              <execution>
+                <id>copy-dependencies</id>
+                <phase>process-sources</phase>
+                <goals>
+                  <goal>copy-dependencies</goal>
+                </goals>
+                <configuration>
+                  <outputDirectory>${project.build.directory}/compile-classpath</outputDirectory>
+                </configuration>
+              </execution>
+              <execution>
+                <id>unpack-example-test-sources</id>
+                <phase>generate-test-sources</phase>
+                <goals>
+                  <goal>unpack-dependencies</goal>
+                </goals>
+                <configuration>
+                  <classifier>test-sources</classifier>
+                  <includeGroupIds>org.apache.commons</includeGroupIds>
+                  <includeArtifactIds>commons-privilizer-example</includeArtifactIds>
+                  <includes>**/*.java</includes>
+                  <outputDirectory>${project.build.directory}/example-test-sources</outputDirectory>
+                </configuration>
+              </execution>
+              <execution>
+                <id>unpack-example-test-resources</id>
+                <phase>generate-test-resources</phase>
+                <goals>
+                  <goal>unpack-dependencies</goal>
+                </goals>
+                <configuration>
+                  <classifier>test-sources</classifier>
+                  <includeGroupIds>org.apache.commons</includeGroupIds>
+                  <includeArtifactIds>commons-privilizer-example</includeArtifactIds>
+                  <includes>java.policy</includes>
+                  <outputDirectory>${project.build.directory}/example-test-resources</outputDirectory>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>prepare-to-weave</id>
+                <phase>process-sources</phase>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+                <configuration>
+                  <target>
+                    <sequential xmlns:priv="antlib:org.apache.commons.privilizer.ant">
+                      <path id="cp">
+                        <fileset dir="${project.build.directory}/compile-classpath" />
+                      </path>
+                      <taskdef uri="antlib:org.apache.commons.privilizer.ant"
+                               resource="org/apache/commons/privilizer/ant/antlib.xml"
+                               classpathref="cp" />
+                      <priv:prepare target="${project.build.outputDirectory}"
+                                  classpathref="cp"
+                                  policy="${privilizer.policy}" />
+                    </sequential>
+                  </target>
+                </configuration>
+              </execution>
+              <execution>
+                <id>weave</id>
+                <phase>process-classes</phase>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+                <configuration>
+                  <target>
+                    <sequential xmlns:priv="antlib:org.apache.commons.privilizer.ant">
+                      <path id="cp">
+                        <fileset dir="${project.build.directory}/compile-classpath" />
+                      </path>
+                      <taskdef uri="antlib:org.apache.commons.privilizer.ant"
+                               resource="org/apache/commons/privilizer/ant/antlib.xml"
+                               classpathref="cp" />
+                      <priv:weave target="${project.build.outputDirectory}"
+                                  classpathref="cp"
+                                  policy="${privilizer.policy}" />
+                    </sequential>
+                  </target>
+                </configuration>
+              </execution>
+            </executions>
+          </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>
+              <execution>
+                <id>add-test-resources</id>
+                <phase>generate-test-resources</phase>
+                <goals>
+                  <goal>add-test-resource</goal>
+                </goals>
+                <configuration>
+                  <resources>
+                    <resource>
+                      <directory>${project.build.directory}/example-test-resources</directory>
+                    </resource>
+                  </resources>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>

Propchange: commons/sandbox/privilizer/trunk/ant/test/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/api/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/api/pom.xml?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/api/pom.xml (added)
+++ commons/sandbox/privilizer/trunk/api/pom.xml Mon Nov 19 03:54:31 2012
@@ -0,0 +1,31 @@
+<?xml version="1.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.
+
+ -->
+<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>
+    <groupId>org.apache.commons</groupId>
+    <artifactId>commons-privilizer-parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>commons-privilizer-api</artifactId>
+  <name>Commons Privilizer API</name>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>

Propchange: commons/sandbox/privilizer/trunk/api/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/api/src/main/java/org/apache/commons/privilizer/Privileged.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/api/src/main/java/org/apache/commons/privilizer/Privileged.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/api/src/main/java/org/apache/commons/privilizer/Privileged.java (added)
+++ commons/sandbox/privilizer/trunk/api/src/main/java/org/apache/commons/privilizer/Privileged.java Mon Nov 19 03:54:31 2012
@@ -0,0 +1,26 @@
+/*
+ *  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.privilizer;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+/**
+ * Marks a method as needing to execute in a privileged fashion in secured environments.
+ */
+public @interface Privileged {
+}

Propchange: commons/sandbox/privilizer/trunk/api/src/main/java/org/apache/commons/privilizer/Privileged.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/pom.xml?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/pom.xml (added)
+++ commons/sandbox/privilizer/trunk/example/pom.xml Mon Nov 19 03:54:31 2012
@@ -0,0 +1,111 @@
+<?xml version="1.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.
+
+ -->
+<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>
+  </parent>
+  <artifactId>commons-privilizer-example</artifactId>
+  <name>Commons Privilizer Example</name>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </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$ -->
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.commons</groupId>
+        <artifactId>commons-privilizer-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>prepare</goal>
+              <goal>weave</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+    <pluginManagement>
+      <plugins>
+        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
+        <plugin>
+          <groupId>org.eclipse.m2e</groupId>
+          <artifactId>lifecycle-mapping</artifactId>
+          <version>1.0.0</version>
+          <configuration>
+            <lifecycleMappingMetadata>
+              <pluginExecutions>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.apache.commons</groupId>
+                    <artifactId>commons-privilizer-maven-plugin</artifactId>
+                    <versionRange>[1.0-SNAPSHOT,)</versionRange>
+                    <goals>
+                      <goal>prepare</goal>
+                      <goal>weave</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <execute>
+                      <runOnIncremental>true</runOnIncremental>
+                    </execute>
+                  </action>
+                </pluginExecution>
+              </pluginExecutions>
+            </lifecycleMappingMetadata>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+  <profiles>
+    <profile>
+      <id>sec</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <forkMode>once</forkMode>
+              <systemPropertyVariables>
+                <surefire.security.manager>java.lang.SecurityManager</surefire.security.manager>
+                <java.security.policy>${project.basedir}/src/test/resources/java.policy</java.security.policy>
+              </systemPropertyVariables>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>

Propchange: commons/sandbox/privilizer/trunk/example/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/NoArgs.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/NoArgs.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/NoArgs.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/NoArgs.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import org.apache.commons.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/privilizer/example/NoArgs.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/Overloading.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/Overloading.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/Overloading.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/Overloading.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import org.apache.commons.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/privilizer/example/Overloading.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/PrivateMethods.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/PrivateMethods.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/PrivateMethods.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/PrivateMethods.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import org.apache.commons.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/privilizer/example/PrivateMethods.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticNoArgs.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticNoArgs.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticNoArgs.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticNoArgs.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import org.apache.commons.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/privilizer/example/StaticNoArgs.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticOverloading.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticOverloading.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticOverloading.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticOverloading.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import org.apache.commons.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/privilizer/example/StaticOverloading.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticPrivateMethods.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticPrivateMethods.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticPrivateMethods.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticPrivateMethods.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import org.apache.commons.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/privilizer/example/StaticPrivateMethods.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticUsingArgs.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticUsingArgs.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticUsingArgs.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/StaticUsingArgs.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import java.util.ArrayList;
+
+import org.apache.commons.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/privilizer/example/StaticUsingArgs.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/UsingArgs.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/UsingArgs.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/UsingArgs.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/main/java/org/apache/commons/privilizer/example/UsingArgs.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import java.util.ArrayList;
+
+import org.apache.commons.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/privilizer/example/UsingArgs.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/NoArgsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/NoArgsTest.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/NoArgsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/NoArgsTest.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.commons.privilizer.example.NoArgs;
+import org.apache.commons.privilizer.example.NoArgs.CheckedException1;
+import org.apache.commons.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/privilizer/example/NoArgsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/OverloadingTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/OverloadingTest.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/OverloadingTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/OverloadingTest.java Mon Nov 19 03:54:31 2012
@@ -0,0 +1,54 @@
+/*
+ *  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.privilizer.example;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.commons.privilizer.example.Overloading;
+
+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/privilizer/example/OverloadingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/PrivateMethodsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/PrivateMethodsTest.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/PrivateMethodsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/PrivateMethodsTest.java Mon Nov 19 03:54:31 2012
@@ -0,0 +1,48 @@
+/*
+ *  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.privilizer.example;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.commons.privilizer.example.PrivateMethods;
+
+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/privilizer/example/PrivateMethodsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticNoArgsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticNoArgsTest.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticNoArgsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticNoArgsTest.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.commons.privilizer.example.StaticNoArgs;
+import org.apache.commons.privilizer.example.StaticNoArgs.CheckedException1;
+import org.apache.commons.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/privilizer/example/StaticNoArgsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticOverloadingTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticOverloadingTest.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticOverloadingTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticOverloadingTest.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.commons.privilizer.example.StaticOverloading;
+
+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/privilizer/example/StaticOverloadingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticPrivateMethodsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticPrivateMethodsTest.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticPrivateMethodsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticPrivateMethodsTest.java Mon Nov 19 03:54:31 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.privilizer.example;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.commons.privilizer.example.StaticPrivateMethods;
+
+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/privilizer/example/StaticPrivateMethodsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticUsingArgsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticUsingArgsTest.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticUsingArgsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/StaticUsingArgsTest.java Mon Nov 19 03:54:31 2012
@@ -0,0 +1,79 @@
+/*
+ *  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.privilizer.example;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Arrays;
+
+import org.apache.commons.privilizer.example.StaticUsingArgs;
+import org.apache.commons.privilizer.example.StaticUsingArgs.CheckedException1;
+import org.apache.commons.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/privilizer/example/StaticUsingArgsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/UsingArgsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/UsingArgsTest.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/UsingArgsTest.java (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/java/org/apache/commons/privilizer/example/UsingArgsTest.java Mon Nov 19 03:54:31 2012
@@ -0,0 +1,81 @@
+/*
+ *  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.privilizer.example;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Arrays;
+
+import org.apache.commons.privilizer.example.UsingArgs;
+import org.apache.commons.privilizer.example.UsingArgs.CheckedException1;
+import org.apache.commons.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/privilizer/example/UsingArgsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/example/src/test/resources/java.policy
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/src/test/resources/java.policy?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/example/src/test/resources/java.policy (added)
+++ commons/sandbox/privilizer/trunk/example/src/test/resources/java.policy Mon Nov 19 03:54:31 2012
@@ -0,0 +1,45 @@
+//
+//  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.
+//
+
+//
+// Allows unit tests to run with a Java Security Manager
+//
+
+grant
+{
+  // let everyone read target dir
+  permission java.io.FilePermission "${user.dir}${/}target${/}-", "read";
+};
+
+// if you set up eclipse to propagate this property it will work :D
+grant codeBase "file://${eclipse.home}/-"
+{
+  permission java.security.AllPermission;
+};
+
+// and our own testcases
+
+grant codeBase "file:${user.dir}/target/test-classes/-"
+{
+  permission java.security.AllPermission;
+};
+
+grant codeBase "file:${user.dir}/target/classes/-"
+{
+  permission java.util.PropertyPermission "foo", "read";
+  permission java.util.PropertyPermission "bar", "read";
+  permission java.util.PropertyPermission "baz", "read";
+};

Added: commons/sandbox/privilizer/trunk/maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/pom.xml?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/pom.xml (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/pom.xml Mon Nov 19 03:54:31 2012
@@ -0,0 +1,109 @@
+<?xml version="1.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.
+
+ -->
+<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>
+    <groupId>org.apache.commons</groupId>
+    <artifactId>commons-privilizer-parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>commons-privilizer-maven-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+  <name>Commons Privilizer Maven Plugin</name>
+  <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>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-privilizer</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>
+    </plugins>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <version>${maven.plugin.version}</version>
+      </plugin>
+    </plugins>
+  </reporting>
+
+</project>

Propchange: commons/sandbox/privilizer/trunk/maven-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/AbstractPrivilegedMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/AbstractPrivilegedMojo.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/AbstractPrivilegedMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/AbstractPrivilegedMojo.java Mon Nov 19 03:54:31 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.privilizer.maven;
+
+import java.io.File;
+import java.net.URLClassLoader;
+import java.util.List;
+
+import org.apache.commons.privilizer.weave.AccessLevel;
+import org.apache.commons.privilizer.weave.FilesystemPrivilizer;
+import org.apache.commons.privilizer.weave.URLArray;
+import org.apache.commons.privilizer.weave.Privilizer.Log;
+import org.apache.commons.privilizer.weave.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/privilizer/maven/AbstractPrivilegedMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/PrepareMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/PrepareMojo.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/PrepareMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/PrepareMojo.java Mon Nov 19 03:54:31 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.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/privilizer/maven/PrepareMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/PrivilegedMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/PrivilegedMojo.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/PrivilegedMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/PrivilegedMojo.java Mon Nov 19 03:54:31 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.privilizer.maven;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.commons.privilizer.weave.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/privilizer/maven/PrivilegedMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestPrepareMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestPrepareMojo.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestPrepareMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestPrepareMojo.java Mon Nov 19 03:54:31 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.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/privilizer/maven/TestPrepareMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestPrivilegedMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestPrivilegedMojo.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestPrivilegedMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestPrivilegedMojo.java Mon Nov 19 03:54:31 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.privilizer.maven;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.commons.privilizer.weave.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/privilizer/maven/TestPrivilegedMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestWeaveMojo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestWeaveMojo.java?rev=1411058&view=auto
==============================================================================
--- commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestWeaveMojo.java (added)
+++ commons/sandbox/privilizer/trunk/maven-plugin/src/main/java/org/apache/commons/privilizer/maven/TestWeaveMojo.java Mon Nov 19 03:54:31 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.privilizer.maven;
+
+import org.apache.commons.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/privilizer/maven/TestWeaveMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message