commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: svn commit: r1424618 - in /commons/sandbox/privilizer/trunk: ./ ant/ ant/lib/ ant/test/ example/ maven-plugin/ modules/ modules/privilizer/ modules/privilizer/api/ modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/ modules/privi...
Date Thu, 20 Dec 2012 21:20:00 GMT
Mark,
  Thanks for driving this forward--as I mentioned to you privately, I'll be
mostly out of pocket through the new year.  The groupId may warrant
discussion; most Commons components are being targeted to
org.apache.commons, though I think I understand what you're driving at
here:  [weaver] may have some unlimited number of sub(-sub*)-modules which
may warrant oac.weaver as a groupId.

Matt


On Thu, Dec 20, 2012 at 12:33 PM, <struberg@apache.org> wrote:

> Author: struberg
> Date: Thu Dec 20 18:33:37 2012
> New Revision: 1424618
>
> URL: http://svn.apache.org/viewvc?rev=1424618&view=rev
> Log:
> continue moving the privilizer to being a 'Weaver'
>
> Added:
>
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java
>   (with props)
>
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/resources/
>
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/resources/META-INF/
>
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/
>
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver
> Modified:
>     commons/sandbox/privilizer/trunk/ant/lib/pom.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/pom.xml
>     commons/sandbox/privilizer/trunk/modules/privilizer/api/pom.xml
>
> commons/sandbox/privilizer/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/Privileged.java
>     commons/sandbox/privilizer/trunk/modules/privilizer/pom.xml
>     commons/sandbox/privilizer/trunk/modules/privilizer/weaver/pom.xml
>     commons/sandbox/privilizer/trunk/pom.xml
>     commons/sandbox/privilizer/trunk/processor/pom.xml
>
> commons/sandbox/privilizer/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java
>
> commons/sandbox/privilizer/trunk/processor/src/main/java/org/apache/commons/weaver/spi/Weaver.java
>
> commons/sandbox/privilizer/trunk/processor/src/test/java/org/apache/commons/weaver/test/WeaveProcessorTest.java
>
> commons/sandbox/privilizer/trunk/processor/src/test/java/org/apache/commons/weaver/test/weaver/TestWeaver.java
>
> Modified: commons/sandbox/privilizer/trunk/ant/lib/pom.xml
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/lib/pom.xml?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> --- commons/sandbox/privilizer/trunk/ant/lib/pom.xml (original)
> +++ commons/sandbox/privilizer/trunk/ant/lib/pom.xml Thu Dec 20 18:33:37
> 2012
> @@ -20,7 +20,7 @@
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>    <modelVersion>4.0.0</modelVersion>
>    <parent>
> -    <groupId>org.apache.commons</groupId>
> +    <groupId>org.apache.commons.weaver</groupId>
>      <artifactId>commons-weaver-antlib-parent</artifactId>
>      <version>0.1-SNAPSHOT</version>
>    </parent>
> @@ -35,7 +35,7 @@
>    </properties>
>    <dependencies>
>      <dependency>
> -      <groupId>org.apache.commons</groupId>
> +      <groupId>org.apache.commons.weaver</groupId>
>        <artifactId>commons-weaver-processor</artifactId>
>        <version>${project.version}</version>
>      </dependency>
>
> Modified: commons/sandbox/privilizer/trunk/ant/pom.xml
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/pom.xml?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> --- commons/sandbox/privilizer/trunk/ant/pom.xml (original)
> +++ commons/sandbox/privilizer/trunk/ant/pom.xml Thu Dec 20 18:33:37 2012
> @@ -18,7 +18,7 @@
>   --><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>    <modelVersion>4.0.0</modelVersion>
>    <parent>
> -    <groupId>org.apache.commons</groupId>
> +    <groupId>org.apache.commons.weaver</groupId>
>      <artifactId>commons-weaver</artifactId>
>      <version>0.1-SNAPSHOT</version>
>    </parent>
>
> Modified: commons/sandbox/privilizer/trunk/ant/test/pom.xml
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/ant/test/pom.xml?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> --- commons/sandbox/privilizer/trunk/ant/test/pom.xml (original)
> +++ commons/sandbox/privilizer/trunk/ant/test/pom.xml Thu Dec 20 18:33:37
> 2012
> @@ -20,7 +20,7 @@
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>    <modelVersion>4.0.0</modelVersion>
>    <parent>
> -    <groupId>org.apache.commons</groupId>
> +    <groupId>org.apache.commons.weaver</groupId>
>      <artifactId>commons-weaver-antlib-parent</artifactId>
>      <version>0.1-SNAPSHOT</version>
>    </parent>
> @@ -33,12 +33,12 @@
>    </properties>
>    <dependencies>
>      <dependency>
> -      <groupId>org.apache.commons</groupId>
> +      <groupId>org.apache.commons.weaver</groupId>
>        <artifactId>commons-privilizer-example</artifactId>
>        <version>${project.version}</version>
>      </dependency>
>      <dependency>
> -      <groupId>org.apache.commons</groupId>
> +      <groupId>org.apache.commons.weaver</groupId>
>        <artifactId>commons-privilizer-antlib</artifactId>
>        <version>${project.version}</version>
>      </dependency>
>
> Modified: commons/sandbox/privilizer/trunk/example/pom.xml
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/example/pom.xml?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> --- commons/sandbox/privilizer/trunk/example/pom.xml (original)
> +++ commons/sandbox/privilizer/trunk/example/pom.xml Thu Dec 20 18:33:37
> 2012
> @@ -19,7 +19,7 @@
>  <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>
> +    <groupId>org.apache.commons.weaver</groupId>
>        <artifactId>commons-weaver</artifactId>
>      <version>0.1-SNAPSHOT</version>
>    </parent>
> @@ -39,7 +39,7 @@
>    <build>
>      <plugins>
>        <plugin>
> -        <groupId>org.apache.commons</groupId>
> +        <groupId>org.apache.commons.weaver</groupId>
>          <artifactId>commons-weaver-maven-plugin</artifactId>
>          <version>${project.version}</version>
>          <executions>
> @@ -64,7 +64,7 @@
>                <pluginExecutions>
>                  <pluginExecution>
>                    <pluginExecutionFilter>
> -                    <groupId>org.apache.commons</groupId>
> +                    <groupId>org.apache.commons.weaver</groupId>
>
>  <artifactId>commons-privilizer-maven-plugin</artifactId>
>                      <versionRange>[1.0-SNAPSHOT,)</versionRange>
>                      <goals>
>
> Modified: commons/sandbox/privilizer/trunk/maven-plugin/pom.xml
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/maven-plugin/pom.xml?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> --- commons/sandbox/privilizer/trunk/maven-plugin/pom.xml (original)
> +++ commons/sandbox/privilizer/trunk/maven-plugin/pom.xml Thu Dec 20
> 18:33:37 2012
> @@ -19,7 +19,7 @@
>  <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>
> +    <groupId>org.apache.commons.weaver</groupId>
>      <artifactId>commons-weaver</artifactId>
>      <version>0.1-SNAPSHOT</version>
>    </parent>
> @@ -37,7 +37,7 @@
>    </properties>
>    <dependencies>
>      <dependency>
> -      <groupId>org.apache.commons</groupId>
> +      <groupId>org.apache.commons.weaver</groupId>
>        <artifactId>commons-weaver-processor</artifactId>
>        <version>${project.version}</version>
>      </dependency>
>
> Modified: commons/sandbox/privilizer/trunk/modules/pom.xml
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/modules/pom.xml?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> --- commons/sandbox/privilizer/trunk/modules/pom.xml (original)
> +++ commons/sandbox/privilizer/trunk/modules/pom.xml Thu Dec 20 18:33:37
> 2012
> @@ -20,7 +20,7 @@
>    <modelVersion>4.0.0</modelVersion>
>    <parent>
>      <artifactId>commons-weaver</artifactId>
> -    <groupId>org.apache.commons</groupId>
> +    <groupId>org.apache.commons.weaver</groupId>
>      <version>0.1-SNAPSHOT</version>
>    </parent>
>
>
> Modified: commons/sandbox/privilizer/trunk/modules/privilizer/api/pom.xml
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/modules/privilizer/api/pom.xml?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> --- commons/sandbox/privilizer/trunk/modules/privilizer/api/pom.xml
> (original)
> +++ commons/sandbox/privilizer/trunk/modules/privilizer/api/pom.xml Thu
> Dec 20 18:33:37 2012
> @@ -19,7 +19,7 @@
>  <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>
> +    <groupId>org.apache.commons.weaver</groupId>
>      <artifactId>commons-weaver-privilizer-parent</artifactId>
>      <version>0.1-SNAPSHOT</version>
>    </parent>
>
> Modified:
> commons/sandbox/privilizer/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/Privileged.java
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/Privileged.java?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> ---
> commons/sandbox/privilizer/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/Privileged.java
> (original)
> +++
> commons/sandbox/privilizer/trunk/modules/privilizer/api/src/main/java/org/apache/commons/weaver/privilizer/Privileged.java
> Thu Dec 20 18:33:37 2012
> @@ -20,10 +20,10 @@ import java.lang.annotation.Retention;
>  import java.lang.annotation.RetentionPolicy;
>  import java.lang.annotation.Target;
>
> -@Target(ElementType.METHOD)
> -@Retention(RetentionPolicy.CLASS)
>  /**
>   * Marks a method as needing to execute in a privileged fashion in
> secured environments.
>   */
> +@Target(ElementType.METHOD)
> +@Retention(RetentionPolicy.CLASS)
>  public @interface Privileged {
>  }
>
> Modified: commons/sandbox/privilizer/trunk/modules/privilizer/pom.xml
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/modules/privilizer/pom.xml?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> --- commons/sandbox/privilizer/trunk/modules/privilizer/pom.xml (original)
> +++ commons/sandbox/privilizer/trunk/modules/privilizer/pom.xml Thu Dec 20
> 18:33:37 2012
> @@ -19,7 +19,7 @@
>    <modelVersion>4.0.0</modelVersion>
>
>    <parent>
> -    <groupId>org.apache.commons</groupId>
> +    <groupId>org.apache.commons.weaver</groupId>
>      <artifactId>commons-weaver-modules-parent</artifactId>
>      <version>0.1-SNAPSHOT</version>
>    </parent>
>
> Modified:
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/pom.xml
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/modules/privilizer/weaver/pom.xml?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> --- commons/sandbox/privilizer/trunk/modules/privilizer/weaver/pom.xml
> (original)
> +++ commons/sandbox/privilizer/trunk/modules/privilizer/weaver/pom.xml Thu
> Dec 20 18:33:37 2012
> @@ -19,24 +19,29 @@
>  <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>
> +    <groupId>org.apache.commons.weaver</groupId>
>      <artifactId>commons-weaver-privilizer-parent</artifactId>
>      <version>0.1-SNAPSHOT</version>
>    </parent>
>
>    <artifactId>commons-privilizer</artifactId>
> -  <name>Commons Privilizer</name>
> +  <name>Commons Privilizer Weaver</name>
>    <description>
>      Privilizer provides machinery to automate the handling of Java
> Security access controls in code.
>    </description>
>
>    <dependencies>
>      <dependency>
> -      <groupId>org.apache.commons</groupId>
> +      <groupId>org.apache.commons.weaver</groupId>
>        <artifactId>commons-weaver-privilizer-api</artifactId>
>        <version>${project.version}</version>
>      </dependency>
>      <dependency>
> +      <groupId>org.apache.commons.weaver</groupId>
> +      <artifactId>commons-weaver-processor</artifactId>
> +      <version>${project.version}</version>
> +    </dependency>
> +    <dependency>
>        <groupId>org.apache.commons</groupId>
>        <artifactId>commons-lang3</artifactId>
>        <version>3.1</version>
>
> Added:
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java?rev=1424618&view=auto
>
> ==============================================================================
> ---
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java
> (added)
> +++
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java
> Thu Dec 20 18:33:37 2012
> @@ -0,0 +1,70 @@
> +package org.apache.commons.weaver.privilizer;
> +
> +import java.io.File;
> +import java.lang.annotation.Annotation;
> +import java.lang.reflect.Method;
> +import java.net.URLClassLoader;
> +import java.util.List;
> +import java.util.Map;
> +
> +import org.apache.commons.weaver.spi.Weaver;
> +
> +/**
> + * Weaver which adds doPrivileged blocks for each method annotated with
> + * {@link Privileged}
> + */
> +public class PrivilizerWeaver implements Weaver
> +{
> +    private FilesystemPrivilizer privilizer;
> +
> +    private Privilizer.Policy policy;
> +
> +    private AccessLevel targetAccessLevel;
> +
> +    private URLClassLoader urlClassLoader;
> +
> +    private File target;
> +
> +
> +
> +    @Override
> +    public void configure(Map<String, Object> config)
> +    {
> +        privilizer = new FilesystemPrivilizer(policy, urlClassLoader,
> target) {
> +            @Override
> +            protected boolean permitMethodWeaving(final AccessLevel
> accessLevel) {
> +                return targetAccessLevel.compareTo(accessLevel) <= 0;
> +            }
> +        };
> +    }
> +
> +    @Override
> +    public List<Class<? extends Annotation>> getInterest()
> +    {
> +        return null;  //To change body of implemented methods use File |
> Settings | File Templates.
> +    }
> +
> +    @Override
> +    public void preWeave()
> +    {
> +        //To change body of implemented methods use File | Settings |
> File Templates.
> +    }
> +
> +    @Override
> +    public boolean weave(Class classToWeave)
> +    {
> +        return false;  //To change body of implemented methods use File |
> Settings | File Templates.
> +    }
> +
> +    @Override
> +    public boolean weave(Method methodToWeave)
> +    {
> +        return false;  //To change body of implemented methods use File |
> Settings | File Templates.
> +    }
> +
> +    @Override
> +    public void postWeave()
> +    {
> +        //To change body of implemented methods use File | Settings |
> File Templates.
> +    }
> +}
>
> Propchange:
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/PrivilizerWeaver.java
>
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
> Added:
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver?rev=1424618&view=auto
>
> ==============================================================================
> ---
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver
> (added)
> +++
> commons/sandbox/privilizer/trunk/modules/privilizer/weaver/src/main/resources/META-INF/services/org.apache.commons.weaver.spi.Weaver
> Thu Dec 20 18:33:37 2012
> @@ -0,0 +1,19 @@
> +# Licensed to the Apache Software Foundation (ASF) under one
> +# or more contributor license agreements.  See the NOTICE file
> +# distributed with this work for additional information
> +# regarding copyright ownership.  The ASF licenses this file
> +# to you under the Apache License, Version 2.0 (the
> +# "License"); you may not use this file except in compliance
> +# with the License.  You may obtain a copy of the License at
> +#
> +#  http://www.apache.org/licenses/LICENSE-2.0
> +#
> +# Unless required by applicable law or agreed to in writing,
> +# software distributed under the License is distributed on an
> +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +# KIND, either express or implied.  See the License for the
> +# specific language governing permissions and limitations
> +# under the License.
> +
> +# this class gets picked up by the WeaveProcessor
> +org.apache.commons.weaver.test.weaver.TestWeaver
>
> Modified: commons/sandbox/privilizer/trunk/pom.xml
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/pom.xml?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> --- commons/sandbox/privilizer/trunk/pom.xml (original)
> +++ commons/sandbox/privilizer/trunk/pom.xml Thu Dec 20 18:33:37 2012
> @@ -25,6 +25,7 @@
>      <version>9</version>
>    </parent>
>
> +  <groupId>org.apache.commons.weaver</groupId>
>    <artifactId>commons-weaver</artifactId>
>    <version>0.1-SNAPSHOT</version>
>    <packaging>pom</packaging>
>
> Modified: commons/sandbox/privilizer/trunk/processor/pom.xml
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/processor/pom.xml?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> --- commons/sandbox/privilizer/trunk/processor/pom.xml (original)
> +++ commons/sandbox/privilizer/trunk/processor/pom.xml Thu Dec 20 18:33:37
> 2012
> @@ -19,7 +19,7 @@
>  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>    <modelVersion>4.0.0</modelVersion>
>    <parent>
> -    <groupId>org.apache.commons</groupId>
> +    <groupId>org.apache.commons.weaver</groupId>
>      <artifactId>commons-weaver</artifactId>
>      <version>0.1-SNAPSHOT</version>
>    </parent>
> @@ -36,7 +36,7 @@
>      <dependency>
>        <groupId>org.apache.xbean</groupId>
>        <artifactId>xbean-finder-shaded</artifactId>
> -      <version>3.12</version>
> +      <version>3.13-SNAPSHOT</version>
>      </dependency>
>
>    </dependencies>
>
> Modified:
> commons/sandbox/privilizer/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> ---
> commons/sandbox/privilizer/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java
> (original)
> +++
> commons/sandbox/privilizer/trunk/processor/src/main/java/org/apache/commons/weaver/WeaveProcessor.java
> Thu Dec 20 18:33:37 2012
> @@ -25,7 +25,7 @@ import java.net.URLClassLoader;
>  import java.util.ArrayList;
>  import java.util.Iterator;
>  import java.util.List;
> -import java.util.Properties;
> +import java.util.Map;
>  import java.util.ServiceLoader;
>
>  import org.apache.commons.weaver.spi.Weaver;
> @@ -75,7 +75,7 @@ public class WeaveProcessor {
>      /**
>       * configure all Weavers.
>       */
> -    public void configure(Properties config) {
> +    public void configure(Map<String, Object> config) {
>          for (Weaver weaver : weavers) {
>              weaver.configure(config);
>          }
> @@ -113,7 +113,6 @@ public class WeaveProcessor {
>                  weaver.weave(annotatedClass);
>              }
>
> -
>              List<Method> annotateMethods =
> annotationFinder.findAnnotatedMethods(annotation);
>              for (Method annotatedMethod : annotateMethods) {
>                  weaver.weave(annotatedMethod);
>
> Modified:
> commons/sandbox/privilizer/trunk/processor/src/main/java/org/apache/commons/weaver/spi/Weaver.java
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/processor/src/main/java/org/apache/commons/weaver/spi/Weaver.java?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> ---
> commons/sandbox/privilizer/trunk/processor/src/main/java/org/apache/commons/weaver/spi/Weaver.java
> (original)
> +++
> commons/sandbox/privilizer/trunk/processor/src/main/java/org/apache/commons/weaver/spi/Weaver.java
> Thu Dec 20 18:33:37 2012
> @@ -21,7 +21,7 @@ package org.apache.commons.weaver.spi;
>  import java.lang.annotation.Annotation;
>  import java.lang.reflect.Method;
>  import java.util.List;
> -import java.util.Properties;
> +import java.util.Map;
>
>  /**
>   * An implementation of a 'Weaver' takes care about
> @@ -37,7 +37,7 @@ public interface Weaver
>       * Any configuration property of a weaver should start with it's
> 'name'
>       * e.g. 'privilizer'
>       */
> -    void configure(Properties config);
> +    void configure(Map<String, Object> config);
>
>      /**
>       * A Weaver must return a List of Annotations he is interested in.
>
> Modified:
> commons/sandbox/privilizer/trunk/processor/src/test/java/org/apache/commons/weaver/test/WeaveProcessorTest.java
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/processor/src/test/java/org/apache/commons/weaver/test/WeaveProcessorTest.java?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> ---
> commons/sandbox/privilizer/trunk/processor/src/test/java/org/apache/commons/weaver/test/WeaveProcessorTest.java
> (original)
> +++
> commons/sandbox/privilizer/trunk/processor/src/test/java/org/apache/commons/weaver/test/WeaveProcessorTest.java
> Thu Dec 20 18:33:37 2012
> @@ -18,7 +18,8 @@
>   */
>  package org.apache.commons.weaver.test;
>
> -import java.util.Properties;
> +import java.util.HashMap;
> +import java.util.Map;
>
>  import org.apache.commons.weaver.test.beans.TestBeanWithClassAnnotation;
>  import org.apache.commons.weaver.test.beans.TestBeanWithMethodAnnotation;
> @@ -41,7 +42,7 @@ public class WeaveProcessorTest extends
>
>          WeaveProcessor wp = WeaveProcessor.getInstance();
>
> -        Properties config = new Properties();
> +        Map<String, Object> config = new HashMap<String, Object>();
>          config.put("configKey", "configValue");
>          wp.configure(config);
>
> @@ -60,6 +61,6 @@ public class WeaveProcessorTest extends
>          Assert.assertEquals(TestBeanWithClassAnnotation.class,
> TestWeaver.wovenClasses.get(0));
>
>          Assert.assertEquals(1, TestWeaver.wovenMethods.size());
> -        Assert.assertEquals(TestBeanWithMethodAnnotation.class,
> TestWeaver.wovenMethods.get(0));
> +        Assert.assertEquals(TestBeanWithMethodAnnotation.class,
> TestWeaver.wovenMethods.get(0).getDeclaringClass());
>      }
>  }
>
> Modified:
> commons/sandbox/privilizer/trunk/processor/src/test/java/org/apache/commons/weaver/test/weaver/TestWeaver.java
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/privilizer/trunk/processor/src/test/java/org/apache/commons/weaver/test/weaver/TestWeaver.java?rev=1424618&r1=1424617&r2=1424618&view=diff
>
> ==============================================================================
> ---
> commons/sandbox/privilizer/trunk/processor/src/test/java/org/apache/commons/weaver/test/weaver/TestWeaver.java
> (original)
> +++
> commons/sandbox/privilizer/trunk/processor/src/test/java/org/apache/commons/weaver/test/weaver/TestWeaver.java
> Thu Dec 20 18:33:37 2012
> @@ -22,7 +22,7 @@ import java.lang.annotation.Annotation;
>  import java.lang.reflect.Method;
>  import java.util.ArrayList;
>  import java.util.List;
> -import java.util.Properties;
> +import java.util.Map;
>
>  import org.apache.commons.weaver.test.beans.TestAnnotation;
>  import org.junit.Assert;
> @@ -39,12 +39,12 @@ public class TestWeaver implements Weave
>      public static List<Class> wovenClasses = new ArrayList<Class>();
>
>      @Override
> -    public void configure(Properties config)
> +    public void configure(Map<String, Object> config)
>      {
>          Assert.assertNotNull(config);
>          Assert.assertEquals(1, config.size());
>
> -        String configValue = config.getProperty("configKey");
> +        String configValue = (String) config.get("configKey");
>          Assert.assertEquals("configValue", configValue);
>      }
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message