You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gd...@apache.org on 2008/11/08 01:37:36 UTC

svn commit: r712325 [1/2] - in /geronimo/server/trunk: buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ framework/configs/j2ee-system/ framework/configs/j2ee-system/src/main/history/ framework/configs/j2ee-system/src/ma...

Author: gdamour
Date: Fri Nov  7 16:37:34 2008
New Revision: 712325

URL: http://svn.apache.org/viewvc?rev=712325&view=rev
Log:
When a ConfigurationData is loaded from a ConfigurationStore, its dependencies are transformed through the execution of Groovy scripts matching the pattern Dependencies(.*).groovy located in the same directory than the configuration being loaded.

Also a ConfigurationDataTransformer gets attached to the ConfigurationData so that when GBeans are loaded subsequently when the Configuration ClassLoader is available they can be transformed through the execution of Groovy scripts matching the pattern GBeans(.*).groovy located in the same directory than the configuration being loaded.

(GERONIMO-4401) Extension of configuration dependencies and gbeans via Groovy scripts

Added:
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/pom.xml
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/ConfigurationDataBuilder.groovy
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/GBeanAttributeAndReferenceBuilder.groovy
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/GBeanDataBuilder.groovy
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/ReferenceBuilder.groovy
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/CollocatedWithConfigInfoLocater.java
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/GroovyScriptException.java
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/GroovyTransformer.java
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/PatternFilter.java
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/ScriptLocater.java
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/resources/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/ConfigurationDataBuilderTest.groovy
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/GBeanAttributeAndReferenceBuilderTest.groovy
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/GBeanDataBuilderTest.groovy
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/ReferenceBuilderTest.groovy
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/CollocatedWithConfigInfoLocaterTest.java
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/DummyGBean.java
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/GroovyTransformerTest.java
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/PatternFilterTest.java
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/configurationDir/
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/configurationDir/DependenciesTest.groovy
    geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/configurationDir/GBeansTest.groovy
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationDataTransformer.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NoOConfigurationDataTransformer.java
    geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/RMockTestSupport.java
    geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/TestUtil.java
Modified:
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/MavenConfigStore.java
    geronimo/server/trunk/framework/configs/j2ee-system/pom.xml
    geronimo/server/trunk/framework/configs/j2ee-system/src/main/history/dependencies.xml
    geronimo/server/trunk/framework/configs/j2ee-system/src/main/plan/plan.xml
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
    geronimo/server/trunk/framework/modules/pom.xml
    geronimo/server/trunk/testsupport/testsupport-common/src/main/java/org/apache/geronimo/testsupport/TestSupport.java

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/MavenConfigStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/MavenConfigStore.java?rev=712325&r1=712324&r2=712325&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/MavenConfigStore.java (original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/MavenConfigStore.java Fri Nov  7 16:37:34 2008
@@ -27,6 +27,7 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoOConfigurationDataTransformer;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.repository.Artifact;

Modified: geronimo/server/trunk/framework/configs/j2ee-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/j2ee-system/pom.xml?rev=712325&r1=712324&r2=712325&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/j2ee-system/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/j2ee-system/pom.xml Fri Nov  7 16:37:34 2008
@@ -43,6 +43,12 @@
 
         <dependency>
             <groupId>org.apache.geronimo.framework</groupId>
+            <artifactId>geronimo-config-groovy-transformer</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.framework</groupId>
             <artifactId>geronimo-system</artifactId>
             <version>${version}</version>
         </dependency>
@@ -95,6 +101,11 @@
             <groupId>com.sun.xml.bind</groupId>
             <artifactId>jaxb-impl</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-all-minimal</artifactId>
+        </dependency>
         
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
@@ -182,6 +193,15 @@
                             <artifactId>geronimo-kernel</artifactId>
                             <version>${version}</version>
                         </element>
+                        <element>
+                            <groupId>org.apache.geronimo.framework</groupId>
+                            <artifactId>geronimo-config-groovy-transformer</artifactId>
+                            <version>${version}</version>
+                        </element>
+                        <element>
+                            <groupId>org.codehaus.groovy</groupId>
+                            <artifactId>groovy-all-minimal</artifactId>
+                        </element>
                         <!--
                         NOTE: geronimo-transformer needs to be on the system classpath to avoid a potential deadlock. See GERONIMO-3141.
                         -->

Modified: geronimo/server/trunk/framework/configs/j2ee-system/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/j2ee-system/src/main/history/dependencies.xml?rev=712325&r1=712324&r2=712325&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/j2ee-system/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/framework/configs/j2ee-system/src/main/history/dependencies.xml Fri Nov  7 16:37:34 2008
@@ -7,6 +7,11 @@
         <type>car</type>
     </module-id>
     <dependency>
+        <groupId>asm</groupId>
+        <artifactId>asm</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>javax.xml.bind</groupId>
         <artifactId>jaxb-api</artifactId>
         <type>jar</type>
@@ -27,11 +32,6 @@
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>com.sun.xml.bind</groupId>
-        <artifactId>jaxb-impl</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>geronimo-activation_1.1_spec</artifactId>
         <type>jar</type>
@@ -42,69 +42,68 @@
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>com.envoisolutions.sxc</groupId>
-        <artifactId>sxc-runtime</artifactId>
+        <groupId>org.apache.geronimo.specs</groupId>
+        <artifactId>geronimo-stax-api_1.0_spec</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.framework</groupId>
-        <artifactId>geronimo-crypto</artifactId>
+        <groupId>asm</groupId>
+        <artifactId>asm-commons</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.codehaus.woodstox</groupId>
-        <artifactId>wstx-asl</artifactId>
+        <groupId>commons-cli</groupId>
+        <artifactId>commons-cli</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+        <groupId>com.thoughtworks.xstream</groupId>
+        <artifactId>xstream</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
         <groupId>org.apache.geronimo.framework</groupId>
-        <artifactId>geronimo-system</artifactId>
+        <artifactId>geronimo-config-groovy-transformer</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.framework</groupId>
-        <artifactId>geronimo-transformer</artifactId>
+        <groupId>log4j</groupId>
+        <artifactId>log4j</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>asm</groupId>
-        <artifactId>asm</artifactId>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
         <groupId>org.slf4j</groupId>
-        <artifactId>slf4j-log4j12</artifactId>
+        <artifactId>jcl-over-slf4j</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.slf4j</groupId>
-        <artifactId>jcl-over-slf4j</artifactId>
+        <groupId>com.sun.xml.bind</groupId>
+        <artifactId>jaxb-impl</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.slf4j</groupId>
-        <artifactId>jul-to-slf4j</artifactId>
+        <groupId>org.apache.geronimo.framework</groupId>
+        <artifactId>geronimo-kernel</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>commons-cli</groupId>
-        <artifactId>commons-cli</artifactId>
+        <groupId>cglib</groupId>
+        <artifactId>cglib-nodep</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>asm</groupId>
-        <artifactId>asm-commons</artifactId>
+        <groupId>org.codehaus.woodstox</groupId>
+        <artifactId>wstx-asl</artifactId>
         <type>jar</type>
     </dependency>
-    <!-- in classpath: now also accessible from repo -->
     <dependency>
-        <groupId>org.apache.xbean</groupId>
-        <artifactId>xbean-reflect</artifactId>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-log4j12</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
@@ -114,33 +113,42 @@
     </dependency>
     <dependency>
         <groupId>org.apache.geronimo.framework</groupId>
-        <artifactId>geronimo-kernel</artifactId>
+        <artifactId>geronimo-crypto</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>cglib</groupId>
-        <artifactId>cglib-nodep</artifactId>
+        <groupId>com.envoisolutions.sxc</groupId>
+        <artifactId>sxc-runtime</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.codehaus.groovy</groupId>
+        <artifactId>groovy-all-minimal</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
         <groupId>org.apache.geronimo.framework</groupId>
-        <artifactId>geronimo-cli</artifactId>
+        <artifactId>geronimo-system</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>com.thoughtworks.xstream</groupId>
-        <artifactId>xstream</artifactId>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-reflect</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.geronimo.framework</groupId>
+        <artifactId>geronimo-transformer</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
         <groupId>org.slf4j</groupId>
-        <artifactId>slf4j-api</artifactId>
+        <artifactId>jul-to-slf4j</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>log4j</groupId>
-        <artifactId>log4j</artifactId>
+        <groupId>org.apache.geronimo.framework</groupId>
+        <artifactId>geronimo-cli</artifactId>
         <type>jar</type>
     </dependency>
-             
 </plugin-artifact>

Modified: geronimo/server/trunk/framework/configs/j2ee-system/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/j2ee-system/src/main/plan/plan.xml?rev=712325&r1=712324&r2=712325&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/j2ee-system/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/framework/configs/j2ee-system/src/main/plan/plan.xml Fri Nov  7 16:37:34 2008
@@ -46,11 +46,16 @@
         <attribute name="serverStarted">false</attribute>
     </gbean>
 
+    <gbean name="ConfigurationDataTransformer" class="org.apache.geronimo.kernel.config.transformer.GroovyTransformer" />
+
     <!--Configuration Store service-->
     <gbean name="Local" class="org.apache.geronimo.system.configuration.RepositoryConfigurationStore">
         <reference name="Repository">
             <name>Repository</name>
         </reference>
+        <reference name="ConfigurationDataTransformer">
+            <name>ConfigurationDataTransformer</name>
+        </reference>
     </gbean>
 
     <!--User-editable attribute service-->

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/pom.xml?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/pom.xml (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/pom.xml Fri Nov  7 16:37:34 2008
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+    
+       http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<!-- $Rev: 690859 $ $Date: 2008-09-01 16:30:25 +1000 (Mon, 01 Sep 2008) $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.framework</groupId>
+        <artifactId>modules</artifactId>
+        <version>2.2-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>geronimo-config-groovy-transformer</artifactId>
+    <name>Geronimo Framework, Modules :: Config Groovy Transformer</name>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.framework</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-all-minimal</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.groovy.maven</groupId>
+                <artifactId>gmaven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generateStubs</goal>
+                            <goal>compile</goal>
+                            <goal>generateTestStubs</goal>
+                            <goal>testCompile</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    
+</project>
+

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/ConfigurationDataBuilder.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/ConfigurationDataBuilder.groovy?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/ConfigurationDataBuilder.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/ConfigurationDataBuilder.groovy Fri Nov  7 16:37:34 2008
@@ -0,0 +1,13 @@
+/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.geronimo.kernel.config.transformer
 
import org.apache.geronimo.kernel.Jsr77Naming
import org.apache.geronimo.gbean.GBeanInfo
import org.apache.geronimo.gbean.GBe
 anData
import org.apache.geronimo.gbean.GBeanData
import org.apache.geronimo.kernel.repository.Version
import org.apache.geronimo.kernel.config.ConfigurationData
import org.apache.geronimo.kernel.repository.ImportType
import org.apache.geronimo.kernel.repository.Artifact
import org.apache.geronimo.kernel.repository.Dependency
+
/**
 *
 * @version $Rev:$ $Date:$
 */
class ConfigurationDataBuilder {
+    private final ConfigurationData configurationData
+    
+    ConfigurationDataBuilder(ConfigurationData configurationData) {
+        assert null != configurationData : 'configurationData is required'
+        this.configurationData = configurationData
+    }
    
    def configure (Closure closure) {
        closure.delegate = this
        closure()
    }
+
+    def addDependency(Map dependencyDeclaration) throws GroovyScriptException {
        def throwUsage = {
            throw new GroovyScriptException('addDependency usage: addDependency(groupId: group, artifactId: artifact, version: X, type: type, importType: ImportType.X)')
        }

        ensureNotNull(dependencyDeclaration.groupId, throwUsage)
        ensureNotNull(dependencyDeclaration.artifactId, throwUsage)

        if (!dependencyDeclaration.type) {
            dependencyDeclaration.type = 'jar'
        }

        def artifact = buildArtifact(dependencyDeclaration)
        
        def importType = dependencyDeclaration.importType
        if (!importType) {
            importType = ImportType.ALL
        }
        
        configurationData.environment.addDependency(artifact, importType)
    }
+    
    def removeDependency(Map dependencyFilter) throws GroovyScriptException {
        def throwUsage = {
            throw new GroovyScriptException('removeDependency usage: removeDependency(groupId: group, artifactId: artifact, version: X, type: type)')
        }

        def filteredArtifact = buildArtifact(dependencyFilter)
        def filteredDependencies = configurationData.environment.dependencies.findAll { dependency ->
            !filteredArtifact.matches(dependency.artifact)
        }

        configurationData.environment.dependencies = filteredDependencies
    }
+
    protected def buildArtifact(dependencyDeclaration) throws GroovyScriptException {
        def groupId = dependencyDeclaration.groupId
        def artifactId = dependencyDeclaration.artifactId
        def version = dependencyDeclaration.version
        def type = dependencyDeclaration.type

        new Artifact(groupId, artifactId, (String) version, type)
    }
    
    protected def ensureNotNull(value, throwUsage) throws GroovyScriptException {
        if (!value) {
            throwUsage()
        }
    }
    
+}
\ No newline at end of file

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/GBeanAttributeAndReferenceBuilder.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/GBeanAttributeAndReferenceBuilder.groovy?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/GBeanAttributeAndReferenceBuilder.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/GBeanAttributeAndReferenceBuilder.groovy Fri Nov  7 16:37:34 2008
@@ -0,0 +1,11 @@
+/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.geronimo.kernel.config.transformer

import org.apache.geronimo.gbean.GBeanInfo
import org.apache.geronimo.gbean.GBeanData
import org.apache.geronimo.gbean.GBeanDa
 ta
import org.apache.geronimo.kernel.repository.Version
import org.apache.geronimo.kernel.config.ConfigurationData
import org.apache.geronimo.kernel.repository.ImportType
import org.apache.geronimo.kernel.repository.Artifact
import org.apache.geronimo.kernel.repository.Dependency
+
/**
 *
 * @version $Rev:$ $Date:$
 */
class GBeanAttributeAndReferenceBuilder {
+    private final def configurationData
+    private final def gbeanData
+    
+    GBeanAttributeAndReferenceBuilder(configurationData, gbeanData) {
+        assert null != configurationData : 'configurationData is required'
+        assert null != gbeanData : 'gbeanData is required'
+        this.configurationData = configurationData
+        this.gbeanData = gbeanData
+    }
   
    def attribute(Map attributeInfo) {
        def throwUsage = {
            throw new GroovyScriptException('attribute usage: attribute(attributeName: attributeValue)')
        }

        def mapIter = attributeInfo.entrySet().iterator()
        if (!mapIter.hasNext()) {
            throwUsage()
        }
        
        def entry = mapIter.next()
        def key = entry.key
        def value = entry.value
        gbeanData.setAttribute(key, value)
    }
 
    def reference(Object[] referenceInfo) {
        def throwUsage = {
            throw new GroovyScriptException('reference usage: reference(referenceName) {pattern(patternValue)}')
        }
        
        if (2 != referenceInfo.length) {
            throwUsage()
        }
        
        def name = referenceInfo[0]
        if (!(name instanceof String)) {
            throwUsage()
        }
        
        def referenceDeclarationClosure = referenceInfo[1]
        if (!(referenceDeclarationClosure insta
 nceof Closure)) {
            throwUsage()
        }

        def referenceBuilder = new ReferenceBuilder()
        referenceDeclarationClosure.delegate = referenceBuilder
        referenceDeclarationClosure()
        
        gbeanData.setReferencePatterns(name, referenceBuilder.references)
    }

}
\ No newline at end of file

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/GBeanDataBuilder.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/GBeanDataBuilder.groovy?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/GBeanDataBuilder.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/GBeanDataBuilder.groovy Fri Nov  7 16:37:34 2008
@@ -0,0 +1,13 @@
+/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.geronimo.kernel.config.transformer

import org.apache.geronimo.gbean.GBeanData
import org.apache.geronimo.kernel.repository.Version
import org.apache.geronimo.ker
 nel.config.ConfigurationData
import org.apache.geronimo.kernel.repository.ImportType
import org.apache.geronimo.kernel.repository.Artifact
import org.apache.geronimo.kernel.repository.Dependency
+
/**
 *
 * @version $Rev:$ $Date:$
 */
class GBeanDataBuilder {
+    private final def configurationData
+    private final def gbeanDatas
+    
+    GBeanDataBuilder(configurationData, gbeanDatas) {
+        assert null != configurationData : 'configurationData is required'
+        assert null != gbeanDatas : 'gbeanDatas is required'
+        this.configurationData = configurationData
+        this.gbeanDatas = gbeanDatas
+    }
    
    def configure (Closure closure) {
        closure.delegate = this
        closure()
    }
+
+    def addGBean(Map gbeanDeclaration, Closure gbeanClosure) {
        def throwUsage = {
            throw new GroovyScriptException('addGBean usage: addGBean(name: gbeanName, gbean: gbeanClass, type: gbeanType)')
        }

        if (!gbeanDeclaration.name) {
            throwUsage()
        } else if (!gbeanDeclaration.gbean) {
            throwUsage()
        }

        def gbeanName = buildGBeanName(gbeanDeclaration)
        def gbean = gbeanDeclaration.gbean 
        def gbeanData = new GBeanData(gbeanName, gbean)

        gbeanClosure.delegate = new GBeanAttributeAndReferenceBuilder(configurationData, gbeanData)
        gbeanClosure()

        gbeanDatas.push(gbeanData)
    }
    
    protected def buildGBeanName(gbeanDeclaration) throws GroovyScriptException {
        def name = gbeanDeclaration.name

        def type = gbeanDeclaration.type
        if (!type) {
            type = 'GBean'
        }
        
        def naming = configurationData.naming
        nami
 ng.createRootName(configurationData.environment.configId, name, type)
    }
    
}
\ No newline at end of file

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/ReferenceBuilder.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/ReferenceBuilder.groovy?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/ReferenceBuilder.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/groovy/org/apache/geronimo/kernel/config/transformer/ReferenceBuilder.groovy Fri Nov  7 16:37:34 2008
@@ -0,0 +1,5 @@
+/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.geronimo.kernel.config.transformer

import org.apache.geronimo.gbean.AbstractNameQuery
import org.apache.geronimo.gbean.GBeanInfo
import org.apache.geronimo.gbean
 .GBeanData
import org.apache.geronimo.gbean.GBeanData
import org.apache.geronimo.kernel.repository.Version
import org.apache.geronimo.kernel.config.ConfigurationData
import org.apache.geronimo.kernel.repository.ImportType
import org.apache.geronimo.kernel.repository.Artifact
import org.apache.geronimo.kernel.repository.Dependency
+
/**
 *
 * @version $Rev:$ $Date:$
 */
class ReferenceBuilder {
+    Set references
    
+    ReferenceBuilder() {
+        references = []
    }
   
    def pattern(String pattern) {
        try {
            references.add(new AbstractNameQuery(new URI(pattern)))
        } catch (Exception e) {
            throw new GroovyScriptException('pattern usage: pattern(patternValue)')
        }
    }
 
}
\ No newline at end of file

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/CollocatedWithConfigInfoLocater.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/CollocatedWithConfigInfoLocater.java?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/CollocatedWithConfigInfoLocater.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/CollocatedWithConfigInfoLocater.java Fri Nov  7 16:37:34 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer;
+
+import java.io.File;
+
+import org.apache.geronimo.kernel.config.ConfigurationData;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class CollocatedWithConfigInfoLocater implements ScriptLocater {
+
+    public File locate(ConfigurationData configurationData) {
+        return configurationData.getConfigurationDir();
+    }
+
+}

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/GroovyScriptException.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/GroovyScriptException.java?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/GroovyScriptException.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/GroovyScriptException.java Fri Nov  7 16:37:34 2008
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer;
+
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class GroovyScriptException extends InvalidConfigException {
+
+    public GroovyScriptException() {
+    }
+
+    public GroovyScriptException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public GroovyScriptException(String message) {
+        super(message);
+    }
+
+    public GroovyScriptException(Throwable cause) {
+        super(cause);
+    }
+
+}

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/GroovyTransformer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/GroovyTransformer.java?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/GroovyTransformer.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/GroovyTransformer.java Fri Nov  7 16:37:34 2008
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer;
+
+import groovy.lang.Binding;
+import groovy.lang.GroovyShell;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationDataTransformer;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class GroovyTransformer implements ConfigurationDataTransformer {
+    private static final String BINDING_CONFIGURATION_DATA = "configurationData";
+    private static final String BINDING_CONFIGURATION_DATA_BUILDER = "configurationDataBuilder";
+    private static final Pattern PATTERN_DEPENDENCIES_FILE = Pattern.compile("Dependencies(.*).groovy"); 
+
+    private static final String BINDING_GBEAN_DATAS = "gbeanDatas";
+    private static final String BINDING_GBEAN_DATAS_BUILDER = "gbeanDataBuilder";
+    private static final Pattern PATTERN_GBEANS_FILE = Pattern.compile("GBeans(.*).groovy"); 
+    
+    private final ScriptLocater scriptLocater;
+
+    public GroovyTransformer() {
+        scriptLocater = newScriptLocater();
+    }
+
+    public void transformDependencies(ConfigurationData configurationData) throws InvalidConfigException {
+        configurationData.setConfigurationDataTransformer(this);
+
+        File scriptDir = scriptLocater.locate(configurationData);
+        
+        Map<String, Object> bindings = new HashMap<String, Object>();
+        bindings.put(BINDING_CONFIGURATION_DATA, configurationData);
+        bindings.put(BINDING_CONFIGURATION_DATA_BUILDER, new ConfigurationDataBuilder(configurationData));
+        Binding binding = new Binding(bindings);
+        GroovyShell shell = new GroovyShell(binding);
+
+        executeScripts(shell, scriptDir, PATTERN_DEPENDENCIES_FILE);
+    }
+
+    public List<GBeanData> transformGBeans(ClassLoader classLoader,
+            ConfigurationData configurationData,
+            List<GBeanData> gbeanDatas) throws InvalidConfigException {
+        gbeanDatas = new ArrayList<GBeanData>(gbeanDatas);
+        
+        File scriptDir = scriptLocater.locate(configurationData);
+
+        Map<String, Object> bindings = new HashMap<String, Object>();
+        bindings.put(BINDING_CONFIGURATION_DATA, configurationData);
+        bindings.put(BINDING_GBEAN_DATAS, gbeanDatas);
+        bindings.put(BINDING_GBEAN_DATAS_BUILDER, new GBeanDataBuilder(configurationData, gbeanDatas));
+        Binding binding = new Binding(bindings);
+        GroovyShell shell = new GroovyShell(classLoader, binding);
+
+        executeScripts(shell, scriptDir, PATTERN_GBEANS_FILE);
+
+        return gbeanDatas;
+    }
+    
+    public void remove(Artifact configId) {
+    }
+    
+    protected ScriptLocater newScriptLocater() {
+        return new CollocatedWithConfigInfoLocater();
+    }
+
+    protected void executeScripts(GroovyShell shell, File scriptDir, Pattern pattern) throws InvalidConfigException {
+        File[] scripts = scriptDir.listFiles(new PatternFilter(pattern));
+        executeScripts(shell, scripts);
+    }
+
+    protected void executeScripts(GroovyShell shell, File[] scripts) throws InvalidConfigException {
+        for (File script : scripts) {
+            try {
+                shell.evaluate(script);
+            } catch (Exception e) {
+                if (e instanceof InvalidConfigException) {
+                    throw (InvalidConfigException) e;
+                }
+                throw new GroovyScriptException("Error while evaluating [" + script.getAbsolutePath() + "]", e);
+            }
+        }
+    }
+
+}

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/PatternFilter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/PatternFilter.java?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/PatternFilter.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/PatternFilter.java Fri Nov  7 16:37:34 2008
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class PatternFilter implements FileFilter {
+
+    private final Pattern pattern;
+    
+    public PatternFilter(Pattern pattern) {
+        if (null == pattern) {
+            throw new IllegalArgumentException("pattern is required");
+        }
+        this.pattern = pattern;
+    }
+
+    public boolean accept(File pathname) {
+        Matcher matcher = pattern.matcher(pathname.getName());
+        return matcher.matches();
+    }
+
+}
\ No newline at end of file

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/ScriptLocater.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/ScriptLocater.java?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/ScriptLocater.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/main/java/org/apache/geronimo/kernel/config/transformer/ScriptLocater.java Fri Nov  7 16:37:34 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer;
+
+import java.io.File;
+
+import org.apache.geronimo.kernel.config.ConfigurationData;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public interface ScriptLocater {
+    File locate(ConfigurationData configurationData);
+}

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/ConfigurationDataBuilderTest.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/ConfigurationDataBuilderTest.groovy?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/ConfigurationDataBuilderTest.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/ConfigurationDataBuilderTest.groovy Fri Nov  7 16:37:34 2008
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer
+
+import org.apache.geronimo.kernel.config.transformer.ConfigurationDataBuilder
import org.apache.geronimo.kernel.repository.ImportType
+import org.apache.geronimo.kernel.config.ConfigurationData
import org.apache.geronimo.kernel.Jsr77Naming
import org.apache.geronimo.kernel.repository.Artifact
import org.apache.geronimo.kernel.config.transformer.GroovyScriptException

/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+class ConfigurationDataBuilderTest extends GroovyTestCase {
+     def builder
+     def configurationData
+     
+     protected void setUp() {
+         def artifact = new Artifact('groupId', 'artifactId', '1,0', 'car')
+         configurationData = new ConfigurationData(artifact, new Jsr77Naming())
+         builder = new ConfigurationDataBuilder(configurationData)
+     }
+     
+     void testAddDependency() {
+         def addedArtifact = new Artifact('group', 'artifact', '1,0', 'tar')
+         
+         builder.addDependency(groupId: addedArtifact.groupId, 
+                 artifactId: addedArtifact.artifactId, 
+                 version: addedArtifact.version, 
+                 type: addedArtifact.type, 
+                 importType: ImportType.SERVICES)
+
+         def dependencies = configurationData.environment.dependencies
+         assertEquals(1, dependencies.size())
+         def dependency = dependencies[0]
+         assertEquals(addedArtifact, dependency.artifact)
+         assertEquals(ImportType.SERVICES, dependency.importType)
+     }
+
+     void testAddDependencyOnlyWithGroupAndArtifact() {
+         def group = 'group'
+         def artifact = 'artifact'
+         
+         builder.addDependency(groupId: group, artifactId: artifact)
+
+         def dependencies = configurationData.environment.dependencies
+         assertEquals(1, dependencies.size())
+         def dependency = dependencies[0]
+         def depArtifact = dependency.artifact
+         assertEquals(group, depArtifact.groupId)
+         assertEquals(artifact, depArtifact.artifactId)
+         assertEquals('jar', depArtifact.type)
+         assertEquals(ImportType.ALL, dependency.importType)
+     }
+
+     void testAddDependencyThrowsGSEIfGroupIsMissing() {
+         def addedArtifact = new Artifact(null, 'artifact', '1.0', 'jar')
+
+         shouldFail(GroovyScriptException) {
+             builder.addDependency(groupId: addedArtifact.groupId, 
+                     artifactId: addedArtifact.artifactId, 
+                     version: addedArtifact.version, 
+                     type: addedArtifact.type,
+                     importType: ImportType.SERVICES)
+         }
+     }
+
+     void testRemoveDependency() {
+         def addedArtifact = new Artifact('group', 'artifact', '1,0', 'tar')
+         
+         builder.addDependency(groupId: addedArtifact.groupId, 
+                 artifactId: addedArtifact.artifactId, 
+                 version: addedArtifact.version, 
+                 type: addedArtifact.type, 
+                 importType: ImportType.SERVICES)
+
+         builder.removeDependency(artifactId: addedArtifact.artifactId)
+                 
+         def dependencies = configurationData.environment.dependencies
+         assertTrue(dependencies.empty)
+     }
+
+ }
\ No newline at end of file

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/GBeanAttributeAndReferenceBuilderTest.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/GBeanAttributeAndReferenceBuilderTest.groovy?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/GBeanAttributeAndReferenceBuilderTest.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/GBeanAttributeAndReferenceBuilderTest.groovy Fri Nov  7 16:37:34 2008
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer
+
+import org.apache.geronimo.gbean.GBeanData
import org.apache.geronimo.kernel.config.transformer.GroovyScriptException
/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+class GBeanAttributeAndReferenceBuilderTest extends GroovyTestCase {
+     def gbeanData
+     def builder
+     
+     protected void setUp() {
+         gbeanData = new GBeanData()
+         builder = new GBeanAttributeAndReferenceBuilder(new Object(), gbeanData)
+     }
+     
+     void testAttribute() {
+         def value = 'value'
+         builder.attribute(name: value)
+         assertEquals(value, gbeanData.getAttribute('name'))
+	}
+
+     void testAttributeThrowsGSEIfEmptyMap() {
+         shouldFail(GroovyScriptException) {
+             builder.attribute([:])
+         }
+	}
+
+ }
\ No newline at end of file

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/GBeanDataBuilderTest.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/GBeanDataBuilderTest.groovy?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/GBeanDataBuilderTest.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/GBeanDataBuilderTest.groovy Fri Nov  7 16:37:34 2008
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer
+
+import org.apache.geronimo.kernel.config.transformer.GBeanDataBuilder
import org.apache.geronimo.kernel.config.transformer.GroovyScriptException
import org.apache.geronimo.kernel.config.ConfigurationData
import org.apache.geronimo.kernel.repository.Artifact
import org.apache.geronimo.kernel.Jsr77Naming
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+class GBeanDataBuilderTest extends GroovyTestCase {
+     def builder
+     def gbeanDatas
+     
+     protected void setUp() {
+         gbeanDatas = []
+
+         def artifact = new Artifact('groupId', 'artifactId', '1,0', 'car')
+         def configurationData = new ConfigurationData(artifact, new Jsr77Naming())
+         builder = new GBeanDataBuilder(configurationData, gbeanDatas)
+     }
+     
+     void testAddGBean() {
+         builder.addGBean(name: 'name', gbean: DummyGBean, type: 'DummyGBeanType') {}
+         
+         assertEquals(1, gbeanDatas.size())
+         def gbeanData = gbeanDatas[0]
+         
+         assertEquals(DummyGBean.class.name, gbeanData.gbeanInfo.className)
+
+         def abstractName = gbeanData.abstractName
+         assertEquals('name', abstractName.getNameProperty(Jsr77Naming.J2EE_NAME))
+         assertEquals('DummyGBeanType', abstractName.getNameProperty(Jsr77Naming.J2EE_TYPE))
+	}
+
+     void testAddGBeanWithoutTypeDefaultsToGBeanType() {
+         builder.addGBean(name: 'name', gbean: DummyGBean) {}
+         
+         def gbeanData = gbeanDatas[0]
+         def abstractName = gbeanData.abstractName
+         assertEquals('GBean', abstractName.getNameProperty(Jsr77Naming.J2EE_TYPE))
+	}
+
+     void testAddGBeanWihoutNameThrowsGSE() {
+         shouldFailWithCause(GroovyScriptException) {
+             builder.addGBean(gbean: DummyGBean, type: 'DummyGBeanType') {}
+         }
+	}
+
+     void testAddGBeanWihoutClassThrowsGSE() {
+         shouldFailWithCause(GroovyScriptException) {
+             builder.addGBean(name: 'name', type: 'DummyGBeanType') {}
+         }
+	}
+
+ }
\ No newline at end of file

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/ReferenceBuilderTest.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/ReferenceBuilderTest.groovy?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/ReferenceBuilderTest.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/groovy/org/apache/geronimo/kernel/config/transformer/ReferenceBuilderTest.groovy Fri Nov  7 16:37:34 2008
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer
+
+import org.apache.geronimo.kernel.config.transformer.ReferenceBuilder
import org.apache.geronimo.gbean.AbstractNameQuery
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+class ReferenceBuilderTest extends GroovyTestCase {
+    def builder
+     
+    protected void setUp() {
+        builder = new ReferenceBuilder()     
+    }
+     
+    void testReference() {
+        builder.pattern('group/artifact/1.0/jar')
+        
+        assertEquals(1, builder.references.size())
+        assertEquals(AbstractNameQuery, builder.references.iterator().next().class)
+	}
+
+    void testReferenceThrowsGSEIfIncorrectPattern() {
+        shouldFailWithCause(GroovyScriptException) {
+            builder.pattern('incorrect')
+        }
+    }
+    
+}
\ No newline at end of file

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/CollocatedWithConfigInfoLocaterTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/CollocatedWithConfigInfoLocaterTest.java?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/CollocatedWithConfigInfoLocaterTest.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/CollocatedWithConfigInfoLocaterTest.java Fri Nov  7 16:37:34 2008
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer;
+
+import java.io.File;
+
+import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class CollocatedWithConfigInfoLocaterTest extends TestCase {
+
+    public void testLocate() throws Exception {
+        CollocatedWithConfigInfoLocater locater = new CollocatedWithConfigInfoLocater();
+        ConfigurationData configurationData = new ConfigurationData(new Artifact("group", "artifact", "1.0", "car"),
+                new Jsr77Naming());
+        File expectedLocation = new File("dir");
+        configurationData.setConfigurationDir(expectedLocation);
+        assertSame(expectedLocation, locater.locate(configurationData));
+    }
+    
+}

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/DummyGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/DummyGBean.java?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/DummyGBean.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/DummyGBean.java Fri Nov  7 16:37:34 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer;
+
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class DummyGBean {
+
+    public DummyGBean(@ParamAttribute(name = "name") String name,
+            @ParamReference(name = "reference") Runnable runnable) {
+    }
+    
+}

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/GroovyTransformerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/GroovyTransformerTest.java?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/GroovyTransformerTest.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/GroovyTransformerTest.java Fri Nov  7 16:37:34 2008
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.geronimo.kernel.config.transformer;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.ReferencePatterns;
+import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Dependency;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.testsupport.RMockTestSupport;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class GroovyTransformerTest extends RMockTestSupport {
+
+    private GroovyTransformer transformer;
+    private ConfigurationData configurationData;
+
+    @Override
+    protected void setUp() throws Exception {
+        final ScriptLocater scriptLocater = (ScriptLocater) mock(ScriptLocater.class);
+        transformer = new GroovyTransformer() {
+            @Override
+            protected ScriptLocater newScriptLocater() {
+                return scriptLocater;
+            }
+        };
+
+        Artifact configArtifact = new Artifact("group", "configArtifact", "1.0", "car");
+        configurationData = new ConfigurationData(configArtifact , new Jsr77Naming());
+        
+        scriptLocater.locate(configurationData);
+        modify().returnValue(resolveFile("src/test/resources/configurationDir"));
+    }
+    
+    public void testTransformDependencies() throws Exception {
+        startVerification();
+        
+        Environment environment = configurationData.getEnvironment();
+        environment.addDependency(new Dependency(new Artifact("group", "artifactToRemove", "1.0", "jar"), ImportType.ALL));
+
+        transformer.transformDependencies(configurationData);
+        
+        List<Dependency> newDependencies = environment.getDependencies();
+        assertEquals(1, newDependencies.size());
+        Dependency newDependency = newDependencies.get(0);
+        assertEquals(new Artifact("group", "artifactToAdd", "1.0", "jar"), newDependency.getArtifact());
+        assertSame(ImportType.SERVICES, newDependency.getImportType());
+        
+        assertSame(transformer, configurationData.getConfigurationDataTransformer());
+    }
+    
+    public void testTransformGBeans() throws Exception {
+        startVerification();
+        
+        GBeanData existingGBean = new GBeanData(DummyGBean.class);
+        List gbeans = Collections.singletonList(existingGBean);
+        List<GBeanData> newGBeans = transformer.transformGBeans(getClass().getClassLoader(), configurationData, gbeans);
+        assertEquals(2, newGBeans.size());
+        assertSame(existingGBean, newGBeans.get(0));
+        
+        GBeanData addedGBean = newGBeans.get(1);
+        assertEquals(DummyGBean.class.getName(), addedGBean.getGBeanInfo().getClassName());
+        assertEquals("value", addedGBean.getAttribute("attributeName"));
+        ReferencePatterns patterns = addedGBean.getReferencePatterns("referenceName");
+        Set<AbstractNameQuery> nameQueries = patterns.getPatterns();
+        assertEquals(2, nameQueries.size());
+    }
+    
+}

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/PatternFilterTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/PatternFilterTest.java?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/PatternFilterTest.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/java/org/apache/geronimo/kernel/config/transformer/PatternFilterTest.java Fri Nov  7 16:37:34 2008
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config.transformer;
+
+import java.io.File;
+import java.util.regex.Pattern;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class PatternFilterTest extends TestCase {
+
+    private PatternFilter filter;
+
+    @Override
+    protected void setUp() throws Exception {
+        Pattern pattern = Pattern.compile("prefix-(.*).groovy");
+        filter = new PatternFilter(pattern);
+    }
+    
+    public void testMatchingFileReturnsTrue() throws Exception {
+        assertTrue(filter.accept(new File("mock/dir/prefix-123.groovy")));
+    }
+    
+    public void testNotMatchingFileReturnsFalse() throws Exception {
+        assertFalse(filter.accept(new File("mock/dir/undefined-123.groovy")));
+    }
+    
+}

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/configurationDir/DependenciesTest.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/configurationDir/DependenciesTest.groovy?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/configurationDir/DependenciesTest.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/configurationDir/DependenciesTest.groovy Fri Nov  7 16:37:34 2008
@@ -0,0 +1,9 @@
+import org.apache.geronimo.kernel.repository.ImportType
+
+assert null != configurationData : 'property configurationData is not exported'
+assert null != configurationDataBuilder : 'property configurationDataBuilder is not exported'
+
+configurationDataBuilder.configure {
+    addDependency(groupId: "group", artifactId: "artifactToAdd", version: "1.0", type: "jar", importType: ImportType.SERVICES)
+    removeDependency(groupId: "group", artifactId: "artifactToRemove", version: "1.0")
+}

Added: geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/configurationDir/GBeansTest.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/configurationDir/GBeansTest.groovy?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/configurationDir/GBeansTest.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-config-groovy-transformer/src/test/resources/configurationDir/GBeansTest.groovy Fri Nov  7 16:37:34 2008
@@ -0,0 +1,15 @@
+import org.apache.geronimo.kernel.config.transformer.DummyGBean
+
+assert null != configurationData : 'property configurationData is not exported'
+assert null != gbeanDatas : 'property gbeanDatas is not exported'
+assert null != gbeanDataBuilder : 'property gbeanDataBuilder is not exported'
+
+gbeanDataBuilder.configure {
+    addGBean(name: 'name', gbean: DummyGBean) {
+        attribute(attributeName: 'value')
+        reference('referenceName') {
+            pattern('group/artifact//?name=name')
+            pattern('group/artifact//?name=name2')
+        }
+    }
+}

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java?rev=712325&r1=712324&r2=712325&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java Fri Nov  7 16:37:34 2008
@@ -98,6 +98,11 @@
      * The configuration store from which this configuration was loaded, or null if it was not loaded from a configuration store.
      */
     private transient ConfigurationStore configurationStore;
+    
+    /**
+     * A transformer to transform the GBeans of this configuration. 
+     */
+    private ConfigurationDataTransformer configurationDataTransformer;
 
     public ConfigurationData(Artifact configId, Naming naming, GBeanState gbeanState) {
         this(new Environment(configId), naming, gbeanState);
@@ -169,7 +174,11 @@
 
     public List getGBeans(ClassLoader classLoader) throws InvalidConfigException {
         if (classLoader == null) throw new NullPointerException("classLoader is null");
-        return gbeanState.getGBeans(classLoader);
+        List<GBeanData> gbeans = gbeanState.getGBeans(classLoader);
+        if (null == configurationDataTransformer) {
+            return gbeans;
+        }
+        return configurationDataTransformer.transformGBeans(classLoader, this, gbeans);
     }
 
     public void addGBean(GBeanData gbeanData) {
@@ -258,4 +267,13 @@
         if (configurationStore == null) throw new NullPointerException("configurationStore is null");
         this.configurationStore = configurationStore;
     }
+    
+    public ConfigurationDataTransformer getConfigurationDataTransformer() {
+        return configurationDataTransformer;
+    }
+
+    public void setConfigurationDataTransformer(ConfigurationDataTransformer configurationDataTransformer) {
+        this.configurationDataTransformer = configurationDataTransformer;
+    }
+
 }

Added: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationDataTransformer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationDataTransformer.java?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationDataTransformer.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationDataTransformer.java Fri Nov  7 16:37:34 2008
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config;
+
+import java.util.List;
+
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public interface ConfigurationDataTransformer {
+    void transformDependencies(ConfigurationData configurationData) throws InvalidConfigException;
+
+    List<GBeanData> transformGBeans(ClassLoader classLoader,
+            ConfigurationData configurationData,
+            List<GBeanData> gbeanDatas) throws InvalidConfigException;
+
+    void remove(Artifact configId);
+}

Added: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NoOConfigurationDataTransformer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NoOConfigurationDataTransformer.java?rev=712325&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NoOConfigurationDataTransformer.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NoOConfigurationDataTransformer.java Fri Nov  7 16:37:34 2008
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.kernel.config;
+
+import java.util.List;
+
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class NoOConfigurationDataTransformer implements ConfigurationDataTransformer {
+    public static final ConfigurationDataTransformer SINGLETON = new NoOConfigurationDataTransformer();
+    
+    public void transformDependencies(ConfigurationData configurationData) throws InvalidConfigException {
+    }
+
+    public List<GBeanData> transformGBeans(ClassLoader classLoader,
+            ConfigurationData configurationData,
+            List<GBeanData> gbeanDatas) throws InvalidConfigException {
+        return gbeanDatas;
+    }
+    
+    public void remove(Artifact configId) {
+    }
+    
+}