You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/05/09 13:05:28 UTC

svn commit: r405384 - in /incubator/tuscany/sandbox/container.groovy: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/container/ src/main/java/org/apache/t...

Author: jsdelfino
Date: Tue May  9 04:05:18 2006
New Revision: 405384

URL: http://svn.apache.org/viewcvs?rev=405384&view=rev
Log:
JIRA TUSCANY-317 - initial check-in of Groovy container

Added:
    incubator/tuscany/sandbox/container.groovy/   (with props)
    incubator/tuscany/sandbox/container.groovy/pom.xml   (with props)
    incubator/tuscany/sandbox/container.groovy/src/
    incubator/tuscany/sandbox/container.groovy/src/main/
    incubator/tuscany/sandbox/container.groovy/src/main/java/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java   (with props)
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyContextFactoryBuilder.java   (with props)
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyTargetWireBuilder.java   (with props)
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/config/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/config/GroovyContextFactory.java   (with props)
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyComponentContext.java   (with props)
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java   (with props)
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java   (with props)
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java   (with props)
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java   (with props)
    incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/GreetingClient.java   (with props)
    incubator/tuscany/sandbox/container.groovy/src/main/resources/
    incubator/tuscany/sandbox/container.groovy/src/main/resources/greetings.componentType
    incubator/tuscany/sandbox/container.groovy/src/main/resources/greetings.groovy
    incubator/tuscany/sandbox/container.groovy/src/main/resources/logging.properties   (with props)
    incubator/tuscany/sandbox/container.groovy/src/main/resources/sca.module
    incubator/tuscany/sandbox/container.groovy/src/main/resources/system.fragment
    incubator/tuscany/sandbox/container.groovy/src/test/
    incubator/tuscany/sandbox/container.groovy/src/test/java/
    incubator/tuscany/sandbox/container.groovy/src/test/java/org/
    incubator/tuscany/sandbox/container.groovy/src/test/java/org/apache/
    incubator/tuscany/sandbox/container.groovy/src/test/java/org/apache/tuscany/
    incubator/tuscany/sandbox/container.groovy/src/test/java/org/apache/tuscany/samples/
    incubator/tuscany/sandbox/container.groovy/src/test/java/org/apache/tuscany/samples/groovy/
    incubator/tuscany/sandbox/container.groovy/src/test/java/org/apache/tuscany/samples/groovy/GreetingTestCase.java   (with props)

Propchange: incubator/tuscany/sandbox/container.groovy/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May  9 04:05:18 2006
@@ -0,0 +1,13 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/sandbox/container.groovy/pom.xml
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/pom.xml?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/pom.xml (added)
+++ incubator/tuscany/sandbox/container.groovy/pom.xml Tue May  9 04:05:18 2006
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *  Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ -->
+<project>
+
+    <parent>
+        <groupId>org.apache.tuscany.sca.containers</groupId>
+        <artifactId>tuscany-sca-containers</artifactId>
+        <version>SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>tuscany-container-groovy</artifactId>
+    <name>Tuscany Groovy Container</name>
+    <description>Tuscany Groovy Container</description>
+    <version>SNAPSHOT</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany</groupId>
+            <artifactId>tuscany-core</artifactId>
+            <version>${pom.version}</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>groovy</groupId>
+            <artifactId>groovy</artifactId>
+            <version>1.0-jsr-05</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>1.1.3.4-RC8</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>

Propchange: incubator/tuscany/sandbox/container.groovy/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java Tue May  9 04:05:18 2006
@@ -0,0 +1,64 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.container.groovy.assembly;
+
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.model.assembly.impl.AtomicImplementationImpl;
+
+/**
+ * Meta-information for the Groovy implementation.
+ *
+ */
+public class GroovyImplementation extends AtomicImplementationImpl {
+	
+	// Full path of the script file to be executed
+	private String script;
+	
+	// Resource loader for accessing classpath resources
+	private ResourceLoader resourceLoader;
+	
+	/**
+	 * Gets the full path of the script file to be executed.
+	 * @return Full path of the script file to be executed.
+	 */
+	public String getScript() { 
+		return script; 
+	}
+	
+	/**
+	 * Sets the full path of the script file to be executed.
+	 * @param script Full path of the script file to be executed.
+	 */
+	public void setScript(String script) { 
+		this.script = script; 
+	}
+	
+	/**
+	 * Gets the resource loader for accessing classpath resources.
+	 * @return Resource loader.
+	 */
+	public ResourceLoader getResourceLoader() { return resourceLoader; }
+
+	/**
+	 * Sets the resource loader for accessing classpath resources.
+	 * @param resourceLoader Resource loader.
+	 */
+	public void setResourceLoader(ResourceLoader resourceLoader) { 
+		this.resourceLoader = resourceLoader; 
+	}
+
+}

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyContextFactoryBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyContextFactoryBuilder.java?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyContextFactoryBuilder.java (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyContextFactoryBuilder.java Tue May  9 04:05:18 2006
@@ -0,0 +1,122 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.container.groovy.builder;
+
+import org.apache.tuscany.container.groovy.assembly.GroovyImplementation;
+import org.apache.tuscany.container.groovy.config.GroovyContextFactory;
+import org.apache.tuscany.container.groovy.invoker.GroovyScript;
+import org.apache.tuscany.core.builder.BuilderException;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.apache.tuscany.core.wire.TargetWireFactory;
+import org.apache.tuscany.core.wire.service.WireFactoryService;
+import org.apache.tuscany.model.assembly.AssemblyObject;
+import org.apache.tuscany.model.assembly.AtomicComponent;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.Implementation;
+import org.apache.tuscany.model.assembly.Scope;
+import org.apache.tuscany.model.assembly.Service;
+import org.osoa.sca.annotations.Init;
+
+/**
+ * Groovy context factory builder.
+ *
+ */
+@org.osoa.sca.annotations.Scope("MODULE")
+public class GroovyContextFactoryBuilder implements ContextFactoryBuilder {
+
+	// Context factory builder registry.
+    private ContextFactoryBuilderRegistry builderRegistry;
+    
+    // Wire factory service.
+    private WireFactoryService wireFactoryService;
+
+    /**
+     * Lifecycle method used for registering the builder.
+     *
+     */
+    @Init(eager = true)
+    public void init() {
+        builderRegistry.register(this);
+    }
+
+    /**
+     * Injection method for builder registry.
+     * @param builderRegistry
+     */
+    @Autowire
+    public void setBuilderRegistry(ContextFactoryBuilderRegistry builderRegistry) {
+        this.builderRegistry = builderRegistry;
+    }
+
+    /**
+     * Injection method for wire factory service.
+     * @param wireFactoryService WIre factory service.
+     */
+    @Autowire
+    public void setWireFactoryService(WireFactoryService wireFactoryService) {
+        this.wireFactoryService = wireFactoryService;
+    }
+
+    /**
+     * Builds the groovy component implementation.
+     * @param assemblyObject Assembly object.
+     */
+    public void build(AssemblyObject assemblyObject) throws BuilderException {
+    	
+        if (assemblyObject instanceof AtomicComponent) {
+            AtomicComponent component = (AtomicComponent) assemblyObject;
+            Implementation impl = component.getImplementation();
+            if (impl instanceof GroovyImplementation) {
+                buildGroovyComponent(component, (GroovyImplementation) impl);
+            } else {
+            	throw new IllegalArgumentException("Unexpected component type: " + 
+            			impl.getClass());
+            }
+        }
+        
+    }
+
+    /*
+     * Builds the groovy component.
+     */
+    private void buildGroovyComponent(AtomicComponent component, GroovyImplementation impl) {
+        
+    	Scope scope = impl.getComponentType().getServices().get(0).getServiceContract().getScope();
+        
+        GroovyScript groovyScript = new GroovyScript(impl.getScript());
+        GroovyContextFactory contextFactory = new GroovyContextFactory(component.getName(),
+                scope, groovyScript);
+
+        addTargetInvocationChains(component, contextFactory);
+        component.setContextFactory(contextFactory);
+        
+    }
+
+    /*
+     * Add target-side wire chains for each service offered by the implementation
+     */
+    private void addTargetInvocationChains(AtomicComponent component, GroovyContextFactory contextFactory) {
+        for (ConfiguredService configuredService : component.getConfiguredServices()) {
+            Service service = configuredService.getPort();
+            TargetWireFactory wireFactory = wireFactoryService.createTargetFactory(configuredService);
+            contextFactory.addTargetWireFactory(service.getName(), wireFactory);
+        }
+    }
+
+}

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyContextFactoryBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyContextFactoryBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyTargetWireBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyTargetWireBuilder.java?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyTargetWireBuilder.java (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyTargetWireBuilder.java Tue May  9 04:05:18 2006
@@ -0,0 +1,47 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.container.groovy.builder;
+
+import org.apache.tuscany.container.groovy.config.GroovyContextFactory;
+import org.apache.tuscany.container.groovy.invoker.GroovyInvoker;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.context.ScopeContext;
+import org.apache.tuscany.core.extension.WireBuilderSupport;
+import org.apache.tuscany.core.wire.TargetInvoker;
+import org.osoa.sca.annotations.Scope;
+
+import java.lang.reflect.Method;
+
+/**
+ * Groovy target wire builder.
+ */
+@Scope("MODULE")
+public class GroovyTargetWireBuilder extends WireBuilderSupport<GroovyContextFactory> {
+
+	/**
+	 * Created the invoker for groovy.
+	 * 
+	 * @param targetName Target component name.
+	 * @param  method Method invoked on the proxy.
+	 * @param context Scope context.
+	 * @param downScope Flag for down scope.
+	 */
+    protected TargetInvoker createInvoker(QualifiedName targetName, Method method, ScopeContext context, boolean downScope) {
+        String serviceName = targetName.getPartName();
+        return new GroovyInvoker(context, serviceName, method.getName());
+    }
+}

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyTargetWireBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/builder/GroovyTargetWireBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/config/GroovyContextFactory.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/config/GroovyContextFactory.java?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/config/GroovyContextFactory.java (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/config/GroovyContextFactory.java Tue May  9 04:05:18 2006
@@ -0,0 +1,158 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.container.groovy.config;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.container.groovy.context.GroovyComponentContext;
+import org.apache.tuscany.container.groovy.invoker.GroovyScript;
+import org.apache.tuscany.core.builder.ContextCreationException;
+import org.apache.tuscany.core.builder.ContextFactory;
+import org.apache.tuscany.core.context.CompositeContext;
+import org.apache.tuscany.core.wire.SourceWireFactory;
+import org.apache.tuscany.core.wire.TargetWireFactory;
+import org.apache.tuscany.model.assembly.Scope;
+
+/**
+ * Groovy context factory.
+ */
+public class GroovyContextFactory implements ContextFactory<GroovyComponentContext> {
+
+	// Context scope
+    private Scope scope;
+
+    // Context name
+    private String name;
+    
+    // Groovy script to run
+    private GroovyScript groovyScript;
+
+    // SOurce proxy factories
+    private List<SourceWireFactory> sourceProxyFactories = new ArrayList<SourceWireFactory>();
+    
+    // Target proxy factories
+    private Map<String, TargetWireFactory> targetProxyFactories = new HashMap<String, TargetWireFactory>();
+    
+    /**
+     * Initializes the context factory.
+     * 
+     * @param name Context name.
+     * @param scope Context scope.
+     * @param groovyScript Groovy script to run.
+     */
+    public GroovyContextFactory(String name, Scope scope, GroovyScript groovyScript) {
+        this.name = name;
+        this.scope = scope;
+        this.groovyScript = groovyScript;
+    }
+
+    /**
+     * Creates the Groovy component context.
+     */
+    public GroovyComponentContext createContext() throws ContextCreationException {
+        return new GroovyComponentContext(name, sourceProxyFactories, 
+        		targetProxyFactories, groovyScript);
+    }
+
+    /**
+     * Returns the context scope.
+     * @return Context scope.
+     */
+    public Scope getScope() {
+        return scope;
+    }
+
+    /**
+     * Returns the context name.
+     * @return Context name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Adds a property.
+     * 
+     * @param propertyName Property name.
+     * @param value Property value.
+     */
+    public void addProperty(String propertyName, Object value) {
+    }
+
+    /**
+     * Adds a target proxy factory.
+     * 
+     * @param serviceName Service name.
+     * @param factory Target proxy factory.
+     */
+    public void addTargetWireFactory(String serviceName, TargetWireFactory factory) {
+        targetProxyFactories.put(serviceName, factory);
+    }
+
+    /**
+     * Gets a target proxy factory by name.
+     * 
+     * @param serviceName Service name.
+     * @return Target wire factory for the specified service.
+     */
+    public TargetWireFactory getTargetWireFactory(String serviceName) {
+        return targetProxyFactories.get(serviceName);
+    }
+
+    /**
+     * Returns all the target wire factories.
+     * @return All the target wire factories for the context.
+     */
+    public Map<String, TargetWireFactory> getTargetWireFactories() {
+        return targetProxyFactories;
+    }
+
+    /**
+     * Adds a source wire factory.
+     * 
+     * @param referenceName Reference name.
+     * @param factory SOurce wire factory.
+     */
+    public void addSourceWireFactory(String referenceName, SourceWireFactory factory) {
+        sourceProxyFactories.add(factory);
+    }
+
+    /**
+     * Adds all source wire factories.
+     */
+    public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity) {
+    	sourceProxyFactories.addAll(factory);
+    }
+
+    /**
+     * Returns all the source wire factories.
+     */
+    public List<SourceWireFactory> getSourceWireFactories() {
+        return sourceProxyFactories;
+    }
+
+    /**
+     * Notification that the parent factory has been activated.
+     */
+    public void prepare(CompositeContext parent) {
+    }
+
+
+}

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/config/GroovyContextFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/config/GroovyContextFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyComponentContext.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyComponentContext.java?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyComponentContext.java (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyComponentContext.java Tue May  9 04:05:18 2006
@@ -0,0 +1,109 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.container.groovy.context;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.container.groovy.invoker.GroovyScript;
+import org.apache.tuscany.core.context.AtomicContext;
+import org.apache.tuscany.core.context.CoreRuntimeException;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.context.TargetException;
+import org.apache.tuscany.core.context.event.InstanceCreated;
+import org.apache.tuscany.core.context.impl.AbstractContext;
+import org.apache.tuscany.core.wire.ProxyCreationException;
+import org.apache.tuscany.core.wire.SourceWireFactory;
+import org.apache.tuscany.core.wire.TargetWireFactory;
+import org.apache.tuscany.core.wire.WireFactory;
+
+public class GroovyComponentContext extends AbstractContext implements AtomicContext {
+
+    private List<SourceWireFactory> sourceProxyFactories;
+
+    private Map<String, TargetWireFactory> targetProxyFactories;
+    
+    private GroovyScript groovyScript;
+
+    public GroovyComponentContext(String name, 
+    		List<SourceWireFactory> sourceProxyFactories, 
+    		Map<String, TargetWireFactory> targetProxyFactories, 
+    		GroovyScript groovyScript) {
+        super(name);
+        this.sourceProxyFactories = sourceProxyFactories;
+        this.targetProxyFactories = targetProxyFactories;
+        this.groovyScript = groovyScript;
+    }
+
+    public Object getInstance(QualifiedName qName) throws TargetException {
+        return getInstance(qName, true);
+    }
+
+    public void init() throws TargetException {
+    }
+
+    public void destroy() throws TargetException {
+
+    }
+
+    private synchronized Object getInstance(QualifiedName qName, boolean notify) throws TargetException {
+        String portName = qName.getPortName();
+        WireFactory targetFactory;
+        if (portName != null) {
+            targetFactory = targetProxyFactories.get(portName);
+        } else {
+            targetFactory = targetProxyFactories.values().iterator().next();
+        }
+        if (targetFactory == null) {
+            TargetException e = new TargetException("Target service not found");
+            e.setIdentifier(qName.getPortName());
+            e.addContextName(getName());
+            throw e;
+        }
+        try {
+            Object proxy = targetFactory.createProxy();
+            if (notify) {
+                publish(new InstanceCreated(this));
+            }
+            return proxy;
+        } catch (ProxyCreationException e) {
+            TargetException te = new TargetException("Error returning target", e);
+            e.setIdentifier(qName.getPortName());
+            e.addContextName(getName());
+            throw te;
+        }
+    }
+
+    public Object getTargetInstance() throws TargetException {
+        return groovyScript;
+    }
+
+    public boolean isEagerInit() {
+        return false;
+    }
+
+    public boolean isDestroyable() {
+        return false;
+    }
+
+    public void start() throws CoreRuntimeException {
+    }
+
+    public void stop() throws CoreRuntimeException {
+    }
+
+}

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyComponentContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyComponentContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java Tue May  9 04:05:18 2006
@@ -0,0 +1,108 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.container.groovy.invoker;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.core.context.AtomicContext;
+import org.apache.tuscany.core.context.ScopeContext;
+import org.apache.tuscany.core.message.Message;
+import org.apache.tuscany.core.wire.Interceptor;
+import org.apache.tuscany.core.wire.TargetInvoker;
+
+/**
+ * Groovy target invoker.
+ *
+ */
+public class GroovyInvoker implements TargetInvoker, Cloneable {
+	
+	// SCope context
+	private ScopeContext scopeContext;	
+	
+	// Srevice name
+	private String serviceName;
+	
+	// Method name
+	private String methodName;
+	
+	/**
+	 * Initializes the invoker.
+	 * 
+	 * @param scopeContext SCope context.
+	 * @param serviceName Service name.
+	 * @param methodName Method name.
+	 */
+	public GroovyInvoker(ScopeContext scopeContext, String serviceName, String methodName) {
+		this.scopeContext = scopeContext;
+		this.serviceName = serviceName;
+		this.methodName = methodName;
+	}
+
+	/**
+	 * Invokes the target.
+	 */
+	public Object invokeTarget(Object payload) throws InvocationTargetException {
+		
+		AtomicContext atomicContext = (AtomicContext)scopeContext.getContext(serviceName);
+        GroovyScript groovyScript = (GroovyScript)atomicContext.getTargetInstance();
+        
+		Object[] args = (Object[])payload;
+		
+		try {
+			return groovyScript.runScript(methodName, args);
+		} catch(Exception ex) {
+			throw new InvocationTargetException(ex);
+		}
+		
+	}
+
+	/**
+	 * Whether the invoker is cacheable.
+	 */
+	public boolean isCacheable() {
+		return false;
+	}
+
+	/**
+	 * Invokes the servce.
+	 */
+	public Message invoke(Message msg) {
+        try {
+            Object resp = invokeTarget(msg.getBody());
+            msg.setBody(resp);
+        } catch (InvocationTargetException e) {
+            msg.setBody(e.getCause());
+        } catch (Throwable e) {
+            msg.setBody(e);
+        }
+        return msg;
+	}
+
+	/**
+	 * Sets interceptor.
+	 */
+	public void setNext(Interceptor next) {
+	}
+
+    /**
+     * Implementations must support deep cloning
+     */
+    public Object clone() {
+    	return new GroovyInvoker(scopeContext, serviceName, methodName);
+    }
+
+}

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java Tue May  9 04:05:18 2006
@@ -0,0 +1,61 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.container.groovy.invoker;
+
+import org.codehaus.groovy.control.CompilationFailedException;
+
+import groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyObject;
+
+/**
+ * Models a Groovy script.
+ */
+public class GroovyScript {
+	
+	// Script to run.
+	private String script;
+	
+	/**
+	 * Initializes the script name.
+	 * @param script Full path to the script.
+	 */
+	public GroovyScript(String script) {
+		this.script = script;
+	}
+	
+	/**
+	 * Executes the script.
+	 * @param methodName Name of the method to be executed.
+	 * @param args Arguments to the method.
+	 * @return Result of invocation.
+	 * @throws CompilationFailedException
+	 * @throws InstantiationException
+	 * @throws IllegalAccessException
+	 */
+	public Object runScript(String methodName, Object[] args) throws CompilationFailedException, InstantiationException, IllegalAccessException {
+		
+		ClassLoader parent = getClass().getClassLoader();
+		GroovyClassLoader loader = new GroovyClassLoader(parent);
+		
+		Class groovyClass = loader.parseClass(parent.getResourceAsStream(script));
+
+		GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance();
+		return groovyObject.invokeMethod(methodName, args);
+		
+	}
+
+}

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java Tue May  9 04:05:18 2006
@@ -0,0 +1,182 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.container.groovy.loader;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.core.config.InvalidRootElementException;
+import org.apache.tuscany.core.config.MissingResourceException;
+import org.apache.tuscany.core.config.SidefileLoadException;
+import org.apache.tuscany.core.loader.LoaderContext;
+import org.apache.tuscany.core.loader.StAXElementLoader;
+import org.apache.tuscany.core.loader.StAXLoaderRegistry;
+import org.apache.tuscany.core.loader.assembly.AssemblyConstants;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.apache.tuscany.container.groovy.assembly.GroovyImplementation;
+import org.apache.tuscany.model.assembly.ComponentType;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Groovy implementation loader.
+ *
+ */
+@Scope("MODULE")
+public class GroovyImplementationLoader implements StAXElementLoader<GroovyImplementation> {
+	
+	// Qualified name for the Groovy implementation.
+	public static final QName NAME = new QName("http://org.apache.tuscany/xmlns/groovy/0.9", "implementation.groovy");
+
+	// Injected Stax loader registry.
+    protected StAXLoaderRegistry registry;
+    
+    // XML input factory.
+    private XMLInputFactory xmlFactory;
+
+    /**
+     * Initializes the XML input factory.
+     *
+     */
+    public GroovyImplementationLoader() {
+        xmlFactory = XMLInputFactory.newInstance();
+    }
+
+    /**
+     * Injection method for Stax loader registry.
+     * @param registry Stax loader registry.
+     */
+    @Autowire
+    public void setRegistry(StAXLoaderRegistry registry) {
+        this.registry = registry;
+    }
+
+    /**
+     * Lifecycle method registers the implementation loader.
+     *
+     */
+    @Init(eager = true)
+    public void start() {
+        registry.registerLoader(NAME, this);
+    }
+
+    /**
+     * Lifecycle method deregisters the implementation loader.
+     *
+     */
+    @Destroy
+    public void stop() {
+        registry.unregisterLoader(NAME, this);
+    }
+
+    /**
+     * Loads the Groovy implementation.
+     * 
+     * @param Stax XML stream reader.
+     * @param loaderContext Loader context.
+     * @return Groovy implementation.
+     */
+	public GroovyImplementation load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException {
+
+		GroovyImplementation groovyImplementation = new GroovyImplementation();
+		String script = reader.getAttributeValue(null, "script");
+        ComponentType componentType = loadComponentType(script, loaderContext);
+		
+		groovyImplementation.setScript(script);
+		groovyImplementation.setComponentType(componentType);
+		groovyImplementation.setResourceLoader(loaderContext.getResourceLoader());
+		
+		return groovyImplementation;
+		
+	}
+
+	/**
+	 * Loads the SIDE file to get the component information.
+	 * 
+	 * @param scriptFile SCript file name.
+	 * @param loaderContext Loader context.
+	 * @return Component information.
+	 * @throws SidefileLoadException
+	 * @throws MissingResourceException
+	 */
+    protected ComponentType loadComponentType(String scriptFile, LoaderContext loaderContext) throws SidefileLoadException, MissingResourceException{
+        
+    	URL componentTypeFile = getSideFile(scriptFile, loaderContext);
+    	XMLStreamReader reader = null;
+    	InputStream is = null;
+    	
+        try {
+            is = componentTypeFile.openStream();
+            reader = xmlFactory.createXMLStreamReader(is);
+            reader.nextTag();
+            if (!AssemblyConstants.COMPONENT_TYPE.equals(reader.getName())) {
+                InvalidRootElementException e = new InvalidRootElementException(AssemblyConstants.COMPONENT_TYPE, reader.getName());
+                e.setResourceURI(componentTypeFile.toString());
+                throw e;
+            }
+            return (ComponentType) registry.load(reader, loaderContext);
+        } catch (IOException e) {
+            SidefileLoadException sfe = new SidefileLoadException(e.getMessage());
+            sfe.setResourceURI(componentTypeFile.toString());
+            throw sfe;
+        } catch (XMLStreamException e) {
+            SidefileLoadException sfe = new SidefileLoadException(e.getMessage());
+            sfe.setResourceURI(componentTypeFile.toString());
+            throw sfe;
+        } catch (ConfigurationLoadException e) {
+            SidefileLoadException sfe = new SidefileLoadException(e.getMessage());
+            sfe.setResourceURI(componentTypeFile.toString());
+            throw sfe;
+        } finally {
+            try {
+            	if(reader != null) {
+            		reader.close();
+            	}
+            } catch (XMLStreamException e) {
+                // ignore
+            }
+            try {
+            	if(is != null) {
+            		is.close();
+            	}
+            } catch (IOException e) {
+                // ignore
+            }
+        }
+    }
+
+    /*
+     * Gets the Side file URL.
+     */
+	private URL getSideFile(String scriptFile, LoaderContext loaderContext) throws MissingResourceException {
+		String sidefile = scriptFile.substring(0, scriptFile.lastIndexOf('.')) + ".componentType";
+        URL componentTypeFile = loaderContext.getResourceLoader().getResource(sidefile);
+        if (componentTypeFile == null) {
+            throw new MissingResourceException(sidefile);
+        }
+		return componentTypeFile;
+	}
+
+}

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java Tue May  9 04:05:18 2006
@@ -0,0 +1,6 @@
+package org.apache.tuscany.samples.groovy;
+
+public interface Greeting {
+
+	void greet(String name);
+}

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/GreetingClient.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/GreetingClient.java?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/GreetingClient.java (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/GreetingClient.java Tue May  9 04:05:18 2006
@@ -0,0 +1,63 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.samples.groovy;
+
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.Properties;
+
+import org.osoa.sca.CurrentModuleContext;
+import org.osoa.sca.ModuleContext;
+
+import org.apache.tuscany.core.client.TuscanyRuntime;
+import org.apache.tuscany.common.monitor.MonitorFactory;
+import org.apache.tuscany.common.monitor.impl.JavaLoggingMonitorFactory;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate a simple HelloWorld service component and invoke it.
+ */
+public class GreetingClient {
+
+    public static final void main(String[] args) throws Exception {
+    	
+        // Setup Tuscany monitoring to use java.util.logging
+        LogManager.getLogManager().readConfiguration(GreetingClient.class.getResourceAsStream("/logging.properties"));
+        Properties levels = new Properties();
+        MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, Level.FINEST, "MonitorMessages");
+
+        // Obtain Tuscany runtime
+        TuscanyRuntime tuscany = new TuscanyRuntime("greeting", null, monitorFactory);
+
+        // Associate the application module component with this thread
+        tuscany.start();
+
+        // Obtain SCA module context.
+        ModuleContext moduleContext = CurrentModuleContext.getContext();
+
+        Greeting greeting = (Greeting) moduleContext.locateService("GreetingComponent");
+        greeting.greet("World");
+        
+        System.err.flush();
+
+        // Disassociate the application module component
+        tuscany.stop();
+
+        // Shut down the runtime
+        tuscany.shutdown();
+    }
+}

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/GreetingClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/GreetingClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/resources/greetings.componentType
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/resources/greetings.componentType?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/resources/greetings.componentType (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/resources/greetings.componentType Tue May  9 04:05:18 2006
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <service name="GreetingService">
+        <interface.java interface="org.apache.tuscany.samples.groovy.Greeting"/>
+    </service>
+
+</componentType>
\ No newline at end of file

Added: incubator/tuscany/sandbox/container.groovy/src/main/resources/greetings.groovy
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/resources/greetings.groovy?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/resources/greetings.groovy (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/resources/greetings.groovy Tue May  9 04:05:18 2006
@@ -0,0 +1,3 @@
+def greet(name) {
+    println "Hello ${name}"
+}

Added: incubator/tuscany/sandbox/container.groovy/src/main/resources/logging.properties
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/resources/logging.properties?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/resources/logging.properties (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/resources/logging.properties Tue May  9 04:05:18 2006
@@ -0,0 +1,27 @@
+#  Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  $Rev$ $Date$
+#
+
+# Custom logging configuration for Tuscany samples
+# By default, only INFO level logging is enabled and ALL messages get sent to the console
+# For more messages from the runtime, uncomment specific settings at the end of this file
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+.level=INFO
+
+# Uncomment the next setting to get all Tuscany messages (this will be a lot)
+#org.apache.tuscany.level=FINEST
\ No newline at end of file

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/resources/logging.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/main/resources/logging.properties
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/sandbox/container.groovy/src/main/resources/sca.module
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/resources/sca.module?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/resources/sca.module (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/resources/sca.module Tue May  9 04:05:18 2006
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright (c) 2005 BEA Sytems Inc.
+  Copyright (c) 2005 International Business Machines
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ -->
+<!--module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+        name="sampleHelloworld"-->
+<module 
+	xmlns="http://www.osoa.org/xmlns/sca/0.9" 
+	xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+	xmlns:groovy="http://org.apache.tuscany/xmlns/groovy/0.9"
+    name="GroovySample">
+
+    <component name="GreetingComponent">
+        <groovy:implementation.groovy script="greetings.groovy"/>
+    </component>
+    
+</module>

Added: incubator/tuscany/sandbox/container.groovy/src/main/resources/system.fragment
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/main/resources/system.fragment?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/main/resources/system.fragment (added)
+++ incubator/tuscany/sandbox/container.groovy/src/main/resources/system.fragment Tue May  9 04:05:18 2006
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+  Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ -->
+<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+        xmlns:system="http://org.apache.tuscany/xmlns/system/0.9"
+		name="org.apache.tuscany.container.groovy">
+
+    <component name="org.apache.tuscany.container.groovy.builder.GroovyContextFactoryBuilder">
+        <system:implementation.system class="org.apache.tuscany.container.groovy.builder.GroovyContextFactoryBuilder"/>
+    </component>
+
+    <component name="org.apache.tuscany.container.groovy.builder.GroovyTargetWireBuilder">
+        <system:implementation.system class="org.apache.tuscany.container.groovy.builder.GroovyTargetWireBuilder"/>
+    </component>
+
+    <component name="org.apache.tuscany.container.groovy.loader.GroovyImplementationLoader">
+        <system:implementation.system class="org.apache.tuscany.container.groovy.loader.GroovyImplementationLoader"/>
+    </component>
+</moduleFragment>

Added: incubator/tuscany/sandbox/container.groovy/src/test/java/org/apache/tuscany/samples/groovy/GreetingTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/container.groovy/src/test/java/org/apache/tuscany/samples/groovy/GreetingTestCase.java?rev=405384&view=auto
==============================================================================
--- incubator/tuscany/sandbox/container.groovy/src/test/java/org/apache/tuscany/samples/groovy/GreetingTestCase.java (added)
+++ incubator/tuscany/sandbox/container.groovy/src/test/java/org/apache/tuscany/samples/groovy/GreetingTestCase.java Tue May  9 04:05:18 2006
@@ -0,0 +1,65 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.samples.groovy;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.client.TuscanyRuntime;
+import org.osoa.sca.CurrentModuleContext;
+import org.osoa.sca.ModuleContext;
+
+/**
+ * This shows how to test the Greeting service component.
+ */
+public class GreetingTestCase extends TestCase {
+    
+    private TuscanyRuntime tuscany;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        // Create a Tuscany runtime for the sample module component
+        tuscany = new TuscanyRuntime("GreetingModuleComponent", "http://helloworld");
+
+        // Start the Tuscany runtime and associate it with this thread
+        tuscany.start();
+    }
+    
+    public void testGreetings() throws Exception {
+
+        // Get the SCA module context.
+        ModuleContext moduleContext = CurrentModuleContext.getContext();
+
+        // Locate the Greeting service
+        Greeting greetingService = (Greeting) moduleContext.locateService("GreetingComponent");
+        
+        // Invoke the Greeting service
+        greetingService.greet("World");
+        
+    }
+    
+    protected void tearDown() throws Exception {
+        
+        // Stop the Tuscany runtime
+        tuscany.stop();
+        
+        // Shutdown the runtime
+        tuscany.shutdown();
+        
+        super.tearDown();
+    }
+}

Propchange: incubator/tuscany/sandbox/container.groovy/src/test/java/org/apache/tuscany/samples/groovy/GreetingTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/container.groovy/src/test/java/org/apache/tuscany/samples/groovy/GreetingTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date