You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/05/22 09:23:41 UTC
svn commit: r408590 - in
/incubator/tuscany/sandbox/jboynes/sca/containers/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...
Author: jmarino
Date: Mon May 22 00:23:39 2006
New Revision: 408590
URL: http://svn.apache.org/viewvc?rev=408590&view=rev
Log:
initial port of groovy container to recursive extension model; does not yet work
Added:
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/pom.xml
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/extension/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/extension/loader/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/extension/loader/AbstractImplementationLoader.java
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyAtomicContext.java
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/samples/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/
incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java
Added: incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/pom.xml?rev=408590&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/pom.xml (added)
+++ incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/pom.xml Mon May 22 00:23:39 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>
Added: incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/extension/loader/AbstractImplementationLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/extension/loader/AbstractImplementationLoader.java?rev=408590&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/extension/loader/AbstractImplementationLoader.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/extension/loader/AbstractImplementationLoader.java Mon May 22 00:23:39 2006
@@ -0,0 +1,155 @@
+/**
+ *
+ * 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.extension.loader;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.MissingResourceException;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.model.Implementation;
+import org.apache.tuscany.model.ComponentType;
+import org.apache.tuscany.spi.loader.StAXElementLoader;
+import org.apache.tuscany.spi.loader.LoaderContext;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Abstract implementation loader.
+ *
+ */
+@Scope("MODULE")
+public abstract class AbstractImplementationLoader<T extends Implementation> implements StAXElementLoader<T> {
+
+// // Injected Stax loader registry.
+// protected StAXLoaderRegistry registry;
+//
+// // XML input factory.
+// protected XMLInputFactory xmlFactory;
+//
+// /**
+// * Initializes the XML input factory.
+// *
+// */
+// public AbstractImplementationLoader() {
+// xmlFactory = XMLInputFactory.newInstance();
+// }
+//
+// /**
+// * Injection method for Stax loader registry.
+// * @param registry Stax loader registry.
+// */
+// @Autowire
+// public void setRegistry(StAXLoaderRegistry registry) {
+// this.registry = registry;
+// }
+//
+// /**
+// * Loads the Groovy implementation.
+// *
+// * @param reader XML stream reader.
+// * @param loaderContext Loader context.
+// * @return Groovy implementation.
+// */
+// public T load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException {
+//
+// T assemblyObject = getAssemblyObject(reader, loaderContext);
+//
+// URL componentTypeFile = getSideFile(reader, loaderContext);
+// ComponentType componentType = loadComponentType(componentTypeFile, loaderContext);
+//
+// assemblyObject.setComponentType(componentType);
+//
+// return assemblyObject;
+//
+// }
+//
+// /**
+// * Required to be implemented by the concrete classes.
+// * @return Implementation object.
+// */
+// protected abstract T getAssemblyObject(XMLStreamReader reader, LoaderContext loaderContext);
+//
+// /**
+// * Gets the side file.
+// *
+// * @param reader Reader for the module file.
+// * @param loaderContext Loader context.
+// * @return Side file Url.
+// * @throws java.util.MissingResourceException
+// */
+// protected abstract URL getSideFile(XMLStreamReader reader, LoaderContext loaderContext) throws MissingResourceException;
+//
+// /**
+// * 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
+// */
+// private ComponentType loadComponentType(URL componentTypeFile, LoaderContext loaderContext) throws SidefileLoadException, MissingResourceException{
+//
+// 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
+// }
+// }
+// }
+
+}
Added: incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java?rev=408590&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/assembly/GroovyImplementation.java Mon May 22 00:23:39 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.container.groovy.assembly;
+
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.model.ComponentType;
+import org.apache.tuscany.model.AtomicImplementation;
+
+/**
+ * Meta-information for the Groovy implementation.
+ *
+ */
+public class GroovyImplementation extends AtomicImplementation<ComponentType> {
+
+ // 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;
+ }
+
+}
Added: incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyAtomicContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyAtomicContext.java?rev=408590&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyAtomicContext.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/context/GroovyAtomicContext.java Mon May 22 00:23:39 2006
@@ -0,0 +1,69 @@
+/**
+ *
+ * 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.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.tuscany.container.groovy.invoker.GroovyScript;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.context.InstanceWrapper;
+import org.apache.tuscany.spi.context.TargetException;
+import org.apache.tuscany.spi.extension.AtomicContextExtension;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.core.context.PojoInstanceWrapper;
+
+/**
+ * Groovy component context.
+ */
+public class GroovyAtomicContext extends AtomicContextExtension {
+
+ private GroovyScript script;
+
+ /**
+ * Initializes the context.
+ */
+ public GroovyAtomicContext(String name, GroovyScript script) {
+ this.name = name;
+ this.script = script;
+ }
+
+ public GroovyScript getScript(){
+ return script;
+ }
+
+ public Object getService(String s) throws TargetException {
+ return null;
+ }
+
+ public List getServiceInterfaces() {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String s, Method method) {
+ return null;
+ }
+
+ public InstanceWrapper createInstance() throws ObjectCreationException {
+ return new PojoInstanceWrapper(this,script);
+ }
+
+ public Object getService() throws TargetException {
+ return script;
+ }
+
+}
Added: incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java?rev=408590&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyInvoker.java Mon May 22 00:23:39 2006
@@ -0,0 +1,87 @@
+/**
+ *
+ * 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.container.groovy.context.GroovyAtomicContext;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * Groovy target invoker.
+ */
+public class GroovyInvoker implements TargetInvoker, Cloneable {
+
+ private GroovyAtomicContext context;
+ private String serviceName;
+ private String methodName;
+ private boolean cacheable;
+
+ /**
+ * Initializes the invoker.
+ *
+ * @param serviceName Service name.
+ * @param context SCope context.
+ * @param methodName Method name.
+ */
+ public GroovyInvoker(String serviceName, String methodName, GroovyAtomicContext context) {
+ this.context = context;
+ this.serviceName = serviceName;
+ this.methodName = methodName;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+
+ public void setCacheable(boolean cacheable) {
+ this.cacheable = cacheable;
+ }
+
+ /**
+ * Invokes the target.
+ */
+ public Object invokeTarget(Object payload) throws InvocationTargetException {
+
+ GroovyScript groovyScript = context.getScript();
+ Object[] args = (Object[]) payload;
+ try {
+ return groovyScript.runScript(methodName, args);
+ } catch (Exception ex) {
+ throw new InvocationTargetException(ex);
+ }
+ }
+
+ 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;
+ }
+
+ public GroovyInvoker clone() throws CloneNotSupportedException {
+ return (GroovyInvoker) super.clone();
+ }
+
+
+}
Added: incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java?rev=408590&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/invoker/GroovyScript.java Mon May 22 00:23:39 2006
@@ -0,0 +1,58 @@
+/**
+ *
+ * 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 groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyObject;
+import org.codehaus.groovy.control.CompilationFailedException;
+
+/**
+ * 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);
+ }
+
+}
Added: incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java?rev=408590&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/loader/GroovyImplementationLoader.java Mon May 22 00:23:39 2006
@@ -0,0 +1,95 @@
+/**
+ *
+ * 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.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.container.extension.loader.AbstractImplementationLoader;
+import org.apache.tuscany.container.groovy.assembly.GroovyImplementation;
+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{// extends AbstractImplementationLoader<GroovyImplementation> {
+//
+// // Qualified name for the Groovy implementation.
+// public static final QName NAME = new QName("http://org.apache.tuscany/xmlns/groovy/0.9", "implementation.groovy");
+//
+// /**
+// * 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);
+// }
+//
+// /**
+// * Required to be implemented by the concrete classes.
+// * @return Implementation object.
+// */
+// protected GroovyImplementation getAssemblyObject(XMLStreamReader reader, LoaderContext loaderContext) {
+//
+// GroovyImplementation groovyImplementation = new GroovyImplementation();
+// String script = reader.getAttributeValue(null, "script");
+//
+// groovyImplementation.setScript(script);
+// groovyImplementation.setResourceLoader(loaderContext.getResourceLoader());
+//
+// return groovyImplementation;
+//
+// }
+//
+// /**
+// * Gets the side file.
+// *
+// * @param reader Reader for the module file.
+// * @param loaderContext Loader context.
+// * @return Side file Url.
+// * @throws MissingResourceException
+// */
+// protected URL getSideFile(XMLStreamReader reader, LoaderContext loaderContext)
+// throws MissingResourceException {
+//
+// String script = reader.getAttributeValue(null, "script");
+// String sidefile = script.substring(0, script.lastIndexOf('.')) + ".componentType";
+// URL componentTypeFile = loaderContext.getResourceLoader().getResource(sidefile);
+// if (componentTypeFile == null) {
+// throw new MissingResourceException(sidefile);
+// }
+// return componentTypeFile;
+//
+// }
+
+}
Added: incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java?rev=408590&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/containers/container.groovy/src/main/java/org/apache/tuscany/samples/groovy/Greeting.java Mon May 22 00:23:39 2006
@@ -0,0 +1,6 @@
+package org.apache.tuscany.samples.groovy;
+
+public interface Greeting {
+
+ void greet(String name);
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org