summaryrefslogtreecommitdiffstats
path: root/sandbox/SPI
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /sandbox/SPI
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/SPI')
-rw-r--r--sandbox/SPI/implementation-crud/pom.xml51
-rw-r--r--sandbox/SPI/implementation-crud/src/main/java/crud/CRUD.java56
-rw-r--r--sandbox/SPI/implementation-crud/src/main/java/crud/CRUDImplementation.java150
-rw-r--r--sandbox/SPI/implementation-crud/src/main/java/crud/CRUDImplementationActivator.java49
-rw-r--r--sandbox/SPI/implementation-crud/src/main/java/crud/CRUDInvoker.java51
-rw-r--r--sandbox/SPI/implementation-crud/src/main/java/crud/CRUDInvokerFactory.java43
-rw-r--r--sandbox/SPI/implementation-crud/src/main/java/crud/CRUDXMLSCDLProcessor.java46
-rw-r--r--sandbox/SPI/implementation-crud/src/main/java/crud/ResourceManager.java109
-rw-r--r--sandbox/SPI/implementation-crud/src/main/resources/META-INF/services/org.apache.tuscany.spi.implementation.ImplementationActivator3
-rw-r--r--sandbox/SPI/implementation-crud/src/main/resources/crud.composite30
-rw-r--r--sandbox/SPI/implementation-crud/src/test/java/crud/CRUDTestCase.java67
-rwxr-xr-xsandbox/SPI/implementation-script/LICENSE.txt202
-rw-r--r--sandbox/SPI/implementation-script/NOTICE.txt14
-rw-r--r--sandbox/SPI/implementation-script/pom.xml124
-rw-r--r--sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptImplementation.java61
-rw-r--r--sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptImplementationActivator.java49
-rw-r--r--sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptInvoker.java48
-rw-r--r--sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptInvokerFactory.java74
-rw-r--r--sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptXMLSCDLProcessor.java94
-rw-r--r--sandbox/SPI/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.spi.implementation.ImplementationActivator3
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/AbstractSCATestCase.java50
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java34
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java25
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/HelloWorld.java26
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/HelloWorldProxy.java33
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java25
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java25
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java25
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/AbstractHelloWorldTestCase.java34
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/GroovyHelloWorldTestCase.java25
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/HelloWorld.java26
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/HelloWorldProxy.java33
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JRubyHelloWorldTestCaseFIXME.java29
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java25
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JythonHelloWorldTestCase.java25
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/references/HelloWorldTarget.java30
-rw-r--r--sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/references/JavaScriptReferenceTestCase.java25
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/GroovyHelloWorld.composite32
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JRubyHelloWorld.composite32
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite32
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JythonHelloWorld.composite32
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.componentType30
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.groovy22
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.js23
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.py20
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.rb21
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/GroovyHelloWorld.composite32
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JRubyHelloWorld.composite32
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JavaScriptHelloWorld.composite32
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JythonHelloWorld.composite32
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.componentType32
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.groovy22
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.js23
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.py20
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.rb21
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/JavaScriptReference.composite37
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/reference.componentType31
-rw-r--r--sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/reference.js22
-rw-r--r--sandbox/SPI/implementation-spi-impl/LICENSE.txt202
-rw-r--r--sandbox/SPI/implementation-spi-impl/NOTICE.txt14
-rw-r--r--sandbox/SPI/implementation-spi-impl/pom.xml69
-rw-r--r--sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/Discovery.java98
-rw-r--r--sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplAtomicComponent.java155
-rw-r--r--sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplTargetInvoker.java123
-rw-r--r--sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationArtifactProcessor.java114
-rw-r--r--sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationBuilder.java65
-rw-r--r--sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationSPIModuleActivator.java80
-rw-r--r--sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/PropertyValueObjectFactory.java224
-rw-r--r--sandbox/SPI/implementation-spi-impl/src/main/resources/META-INF/services/org.apache.tuscany.core.ModuleActivator2
-rw-r--r--sandbox/SPI/implementation-spi/LICENSE.txt202
-rw-r--r--sandbox/SPI/implementation-spi/NOTICE.txt14
-rw-r--r--sandbox/SPI/implementation-spi/pom.xml81
-rw-r--r--sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/ImplementationActivator.java36
-rw-r--r--sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/Invoker.java26
-rw-r--r--sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/InvokerFactory.java31
-rw-r--r--sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/XMLSCDLProcessor.java33
76 files changed, 3968 insertions, 0 deletions
diff --git a/sandbox/SPI/implementation-crud/pom.xml b/sandbox/SPI/implementation-crud/pom.xml
new file mode 100644
index 0000000000..0e78bc4f25
--- /dev/null
+++ b/sandbox/SPI/implementation-crud/pom.xml
@@ -0,0 +1,51 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-samples</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-sample-implementation-crud</artifactId>
+ <name>Apache Tuscany CRUD Implementation Extension Sample</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spi</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sandbox/SPI/implementation-crud/src/main/java/crud/CRUD.java b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUD.java
new file mode 100644
index 0000000000..e33396adfc
--- /dev/null
+++ b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUD.java
@@ -0,0 +1,56 @@
+/*
+ * 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 crud;
+
+/**
+ * The service interface of the single CRUD service provided by CRUD components.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CRUD {
+
+ /**
+ * Create a new resource.
+ * @param resource
+ * @return
+ */
+ String create(Object resource);
+
+ /**
+ * Retrieve a resource.
+ * @param id
+ * @return
+ */
+ Object retrieve(String id);
+
+ /**
+ * Update a resource.
+ * @param id
+ * @param resource
+ * @return
+ */
+ Object update(String id, Object resource);
+
+ /**
+ * Delete a resource.
+ * @param id
+ */
+ void delete(String id);
+
+}
diff --git a/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDImplementation.java b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDImplementation.java
new file mode 100644
index 0000000000..1a9e609605
--- /dev/null
+++ b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDImplementation.java
@@ -0,0 +1,150 @@
+/*
+ * 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 crud;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.assembly.ConstrainingType;
+import org.apache.tuscany.assembly.Implementation;
+import org.apache.tuscany.assembly.Property;
+import org.apache.tuscany.assembly.Reference;
+import org.apache.tuscany.assembly.Service;
+import org.apache.tuscany.assembly.impl.ServiceImpl;
+import org.apache.tuscany.interfacedef.java.JavaInterface;
+import org.apache.tuscany.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.interfacedef.java.impl.JavaInterfaceContractImpl;
+import org.apache.tuscany.interfacedef.java.impl.JavaInterfaceImpl;
+import org.apache.tuscany.policy.Intent;
+import org.apache.tuscany.policy.PolicySet;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA
+ * assembly model.
+ *
+ * The sample CRUD implementation is not a full blown implementation,
+ * it only supports a subset of what a component implementation can
+ * support:
+ * - a single fixed service (as opposed to a list of services typed by different
+ * interfaces)
+ * - a directory attribute used to specify where a CRUD component is going
+ * to persist resources
+ * - no references or properties
+ * - no policy intents or policy sets
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class CRUDImplementation implements Implementation {
+ private Service crudService;
+ private String directory;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementation() {
+
+ // CRUD implementation always provide a single service exposing
+ // the CRUD interface, and have no references and properties
+ crudService = new ServiceImpl();
+ crudService.setName("CRUD");
+ JavaInterface javaInterface = new JavaInterfaceImpl();
+ javaInterface.setJavaClass(CRUD.class);
+ JavaInterfaceContract interfaceContract = new JavaInterfaceContractImpl();
+ interfaceContract.setInterface(javaInterface);
+ crudService.setInterfaceContract(interfaceContract);
+ }
+
+ /**
+ * Returns the directory used by CRUD implementations to persist
+ * resources.
+ *
+ * @return the directory used to persist resources
+ */
+ public String getDirectory() {
+ return directory;
+ }
+
+ /**
+ * Sets the directory used by CRUD implementations to persist
+ * resources.
+ *
+ * @param directory the directory used to persist resources
+ */
+ public void setDirectory(String directory) {
+ this.directory = directory;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // CRUD implementations do not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // CRUD implementations do not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Reference> getReferences() {
+ // CRUD implementations do not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // CRUD implementations provide a single fixed CRUD service
+ return Collections.singletonList(crudService);
+ }
+
+ public String getURI() {
+ // CRUD implementations don't have a URI
+ return null;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // CRUD implementations do not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ // CRUD implementations don't have a URI
+ }
+
+ public List<PolicySet> getPolicySets() {
+ // CRUD implementations do not support policy sets
+ return Collections.emptyList();
+ }
+
+ public List<Intent> getRequiredIntents() {
+ // CRUD implementations do not support intents
+ return Collections.emptyList();
+ }
+
+ public List<Object> getExtensions() {
+ // CRUD implementations do not support extensions
+ return Collections.emptyList();
+ }
+
+ public boolean isUnresolved() {
+ // CRUD implementations are always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // CRUD implementations are always resolved
+ }
+
+}
diff --git a/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDImplementationActivator.java b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDImplementationActivator.java
new file mode 100644
index 0000000000..af586ff901
--- /dev/null
+++ b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDImplementationActivator.java
@@ -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 crud;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.assembly.Implementation;
+import org.apache.tuscany.spi.implementation.ImplementationActivator;
+import org.apache.tuscany.spi.implementation.InvokerFactory;
+import org.apache.tuscany.spi.implementation.XMLSCDLProcessor;
+
+public class CRUDImplementationActivator implements ImplementationActivator {
+
+ private static final QName IMPLEMENTATION_CRUD = new QName("http://crud", "implementation.crud");
+
+ public QName getModelQName() {
+ return IMPLEMENTATION_CRUD;
+ }
+
+ public XMLSCDLProcessor getSCDLProcessor() {
+ return new CRUDXMLSCDLProcessor();
+ }
+
+ public Class getImplementationClass() {
+ return CRUDImplementation.class;
+ }
+
+ public InvokerFactory getInvokerFactory(Implementation m) {
+ return new CRUDInvokerFactory((CRUDImplementation)m);
+ }
+
+}
diff --git a/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDInvoker.java b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDInvoker.java
new file mode 100644
index 0000000000..c475383a97
--- /dev/null
+++ b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDInvoker.java
@@ -0,0 +1,51 @@
+/*
+ * 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 crud;
+
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.spi.implementation.Invoker;
+
+public class CRUDInvoker implements Invoker {
+
+ private ResourceManager resourceManager;
+ private Operation operation;
+
+ public CRUDInvoker(ResourceManager resourceManager, Operation operation) {
+ this.resourceManager = resourceManager;
+ this.operation = operation;
+ }
+
+ public Object invoke(Object arg0, Object[] args) {
+ if (operation.getName().equals("create")) {
+ return resourceManager.createResource(args[0]);
+
+ } else if (operation.getName().equals("retrieve")) {
+ return resourceManager.retrieveResource((String)args[0]);
+
+ } else if (operation.getName().equals("update")) {
+ return resourceManager.updateResource((String)args[0], args[1]);
+
+ } else if (operation.getName().equals("delete")) {
+ resourceManager.deleteResource((String)args[0]);
+ }
+ return null;
+ }
+
+}
diff --git a/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDInvokerFactory.java b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDInvokerFactory.java
new file mode 100644
index 0000000000..f7a53bd972
--- /dev/null
+++ b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDInvokerFactory.java
@@ -0,0 +1,43 @@
+/*
+ * 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 crud;
+
+import java.util.Map;
+
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.spi.implementation.InvokerFactory;
+
+public class CRUDInvokerFactory implements InvokerFactory {
+
+ private ResourceManager resourceManager;
+
+ public CRUDInvokerFactory(CRUDImplementation m) {
+ resourceManager = new ResourceManager(m.getDirectory());
+ }
+
+ public CRUDInvoker createInvoker(Operation operation) {
+ return new CRUDInvoker(resourceManager, operation);
+ }
+
+ public Object getInstance(Map<String, Object> arg0, Map<String, Object> arg1) {
+ return resourceManager;
+ }
+
+}
diff --git a/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDXMLSCDLProcessor.java b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDXMLSCDLProcessor.java
new file mode 100644
index 0000000000..e29a6e96e9
--- /dev/null
+++ b/sandbox/SPI/implementation-crud/src/main/java/crud/CRUDXMLSCDLProcessor.java
@@ -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 crud;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.assembly.Implementation;
+import org.apache.tuscany.spi.implementation.XMLSCDLProcessor;
+
+public class CRUDXMLSCDLProcessor implements XMLSCDLProcessor {
+
+ public void read(Implementation implementation, XMLStreamReader reader) {
+ // Read an <implementation.crud> element
+
+ // Read the directory attribute. This is where the sample
+ // CRUD implementation will persist resources.
+ String directory = reader.getAttributeValue(null, "directory");
+
+ // Create an initialize the CRUD implementation model
+ CRUDImplementation crudImplementation = (CRUDImplementation) implementation;
+ crudImplementation.setDirectory(directory);
+
+ }
+
+ public void write(Implementation implementation, XMLStreamWriter outputSource) {
+ }
+
+}
diff --git a/sandbox/SPI/implementation-crud/src/main/java/crud/ResourceManager.java b/sandbox/SPI/implementation-crud/src/main/java/crud/ResourceManager.java
new file mode 100644
index 0000000000..97f818b9b1
--- /dev/null
+++ b/sandbox/SPI/implementation-crud/src/main/java/crud/ResourceManager.java
@@ -0,0 +1,109 @@
+/*
+ * 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 crud;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A fake resource manager implementation used as a backend by the sample
+ * CRUD component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceManager implements CRUD {
+ private static int counter;
+ private static final Map<String, Object> store = new HashMap<String, Object>();
+ private String directory;
+
+ /**
+ * Constructs a new resource manager.
+ *
+ * @param directory the directory where to persist resources
+ */
+ public ResourceManager(String directory) {
+ super();
+ this.directory = directory;
+ }
+
+ /**
+ * Creates a new resource.
+ *
+ * @param resource
+ * @return
+ */
+ public String createResource(Object resource) {
+ System.out.println("create(" + resource + ") in " + directory);
+ String key = String.valueOf(counter++);
+ store.put(key, resource);
+ return key;
+ }
+
+ /**
+ * Deletes a resource.
+ *
+ * @param id
+ */
+ public void deleteResource(String id) {
+ System.out.println("delete(" + id + ")");
+ store.remove(id);
+ }
+
+ /**
+ * Retrieves a resource.
+ *
+ * @param id
+ * @return
+ */
+ public Object retrieveResource(String id) {
+ System.out.println("retrieve(" + id + ")");
+ return store.get(id);
+ }
+
+ /**
+ * Updates a resource.
+ *
+ * @param id
+ * @param resource
+ * @return
+ */
+ public Object updateResource(String id, Object resource) {
+ System.out.println("update(" + id + ")");
+ return store.put(id, resource);
+ }
+
+ //FIXME We shouldn't have to implement the CRUD interface here
+
+ public String create(Object resource) {
+ return createResource(resource);
+ }
+
+ public Object retrieve(String id) {
+ return retrieveResource(id);
+ }
+
+ public Object update(String id, Object resource) {
+ return updateResource(id, resource);
+ }
+
+ public void delete(String id) {
+ deleteResource(id);
+ }
+}
diff --git a/sandbox/SPI/implementation-crud/src/main/resources/META-INF/services/org.apache.tuscany.spi.implementation.ImplementationActivator b/sandbox/SPI/implementation-crud/src/main/resources/META-INF/services/org.apache.tuscany.spi.implementation.ImplementationActivator
new file mode 100644
index 0000000000..a661737335
--- /dev/null
+++ b/sandbox/SPI/implementation-crud/src/main/resources/META-INF/services/org.apache.tuscany.spi.implementation.ImplementationActivator
@@ -0,0 +1,3 @@
+# Implementation class for the ImplementationActivator
+crud.CRUDImplementationActivator
+
diff --git a/sandbox/SPI/implementation-crud/src/main/resources/crud.composite b/sandbox/SPI/implementation-crud/src/main/resources/crud.composite
new file mode 100644
index 0000000000..18745033bb
--- /dev/null
+++ b/sandbox/SPI/implementation-crud/src/main/resources/crud.composite
@@ -0,0 +1,30 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/crud"
+ xmlns:sc="http://sample/crud"
+ xmlns:c="http://crud"
+ name="crud">
+
+ <component name="CRUDServiceComponent">
+ <c:implementation.crud directory="tmp" />
+ </component>
+
+</composite>
diff --git a/sandbox/SPI/implementation-crud/src/test/java/crud/CRUDTestCase.java b/sandbox/SPI/implementation-crud/src/test/java/crud/CRUDTestCase.java
new file mode 100644
index 0000000000..e628d9ff72
--- /dev/null
+++ b/sandbox/SPI/implementation-crud/src/test/java/crud/CRUDTestCase.java
@@ -0,0 +1,67 @@
+/*
+ * 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 crud;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.host.embedded.SCARuntime;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CRUDTestCase extends TestCase {
+ private CRUD crudService;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void setUp() throws Exception {
+ SCARuntime.start("crud.composite");
+ ComponentContext context = SCARuntime.getComponentContext("CRUDServiceComponent");
+ assertNotNull(context);
+ ServiceReference<CRUD> self = context.createSelfReference(CRUD.class);
+ crudService = self.getService();
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+
+ public void testCRUD() throws Exception {
+ String id = crudService.create("ABC");
+ Object result = crudService.retrieve(id);
+ assertEquals("ABC", result);
+ crudService.update(id, "EFG");
+ result = crudService.retrieve(id);
+ assertEquals("EFG", result);
+ crudService.delete(id);
+ result = crudService.retrieve(id);
+ assertNull(result);
+ }
+
+
+}
diff --git a/sandbox/SPI/implementation-script/LICENSE.txt b/sandbox/SPI/implementation-script/LICENSE.txt
new file mode 100755
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/SPI/implementation-script/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, serviceDefinition marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/sandbox/SPI/implementation-script/NOTICE.txt b/sandbox/SPI/implementation-script/NOTICE.txt
new file mode 100644
index 0000000000..ecc68a9614
--- /dev/null
+++ b/sandbox/SPI/implementation-script/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/SPI/implementation-script/pom.xml b/sandbox/SPI/implementation-script/pom.xml
new file mode 100644
index 0000000000..3c1e162e1c
--- /dev/null
+++ b/sandbox/SPI/implementation-script/pom.xml
@@ -0,0 +1,124 @@
+<?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.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-script2</artifactId>
+ <name>Apache Tuscany Implementation Script</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spi</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.bsf</groupId>
+ <artifactId>bsf-all</artifactId>
+ <version>3.0-beta1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>2.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+<!-- TODO: big hack to add script engine dependencies till extension dependencies fixed -->
+
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <version>1.6R5</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jruby</groupId>
+ <artifactId>jruby-complete</artifactId>
+ <version>0.9.8</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.python</groupId>
+ <artifactId>jython</artifactId>
+ <version>2.2-beta1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptImplementation.java b/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptImplementation.java
new file mode 100644
index 0000000000..dab22e00f9
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptImplementation.java
@@ -0,0 +1,61 @@
+/*
+ * 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.tuscany.implementation.script;
+
+import org.apache.tuscany.assembly.Implementation;
+import org.apache.tuscany.assembly.impl.ComponentTypeImpl;
+
+/**
+ * Represents a Script implementation.
+ */
+public class ScriptImplementation extends ComponentTypeImpl implements Implementation {
+
+ private String scriptName;
+ private String scriptSrc;
+ private String scriptLanguage;
+
+ public ScriptImplementation() {
+ setUnresolved(true);
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public String getScriptLanguage() {
+ return scriptLanguage;
+ }
+
+ public String getScriptSrc() {
+ return scriptSrc;
+ }
+
+ public void setScriptSrc(String scriptSrc) {
+ this.scriptSrc = scriptSrc;
+ }
+
+ public void setScriptLanguage(String scriptLanguage) {
+ this.scriptLanguage = scriptLanguage;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ setURI(scriptName); // TODO: hack to enable getting componentType name
+ }
+}
diff --git a/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptImplementationActivator.java b/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptImplementationActivator.java
new file mode 100644
index 0000000000..f7112d2ed0
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptImplementationActivator.java
@@ -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.tuscany.implementation.script;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.assembly.xml.Constants;
+import org.apache.tuscany.spi.implementation.ImplementationActivator;
+import org.apache.tuscany.spi.implementation.InvokerFactory;
+import org.apache.tuscany.spi.implementation.XMLSCDLProcessor;
+
+public class ScriptImplementationActivator implements ImplementationActivator<ScriptImplementation>{
+
+ private static final QName IMPLEMENTATION_SCRIPT_QNAME = new QName(Constants.SCA10_NS, "implementation.script");
+
+ public Class getImplementationClass() {
+ return ScriptImplementation.class;
+ }
+
+ public InvokerFactory getInvokerFactory(ScriptImplementation impl) {
+ return new ScriptInvokerFactory(impl);
+ }
+
+ public QName getModelQName() {
+ return IMPLEMENTATION_SCRIPT_QNAME;
+ }
+
+ public XMLSCDLProcessor getSCDLProcessor() {
+ return new ScriptXMLSCDLProcessor();
+ }
+
+}
diff --git a/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptInvoker.java b/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptInvoker.java
new file mode 100644
index 0000000000..bfcee1d6a4
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptInvoker.java
@@ -0,0 +1,48 @@
+/*
+ * 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.tuscany.implementation.script;
+
+import javax.script.Invocable;
+import javax.script.ScriptException;
+
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.spi.implementation.Invoker;
+
+public class ScriptInvoker implements Invoker {
+
+ private String operationName;
+
+ public ScriptInvoker(ScriptImplementation impl, Operation operation) {
+ this.operationName = operation.getName();
+ }
+
+ public Object invoke(Object instance, Object[] args) {
+ try {
+
+ Invocable scriptEngine = (Invocable)instance;
+
+ return scriptEngine.invokeFunction(operationName, args);
+
+ } catch (ScriptException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptInvokerFactory.java b/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptInvokerFactory.java
new file mode 100644
index 0000000000..b2afe4a8f3
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptInvokerFactory.java
@@ -0,0 +1,74 @@
+/*
+ * 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.tuscany.implementation.script;
+
+import java.io.StringReader;
+import java.util.Map;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.implementation.Invoker;
+import org.apache.tuscany.spi.implementation.InvokerFactory;
+
+public class ScriptInvokerFactory implements InvokerFactory {
+
+ private ScriptImplementation impl;
+
+ public ScriptInvokerFactory(ScriptImplementation impl) {
+ this.impl = impl;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return new ScriptInvoker(impl, operation);
+ }
+
+ public Object getInstance(Map<String, Object> references, Map<String, Object> properties) {
+ try {
+ ScriptEngineManager manager = new ScriptEngineManager();
+
+ for (String referenceName : references.keySet()) {
+ Object reference = references.get(referenceName);
+ manager.put(referenceName, reference);
+ }
+
+ for (String propertyName : properties.keySet()) {
+ Object propertyValue = properties.get(propertyName);
+ manager.put(propertyName, propertyValue);
+ }
+
+ ScriptEngine engine = manager.getEngineByExtension(impl.getScriptLanguage());
+ if (engine == null) {
+ throw new ObjectCreationException("no script engine found for language: " + impl.getScriptLanguage());
+ }
+
+ engine.eval(new StringReader(impl.getScriptSrc()));
+
+ return engine;
+
+ } catch (ScriptException e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+
+}
diff --git a/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptXMLSCDLProcessor.java b/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptXMLSCDLProcessor.java
new file mode 100644
index 0000000000..56dc885fe8
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/main/java/org/apache/tuscany/implementation/script/ScriptXMLSCDLProcessor.java
@@ -0,0 +1,94 @@
+/*
+ * 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.tuscany.implementation.script;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.assembly.Implementation;
+import org.apache.tuscany.spi.implementation.XMLSCDLProcessor;
+
+public class ScriptXMLSCDLProcessor implements XMLSCDLProcessor {
+
+ private static final String SCRIPT = "script";
+ private static final String LANGUAGE = "language";
+
+ public void read(Implementation impl, XMLStreamReader reader) {
+ ScriptImplementation scriptImplementation = (ScriptImplementation)impl;
+
+ String scriptName = reader.getAttributeValue(null, SCRIPT);
+ scriptImplementation.setScriptName(scriptName);
+
+ String scriptLanguage = reader.getAttributeValue(null, LANGUAGE);
+ if (scriptLanguage == null || scriptLanguage.length() < 1) {
+ int i = scriptName.lastIndexOf('.');
+ scriptLanguage = scriptName.substring(i+1);
+ }
+ scriptImplementation.setScriptLanguage(scriptLanguage);
+
+ scriptImplementation.setScriptSrc(readScript(scriptImplementation.getScriptName()));
+ }
+
+ public void write(Implementation impl, XMLStreamWriter writer) {
+ }
+
+ protected String readScript(String scriptName) {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ URL scriptSrcUrl = cl.getResource(scriptName);
+ if (scriptSrcUrl == null) {
+ throw new RuntimeException("No script: " + scriptName);
+ }
+
+ InputStream is;
+ try {
+ is = scriptSrcUrl.openStream();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ try {
+
+ Reader reader = new InputStreamReader(is, "UTF-8");
+ char[] buffer = new char[1024];
+ StringBuilder source = new StringBuilder();
+ int count;
+ while ((count = reader.read(buffer)) > 0) {
+ source.append(buffer, 0, count);
+ }
+
+ return source.toString();
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+}
diff --git a/sandbox/SPI/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.spi.implementation.ImplementationActivator b/sandbox/SPI/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.spi.implementation.ImplementationActivator
new file mode 100644
index 0000000000..6db2e89f3a
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.spi.implementation.ImplementationActivator
@@ -0,0 +1,3 @@
+# Implementation class for the Script ImplementationActivator
+org.apache.tuscany.implementation.script.ScriptImplementationActivator
+
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/AbstractSCATestCase.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/AbstractSCATestCase.java
new file mode 100644
index 0000000000..f320e4be4e
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/AbstractSCATestCase.java
@@ -0,0 +1,50 @@
+/*
+ * 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.tuscany.implementation.script.itests;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.host.embedded.SCARuntime;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+
+public abstract class AbstractSCATestCase<T> extends TestCase {
+
+ protected T service;
+
+ protected void setUp() throws Exception {
+ SCARuntime.start(getCompositeName());
+ ComponentContext context = SCARuntime.getComponentContext("ClientComponent");
+ ServiceReference<T> serviceReference = context.createSelfReference(getServiceClass());
+ service = serviceReference.getService();
+ }
+
+ abstract protected Class getServiceClass();
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+ protected String getCompositeName() {
+ String className = this.getClass().getName();
+ return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+ }
+
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java
new file mode 100644
index 0000000000..98adb1f830
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java
@@ -0,0 +1,34 @@
+/*
+ * 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.tuscany.implementation.script.itests.helloworld;
+
+import org.apache.tuscany.implementation.script.itests.AbstractSCATestCase;
+
+public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
+
+ public void testCalculator() throws Exception {
+ assertEquals("Hello petra", service.sayHello("petra"));
+ }
+
+ @Override
+ protected Class<HelloWorld> getServiceClass() {
+ return HelloWorld.class;
+ }
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java
new file mode 100644
index 0000000000..671bba61ca
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java
@@ -0,0 +1,25 @@
+/*
+ * 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.tuscany.implementation.script.itests.helloworld;
+
+
+public class GroovyHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/HelloWorld.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..510b20c21c
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/HelloWorld.java
@@ -0,0 +1,26 @@
+/*
+ * 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.tuscany.implementation.script.itests.helloworld;
+
+public interface HelloWorld {
+
+ public String sayHello(String s);
+
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/HelloWorldProxy.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/HelloWorldProxy.java
new file mode 100644
index 0000000000..5ab737ec60
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/HelloWorldProxy.java
@@ -0,0 +1,33 @@
+/*
+ * 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.tuscany.implementation.script.itests.helloworld;
+
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldProxy implements HelloWorld {
+
+ @Reference
+ public HelloWorld delegate;
+
+ public String sayHello(String s) {
+ return delegate.sayHello(s);
+ }
+
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java
new file mode 100644
index 0000000000..566a62999e
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java
@@ -0,0 +1,25 @@
+/*
+ * 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.tuscany.implementation.script.itests.helloworld;
+
+
+public class JRubyHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java
new file mode 100644
index 0000000000..506421de18
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java
@@ -0,0 +1,25 @@
+/*
+ * 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.tuscany.implementation.script.itests.helloworld;
+
+
+public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java
new file mode 100644
index 0000000000..55296464f7
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java
@@ -0,0 +1,25 @@
+/*
+ * 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.tuscany.implementation.script.itests.helloworld;
+
+
+public class JythonHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/AbstractHelloWorldTestCase.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/AbstractHelloWorldTestCase.java
new file mode 100644
index 0000000000..2f249254d3
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/AbstractHelloWorldTestCase.java
@@ -0,0 +1,34 @@
+/*
+ * 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.tuscany.implementation.script.itests.properties;
+
+import org.apache.tuscany.implementation.script.itests.AbstractSCATestCase;
+
+public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
+
+ public void testCalculator() throws Exception {
+ assertEquals("Hello petra from Tuscany", service.sayHello("petra"));
+ }
+
+ @Override
+ protected Class<HelloWorld> getServiceClass() {
+ return HelloWorld.class;
+ }
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/GroovyHelloWorldTestCase.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/GroovyHelloWorldTestCase.java
new file mode 100644
index 0000000000..8a15074dbc
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/GroovyHelloWorldTestCase.java
@@ -0,0 +1,25 @@
+/*
+ * 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.tuscany.implementation.script.itests.properties;
+
+
+public class GroovyHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/HelloWorld.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/HelloWorld.java
new file mode 100644
index 0000000000..26033681f3
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/HelloWorld.java
@@ -0,0 +1,26 @@
+/*
+ * 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.tuscany.implementation.script.itests.properties;
+
+public interface HelloWorld {
+
+ public String sayHello(String s);
+
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/HelloWorldProxy.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/HelloWorldProxy.java
new file mode 100644
index 0000000000..3d315b45ea
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/HelloWorldProxy.java
@@ -0,0 +1,33 @@
+/*
+ * 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.tuscany.implementation.script.itests.properties;
+
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldProxy implements HelloWorld {
+
+ @Reference
+ public HelloWorld delegate;
+
+ public String sayHello(String s) {
+ return delegate.sayHello(s);
+ }
+
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JRubyHelloWorldTestCaseFIXME.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JRubyHelloWorldTestCaseFIXME.java
new file mode 100644
index 0000000000..6755501bca
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JRubyHelloWorldTestCaseFIXME.java
@@ -0,0 +1,29 @@
+/*
+ * 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.tuscany.implementation.script.itests.properties;
+
+public class JRubyHelloWorldTestCaseFIXME extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+
+ // this doesn't work as the property doesn't seem to get set in the JRuby
+ // script. It could be I've a typo somewhere, or a bug in the jruby script
+ // engine.
+
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java
new file mode 100644
index 0000000000..c42f7e2151
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java
@@ -0,0 +1,25 @@
+/*
+ * 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.tuscany.implementation.script.itests.properties;
+
+
+public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JythonHelloWorldTestCase.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JythonHelloWorldTestCase.java
new file mode 100644
index 0000000000..c1dd6ce4a7
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/properties/JythonHelloWorldTestCase.java
@@ -0,0 +1,25 @@
+/*
+ * 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.tuscany.implementation.script.itests.properties;
+
+
+public class JythonHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/references/HelloWorldTarget.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/references/HelloWorldTarget.java
new file mode 100644
index 0000000000..bc35df0670
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/references/HelloWorldTarget.java
@@ -0,0 +1,30 @@
+/*
+ * 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.tuscany.implementation.script.itests.references;
+
+import org.apache.tuscany.implementation.script.itests.helloworld.HelloWorld;
+
+public class HelloWorldTarget implements HelloWorld {
+
+ public String sayHello(String s) {
+ return "Hello " + s;
+ }
+
+}
diff --git a/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/references/JavaScriptReferenceTestCase.java b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/references/JavaScriptReferenceTestCase.java
new file mode 100644
index 0000000000..654e309350
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/java/org/apache/tuscany/implementation/script/itests/references/JavaScriptReferenceTestCase.java
@@ -0,0 +1,25 @@
+/*
+ * 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.tuscany.implementation.script.itests.references;
+
+import org.apache.tuscany.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
+
+public class JavaScriptReferenceTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/GroovyHelloWorld.composite b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/GroovyHelloWorld.composite
new file mode 100644
index 0000000000..c52db94bff
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/GroovyHelloWorld.composite
@@ -0,0 +1,32 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="GroovyHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/implementation/script/itests/helloworld/helloworld.groovy"/>
+ </component>
+
+</composite>
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JRubyHelloWorld.composite b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JRubyHelloWorld.composite
new file mode 100644
index 0000000000..2fc2948d0a
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JRubyHelloWorld.composite
@@ -0,0 +1,32 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="JRubyHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/implementation/script/itests/helloworld/helloworld.rb"/>
+ </component>
+
+</composite>
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite
new file mode 100644
index 0000000000..489feeab96
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite
@@ -0,0 +1,32 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="JavaScriptHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/implementation/script/itests/helloworld/helloworld.js"/>
+ </component>
+
+</composite>
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JythonHelloWorld.composite b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JythonHelloWorld.composite
new file mode 100644
index 0000000000..70c40d908c
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/JythonHelloWorld.composite
@@ -0,0 +1,32 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="JythonHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/implementation/script/itests/helloworld/helloworld.py"/>
+ </component>
+
+</composite>
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.componentType b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.componentType
new file mode 100644
index 0000000000..99a18538d8
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.componentType
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="org.apache.tuscany.implementation.script.itests.helloworld.HelloWorld" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.groovy b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.groovy
new file mode 100644
index 0000000000..9f89bd373e
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.groovy
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+def sayHello(s) {
+ return "Hello " + s
+} \ No newline at end of file
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.js b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.js
new file mode 100644
index 0000000000..eac2ab283f
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.js
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+function sayHello(s) {
+
+ return "Hello " + s;
+} \ No newline at end of file
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.py b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.py
new file mode 100644
index 0000000000..f5dd0f8fcf
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.py
@@ -0,0 +1,20 @@
+# 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.
+#
+
+def sayHello(s):
+ return 'Hello ' + s \ No newline at end of file
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.rb b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.rb
new file mode 100644
index 0000000000..cd2d3bcaea
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/helloworld/helloworld.rb
@@ -0,0 +1,21 @@
+# 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.
+#
+
+def sayHello(s)
+ return "Hello " + s
+end \ No newline at end of file
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/GroovyHelloWorld.composite b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/GroovyHelloWorld.composite
new file mode 100644
index 0000000000..35abb780fa
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/GroovyHelloWorld.composite
@@ -0,0 +1,32 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="GroovyProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/implementation/script/itests/properties/helloworld.groovy"/>
+ </component>
+
+</composite>
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JRubyHelloWorld.composite b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JRubyHelloWorld.composite
new file mode 100644
index 0000000000..bd4661b7a3
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JRubyHelloWorld.composite
@@ -0,0 +1,32 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="JRubyProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent" />
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/implementation/script/itests/properties/helloworld.rb"/>
+ </component>
+
+</composite>
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JavaScriptHelloWorld.composite b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JavaScriptHelloWorld.composite
new file mode 100644
index 0000000000..adf04cbcc0
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JavaScriptHelloWorld.composite
@@ -0,0 +1,32 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="JavaScriptProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/implementation/script/itests/properties/helloworld.js"/>
+ </component>
+
+</composite>
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JythonHelloWorld.composite b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JythonHelloWorld.composite
new file mode 100644
index 0000000000..633f20e8f0
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/JythonHelloWorld.composite
@@ -0,0 +1,32 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="JythonProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/implementation/script/itests/properties/helloworld.py"/>
+ </component>
+
+</composite>
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.componentType b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.componentType
new file mode 100644
index 0000000000..de4669ddea
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.componentType
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="org.apache.tuscany.implementation.script.itests.helloworld.HelloWorld" />
+ </service>
+
+ <property name="greeter" type="xsd:string">Tuscany</property>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.groovy b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.groovy
new file mode 100644
index 0000000000..a7eb446d37
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.groovy
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+def sayHello(s) {
+ return "Hello " + s + " from " + greeter
+} \ No newline at end of file
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.js b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.js
new file mode 100644
index 0000000000..64df3ebbef
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.js
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+function sayHello(s) {
+
+ return "Hello " + s + " from " + greeter;
+} \ No newline at end of file
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.py b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.py
new file mode 100644
index 0000000000..868cfa9eeb
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.py
@@ -0,0 +1,20 @@
+# 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.
+#
+
+def sayHello(s):
+ return 'Hello ' + s + ' from ' + greeter \ No newline at end of file
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.rb b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.rb
new file mode 100644
index 0000000000..2844f8b8d9
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/properties/helloworld.rb
@@ -0,0 +1,21 @@
+# 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.
+#
+
+def sayHello(s)
+ return "Hello " + s + " from " + $greeter
+end \ No newline at end of file
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/JavaScriptReference.composite b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/JavaScriptReference.composite
new file mode 100644
index 0000000000..00bbac878e
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/JavaScriptReference.composite
@@ -0,0 +1,37 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="JavaScriptReference">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="ReferenceComponent"></reference>
+ </component>
+
+ <component name="ReferenceComponent">
+ <implementation.script script="org/apache/tuscany/implementation/script/itests/references/reference.js"/>
+ <reference name="ref" target="TargetComponent" />
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="org.apache.tuscany.implementation.script.itests.references.HelloWorldTarget"/>
+ </component>
+
+</composite>
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/reference.componentType b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/reference.componentType
new file mode 100644
index 0000000000..71be1baf73
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/reference.componentType
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloWorldService">
+ <interface.java interface="org.apache.tuscany.implementation.script.itests.helloworld.HelloWorld" />
+ </service>
+
+ <reference name="ref">
+ <interface.java interface="org.apache.tuscany.implementation.script.itests.helloworld.HelloWorld" />
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/reference.js b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/reference.js
new file mode 100644
index 0000000000..ad0a932d26
--- /dev/null
+++ b/sandbox/SPI/implementation-script/src/test/resources/org/apache/tuscany/implementation/script/itests/references/reference.js
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+function sayHello(s) {
+ return ref.sayHello(s);
+} \ No newline at end of file
diff --git a/sandbox/SPI/implementation-spi-impl/LICENSE.txt b/sandbox/SPI/implementation-spi-impl/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/SPI/implementation-spi-impl/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, serviceDefinition marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/sandbox/SPI/implementation-spi-impl/NOTICE.txt b/sandbox/SPI/implementation-spi-impl/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/SPI/implementation-spi-impl/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/SPI/implementation-spi-impl/pom.xml b/sandbox/SPI/implementation-spi-impl/pom.xml
new file mode 100644
index 0000000000..c37c2a4482
--- /dev/null
+++ b/sandbox/SPI/implementation-spi-impl/pom.xml
@@ -0,0 +1,69 @@
+<?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.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-spi-impl</artifactId>
+ <name>Apache Tuscany Implementation SPI</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spi</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/Discovery.java b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/Discovery.java
new file mode 100644
index 0000000000..ba3392795a
--- /dev/null
+++ b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/Discovery.java
@@ -0,0 +1,98 @@
+/*
+ * 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.tuscany.spi.implementation.impl;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.core.util.IOHelper;
+
+public class Discovery {
+
+ /**
+ * Read the service name from a configuration file
+ *
+ * @param classLoader
+ * @param name The name of the service class
+ * @return A class name which extends/implements the service class
+ * @throws IOException
+ */
+ private static Set<String> getServiceNames(ClassLoader classLoader, String name) throws IOException {
+ Set<String> set = new HashSet<String>();
+ Enumeration<URL> urls = classLoader.getResources("META-INF/services/" + name);
+ while (urls.hasMoreElements()) {
+ URL url = urls.nextElement();
+ Set<String> service = getServiceNames(url);
+ if (service != null) {
+ set.addAll(service);
+
+ }
+ }
+ return set;
+ }
+
+ private static Set<String> getServiceNames(URL url) throws IOException {
+ Set<String> names = new HashSet<String>();
+ InputStream is = IOHelper.getInputStream(url);
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(is));
+ while (true) {
+ String line = reader.readLine();
+ if (line == null) {
+ break;
+ }
+ line = line.trim();
+ if (!line.startsWith("#") && !"".equals(line)) {
+ names.add(line.trim());
+ }
+ }
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ return names;
+ }
+
+ public static <T> Collection<T> getInstances(final ClassLoader classLoader, Class<T> serviceClass) {
+ List<T> instances = new ArrayList<T>();
+ try {
+ Set<String> services = getServiceNames(classLoader, serviceClass.getName());
+ for (String className : services) {
+ Class cls = Class.forName(className, true, classLoader);
+ instances.add(serviceClass.cast(cls.newInstance())); // NOPMD
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ return instances;
+ }
+
+}
diff --git a/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplAtomicComponent.java b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplAtomicComponent.java
new file mode 100644
index 0000000000..a6bd04baad
--- /dev/null
+++ b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplAtomicComponent.java
@@ -0,0 +1,155 @@
+/*
+ * 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.tuscany.spi.implementation.impl;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.assembly.ComponentProperty;
+import org.apache.tuscany.assembly.Implementation;
+import org.apache.tuscany.core.component.ComponentContextImpl;
+import org.apache.tuscany.core.component.ComponentContextProvider;
+import org.apache.tuscany.core.component.ServiceReferenceImpl;
+import org.apache.tuscany.core.component.scope.InstanceWrapperBase;
+import org.apache.tuscany.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.SingletonObjectFactory;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.extension.AtomicComponentExtension;
+import org.apache.tuscany.spi.implementation.ImplementationActivator;
+import org.apache.tuscany.spi.implementation.Invoker;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+
+public class ImplAtomicComponent extends AtomicComponentExtension implements ComponentContextProvider {
+
+ private ComponentContext componentContext;
+ private ImplementationActivator ia;
+ private Implementation impl;
+
+ private Map<String, Object> references;
+ private Map<String, ObjectFactory<?>> propertyValueFactories;
+
+ private PropertyValueObjectFactory propertyValueObjectFactory = null;
+ private DataBindingExtensionPoint dataBindingRegistry;
+
+ public ImplAtomicComponent(URI uri, URI groupId, ImplementationActivator ia, Implementation impl) {
+ super(uri, null, null, groupId, 50);
+ this.ia = ia;
+ this.componentContext = new ComponentContextImpl(this);
+ this.impl = impl;
+ references = new HashMap<String, Object>();
+ propertyValueFactories = new HashMap<String, ObjectFactory<?>>();
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+ Map<String, Object> properties = new HashMap<String, Object>();
+ for (String propertyName : propertyValueFactories.keySet()) {
+ ObjectFactory<?> propertyValueFactory = propertyValueFactories.get(propertyName);
+ if ( propertyValueFactory != null) {
+ properties.put(propertyName, propertyValueFactory.getInstance());
+ }
+ }
+ return ia.getInvokerFactory(impl).getInstance(references, properties);
+ }
+
+ public InstanceWrapper createInstanceWrapper() throws ObjectCreationException {
+ return new InstanceWrapperBase(createInstance());
+ }
+
+ public void attachCallbackWire(Wire arg0) {
+ }
+
+ public void attachWire(Wire wire) {
+ references.put(wire.getSourceUri().getFragment(), createWireProxy(wire));
+ }
+
+ protected Object createWireProxy(Wire wire) {
+ // TODO: this is completly wrong :) Need to create a proxy wraping the wire
+ Object ref;
+ try {
+ ref = wire.getTargetInstance();
+ } catch (TargetResolutionException e) {
+ throw new RuntimeException(e);
+ }
+ return ref;
+ }
+
+ public void attachWires(List<Wire> arg0) {
+ }
+
+ public List<Wire> getWires(String arg0) {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, final Operation operation, boolean callback)
+ throws TargetInvokerCreationException {
+ Invoker invoker = ia.getInvokerFactory(impl).createInvoker(operation);
+ return new ImplTargetInvoker(invoker, this, scopeContainer, workContext);
+ }
+
+ @Override
+ public ComponentContext getComponentContext() {
+ return componentContext;
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) {
+ return null;
+ }
+
+ public <B> B getProperty(Class<B> type, String propertyName) {
+ return null;
+ }
+
+ public <B> B getService(Class<B> businessInterface, String referenceName) {
+ return null;
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ return new ServiceReferenceImpl<B>(businessInterface, new SingletonObjectFactory<B>((B)createInstance()));
+ }
+ public void setDataBindingRegistry(DataBindingExtensionPoint dataBindingRegistry) {
+ this.dataBindingRegistry = dataBindingRegistry;
+ }
+
+ public void setPropertyValueObjectFactory(PropertyValueObjectFactory propertyValueObjectFactory) {
+ this.propertyValueObjectFactory = propertyValueObjectFactory;
+ }
+
+ public void initializePropertyValueFactories(List<ComponentProperty> properties) {
+ ObjectFactory<?> propertyObjectFactory = null;
+
+ for (ComponentProperty aProperty : properties) {
+ if (aProperty.getValue() != null) {
+ propertyObjectFactory = propertyValueObjectFactory.createValueFactory(aProperty);
+ propertyValueFactories.put(aProperty.getName(), propertyObjectFactory);
+ }
+ }
+ }
+}
diff --git a/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplTargetInvoker.java b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplTargetInvoker.java
new file mode 100644
index 0000000000..d734f6e060
--- /dev/null
+++ b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplTargetInvoker.java
@@ -0,0 +1,123 @@
+/*
+ * 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.tuscany.spi.implementation.impl;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.spi.Scope;
+import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.component.InvalidConversationSequenceException;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.TargetInvokerExtension;
+import org.apache.tuscany.spi.implementation.Invoker;
+
+/**
+ * Perform the actual script invocation
+ * TODO: move vertually all of this to SPI TargetInvokerExtension
+ */
+@SuppressWarnings("deprecation")
+public class ImplTargetInvoker<T> extends TargetInvokerExtension {
+
+ protected Object clazz;
+ protected Invoker invoker;
+
+ private final ImplAtomicComponent component;
+ private final ScopeContainer scopeContainer;
+ protected InstanceWrapper<T> target;
+ protected boolean stateless;
+
+ public ImplTargetInvoker(Invoker invoker,
+ ImplAtomicComponent component,
+ ScopeContainer scopeContainer,
+ WorkContext workContext) {
+
+ this.invoker = invoker;
+ this.component = component;
+ this.scopeContainer = scopeContainer;
+ stateless = Scope.STATELESS == scopeContainer.getScope();
+
+ // TODO: support script classes
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object invokeTarget(Object payload, short sequence, WorkContext workContext) throws InvocationTargetException {
+ Object contextId = workContext.getIdentifier(scopeContainer.getScope());
+ try {
+
+ InstanceWrapper<T> wrapper = getInstance(sequence, contextId);
+ Object instance = wrapper.getInstance();
+
+ Object ret = invoker.invoke(instance, (Object[])payload);
+
+ scopeContainer.returnWrapper(component, wrapper, contextId);
+ if (sequence == END) {
+ // if end conversation, remove resource
+ scopeContainer.remove(component);
+ }
+
+ return ret;
+
+ } catch (ComponentException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ImplTargetInvoker clone() throws CloneNotSupportedException {
+ try {
+ ImplTargetInvoker invoker = (ImplTargetInvoker)super.clone();
+ invoker.target = null;
+ return invoker;
+ } catch (CloneNotSupportedException e) {
+ return null; // will not happen
+ }
+ }
+
+ /**
+ * Resolves the target service instance or returns a cached one
+ */
+ @SuppressWarnings("unchecked")
+ protected InstanceWrapper<T> getInstance(short sequence, Object contextId) throws TargetException {
+ switch (sequence) {
+ case NONE:
+ if (cacheable) {
+ if (target == null) {
+ target = scopeContainer.getWrapper(component, contextId);
+ }
+ return target;
+ } else {
+ return scopeContainer.getWrapper(component, contextId);
+ }
+ case START:
+ assert !cacheable;
+ return scopeContainer.getWrapper(component, contextId);
+ case CONTINUE:
+ case END:
+ assert !cacheable;
+ return scopeContainer.getAssociatedWrapper(component, contextId);
+ default:
+ throw new InvalidConversationSequenceException("Unknown sequence type", String.valueOf(sequence));
+ }
+ }
+}
diff --git a/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationArtifactProcessor.java b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationArtifactProcessor.java
new file mode 100644
index 0000000000..aa72aeed50
--- /dev/null
+++ b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationArtifactProcessor.java
@@ -0,0 +1,114 @@
+/*
+ * 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.tuscany.spi.implementation.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.assembly.ComponentType;
+import org.apache.tuscany.assembly.Implementation;
+import org.apache.tuscany.assembly.Property;
+import org.apache.tuscany.assembly.Reference;
+import org.apache.tuscany.assembly.Service;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.contribution.processor.StAXArtifactProcessorExtension;
+import org.apache.tuscany.contribution.resolver.ArtifactResolver;
+import org.apache.tuscany.contribution.service.ContributionReadException;
+import org.apache.tuscany.contribution.service.ContributionResolveException;
+import org.apache.tuscany.contribution.service.ContributionWireException;
+import org.apache.tuscany.contribution.service.ContributionWriteException;
+import org.apache.tuscany.spi.implementation.ImplementationActivator;
+
+public class ImplementationArtifactProcessor implements StAXArtifactProcessorExtension {
+
+ private ImplementationActivator ia;
+
+ public ImplementationArtifactProcessor(ImplementationActivator ia) {
+ this.ia = ia;
+ }
+
+ public QName getArtifactType() {
+ return ia.getModelQName();
+ }
+
+ public Object read(XMLStreamReader reader) throws ContributionReadException {
+ // Read an <implementation.crud> element
+ try {
+
+ Implementation implementation = (Implementation)ia.getImplementationClass().newInstance();
+ ia.getSCDLProcessor().read(implementation, reader);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && ia.getModelQName().equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ } catch (InstantiationException e) {
+ throw new ContributionReadException(e);
+ } catch (IllegalAccessException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void write(Object arg0, XMLStreamWriter arg1) throws ContributionWriteException {
+ }
+
+ public Class getModelType() {
+ return ia.getImplementationClass();
+ }
+
+ public void resolve(Object arg0, ArtifactResolver resolver) throws ContributionResolveException {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Implementation impl = (Implementation)arg0;
+ String scriptURI = cl.getResource(((Implementation)arg0).getURI()).toString();
+ int lastDot = scriptURI.lastIndexOf('.');
+ String ctURI = scriptURI.substring(0, lastDot) + ".componentType";
+ ComponentType componentType = new DefaultAssemblyFactory().createComponentType();
+ componentType.setUnresolved(true);
+ componentType.setURI(ctURI);
+ componentType = resolver.resolve(ComponentType.class, componentType);
+ if (componentType.isUnresolved()) {
+ throw new ContributionResolveException("missing .componentType side file");
+ }
+ for (Reference reference : componentType.getReferences()) {
+ impl.getReferences().add(reference);
+ }
+ for (Service service : componentType.getServices()) {
+ impl.getServices().add(service);
+ }
+ for (Property property : componentType.getProperties()) {
+ impl.getProperties().add(property);
+ }
+ }
+
+ public void wire(Object arg0) throws ContributionWireException {
+ }
+
+}
diff --git a/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationBuilder.java b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationBuilder.java
new file mode 100644
index 0000000000..e081284e8b
--- /dev/null
+++ b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationBuilder.java
@@ -0,0 +1,65 @@
+/*
+ * 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.tuscany.spi.implementation.impl;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.assembly.Component;
+import org.apache.tuscany.assembly.Implementation;
+import org.apache.tuscany.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.implementation.ImplementationActivator;
+
+public class ImplementationBuilder extends ComponentBuilderExtension {
+
+ private ImplementationActivator ia;
+ private PropertyValueObjectFactory propertyValueObjectFactory;
+ private DataBindingExtensionPoint dataBindingRegistry;
+
+ public ImplementationBuilder(ImplementationActivator ia) {
+ this.ia = ia;
+ }
+
+ @Override
+ protected Class getImplementationType() {
+ return ia.getImplementationClass();
+ }
+
+ public AtomicComponent build(Component definition, DeploymentContext context) throws BuilderConfigException {
+ URI uri = URI.create(context.getComponentId() + definition.getName());
+ Implementation impl = definition.getImplementation();
+ ImplAtomicComponent component = new ImplAtomicComponent(uri, context.getGroupId(), ia, impl);
+ component.setPropertyValueObjectFactory(propertyValueObjectFactory);
+ component.setDataBindingRegistry(dataBindingRegistry);
+ component.initializePropertyValueFactories(definition.getProperties());
+ return component;
+ }
+
+ public void setPropertyValueObjectFactory(PropertyValueObjectFactory propertyValueObjectFactory) {
+ this.propertyValueObjectFactory = propertyValueObjectFactory;
+ }
+
+ public void setDataBindingRegistry(DataBindingExtensionPoint dataBindingRegistry) {
+ this.dataBindingRegistry = dataBindingRegistry;
+ }
+}
diff --git a/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationSPIModuleActivator.java b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationSPIModuleActivator.java
new file mode 100644
index 0000000000..97396a3363
--- /dev/null
+++ b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/ImplementationSPIModuleActivator.java
@@ -0,0 +1,80 @@
+/*
+ * 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.tuscany.spi.implementation.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.tuscany.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.core.ExtensionPointRegistry;
+import org.apache.tuscany.core.ModuleActivator;
+import org.apache.tuscany.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.databinding.Mediator;
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+import org.apache.tuscany.spi.implementation.ImplementationActivator;
+
+public class ImplementationSPIModuleActivator implements ModuleActivator {
+
+ private Collection<ImplementationArtifactProcessor> as = new ArrayList();
+
+ public ImplementationSPIModuleActivator() {
+ }
+
+ public void start(ExtensionPointRegistry epRegistry) {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ Collection<ImplementationActivator> ias = Discovery.getInstances(classLoader, ImplementationActivator.class);
+
+ StAXArtifactProcessorExtensionPoint artifactProcessors = epRegistry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ BuilderRegistry builderRegistry = epRegistry.getExtensionPoint(BuilderRegistry.class);
+
+ for (ImplementationActivator ia : ias) {
+
+ ImplementationArtifactProcessor implementationArtifactProcessor = new ImplementationArtifactProcessor(ia);
+ artifactProcessors.addExtension(implementationArtifactProcessor);
+ as.add(implementationArtifactProcessor);
+
+ ImplementationBuilder builder = new ImplementationBuilder(ia);
+ builder.setBuilderRegistry(builderRegistry);
+ builderRegistry.register(ia.getImplementationClass(), builder);
+
+ Mediator mediator = epRegistry.getExtensionPoint(Mediator.class);
+ PropertyValueObjectFactory factory = new PropertyValueObjectFactory(mediator);
+ builder.setPropertyValueObjectFactory(factory);
+
+ DataBindingExtensionPoint dataBindingRegistry = epRegistry.getExtensionPoint(DataBindingExtensionPoint.class);
+ builder.setDataBindingRegistry(dataBindingRegistry);
+
+ builder.init();
+ }
+ }
+
+ public void stop(ExtensionPointRegistry epRegistry) {
+ StAXArtifactProcessorExtensionPoint artifactProcessors = epRegistry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ for (ImplementationArtifactProcessor iap : as) {
+ artifactProcessors.removeExtension(iap);
+ }
+ }
+
+ public Map<Class, Object> getExtensionPoints() {
+ return null;
+ }
+
+}
diff --git a/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/PropertyValueObjectFactory.java b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/PropertyValueObjectFactory.java
new file mode 100644
index 0000000000..3143f9f591
--- /dev/null
+++ b/sandbox/SPI/implementation-spi-impl/src/main/java/org/apache/tuscany/spi/implementation/impl/PropertyValueObjectFactory.java
@@ -0,0 +1,224 @@
+/*
+ * 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.tuscany.spi.implementation.impl;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.tuscany.assembly.Property;
+import org.apache.tuscany.databinding.Mediator;
+import org.apache.tuscany.databinding.SimpleTypeMapper;
+import org.apache.tuscany.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.interfacedef.DataType;
+import org.apache.tuscany.interfacedef.util.XMLType;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class PropertyValueObjectFactory {
+ // protected DataBindingRegistry dbRegistry = new DataBindingRegistryImpl();
+ protected Mediator mediator = null;
+ protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperExtension();
+ boolean isSimpleType;
+
+ public PropertyValueObjectFactory(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ public ObjectFactory createValueFactory(Property property) {
+ isSimpleType = isSimpleType(property);
+ Document doc = (Document)property.getValue();
+ Element rootElement = doc.getDocumentElement();
+
+ //FIXME : since scripts use dynamic types we need to generate a dynamic java type using the
+ //xml structure of the property value. Should this be done in the JavaBeansDataBinding...
+ Class javaType = null;
+
+ if (property.isMany()) {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ List<String> values =
+ getSimplePropertyValues(value, javaType);
+ return new ListObjectFactoryImpl(property,
+ values,
+ isSimpleType,
+ javaType);
+ } else {
+ return new ListObjectFactoryImpl(property,
+ getComplexPropertyValues(doc),
+ isSimpleType,
+ javaType);
+ }
+ } else {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ return new ObjectFactoryImpl(property,
+ value,
+ isSimpleType,
+ javaType);
+ } else {
+ Object value = getComplexPropertyValues(doc).get(0);
+ return new ObjectFactoryImpl(property,
+ value,
+ isSimpleType,
+ javaType);
+ }
+
+ }
+ }
+
+ private boolean isSimpleType(Property property) {
+ if (property.getXSDType() != null) {
+ return SimpleTypeMapperExtension.isSimpleXSDType(property.getXSDType());
+ } else {
+ if (property instanceof Document) {
+ Document doc = (Document)property;
+ Element element = doc.getDocumentElement();
+ if (element.getChildNodes().getLength() == 1 &&
+ element.getChildNodes().item(0).getNodeType() == Element.TEXT_NODE) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private List<String> getSimplePropertyValues(String concatenatedValue, Class javaType) {
+ List<String> propValues = new ArrayList<String>();
+ StringTokenizer st = null;
+ if ( javaType.getName().equals("java.lang.String")) {
+ st = new StringTokenizer(concatenatedValue, "\"");
+ } else {
+ st = new StringTokenizer(concatenatedValue);
+ }
+ String aToken = null;
+ while (st.hasMoreTokens()) {
+ aToken = st.nextToken();
+ if (aToken.trim().length() > 0) {
+ propValues.add(aToken);
+ }
+ }
+ return propValues;
+ }
+
+ private List<Node> getComplexPropertyValues(Document document) {
+ Element rootElement = document.getDocumentElement();
+ List<Node> propValues = new ArrayList<Node>();
+ for (int count = 0 ; count < rootElement.getChildNodes().getLength() ; ++count) {
+ if (rootElement.getChildNodes().item(count).getNodeType() == Document.ELEMENT_NODE) {
+ propValues.add(rootElement.getChildNodes().item(count));
+ }
+ }
+ return propValues;
+ }
+
+ public abstract class ObjectFactoryImplBase implements ObjectFactory {
+ protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperExtension();
+ protected Property property;
+ protected Object propertyValue;
+ protected Class javaType;
+ protected DataType<XMLType> sourceDataType;
+ protected DataType<?> targetDataType;
+ boolean isSimpleType;
+
+ public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+
+ this.isSimpleType = isSimpleType;
+ this.property = property;
+ this.propertyValue = propertyValue;
+ this.javaType = javaType;
+ //FIXME : fix this when we have managed to generate dynamic java types
+ /*sourceDataType =
+ new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class,
+ new XMLType(null, this.property.getXSDType()));
+ TypeInfo typeInfo = null;
+ if (this.property.getXSDType() != null) {
+ if (SimpleTypeMapperExtension.isSimpleXSDType(this.property.getXSDType())) {
+ typeInfo = new TypeInfo(property.getXSDType(), true, null);
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+
+ XMLType xmlType = new XMLType(typeInfo);
+ String dataBinding = null; //(String)property.getExtensions().get(DataBinding.class.getName());
+ if (dataBinding != null) {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ } else {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ mediator.getDataBindingRegistry().introspectType(targetDataType, null);
+ }*/
+ }
+ }
+
+ public class ObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+ super(property, propertyValue, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
+ } else {
+ return mediator.mediate(propertyValue, sourceDataType, targetDataType, null);
+ //return null;
+ }
+ }
+ }
+
+ public class ListObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ListObjectFactoryImpl(Property property, List<?>propertyValues, boolean isSimpleType, Class javaType) {
+ super(property, propertyValues, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<?> getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ List<Object> values = new ArrayList<Object>();
+ for (String aValue : (List<String>)propertyValue) {
+ values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
+ }
+ return values;
+ } else {
+ List instances = new ArrayList();
+ for (Node aValue : (List<Node>)propertyValue) {
+ instances.add(mediator.mediate(aValue,
+ sourceDataType,
+ targetDataType,
+ null));
+ }
+ return instances;
+ }
+ }
+ }
+}
+ \ No newline at end of file
diff --git a/sandbox/SPI/implementation-spi-impl/src/main/resources/META-INF/services/org.apache.tuscany.core.ModuleActivator b/sandbox/SPI/implementation-spi-impl/src/main/resources/META-INF/services/org.apache.tuscany.core.ModuleActivator
new file mode 100644
index 0000000000..f3048e883c
--- /dev/null
+++ b/sandbox/SPI/implementation-spi-impl/src/main/resources/META-INF/services/org.apache.tuscany.core.ModuleActivator
@@ -0,0 +1,2 @@
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.spi.implementation.impl.ImplementationSPIModuleActivator
diff --git a/sandbox/SPI/implementation-spi/LICENSE.txt b/sandbox/SPI/implementation-spi/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sandbox/SPI/implementation-spi/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, serviceDefinition marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/sandbox/SPI/implementation-spi/NOTICE.txt b/sandbox/SPI/implementation-spi/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sandbox/SPI/implementation-spi/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sandbox/SPI/implementation-spi/pom.xml b/sandbox/SPI/implementation-spi/pom.xml
new file mode 100644
index 0000000000..79a749bf47
--- /dev/null
+++ b/sandbox/SPI/implementation-spi/pom.xml
@@ -0,0 +1,81 @@
+<?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.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-spi</artifactId>
+ <name>Apache Tuscany Implementation SPI</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/ImplementationActivator.java b/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/ImplementationActivator.java
new file mode 100644
index 0000000000..d5c2d24286
--- /dev/null
+++ b/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/ImplementationActivator.java
@@ -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.tuscany.spi.implementation;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.assembly.Implementation;
+
+public interface ImplementationActivator<I extends Implementation> {
+
+ QName getModelQName();
+
+ Class getImplementationClass();
+
+ InvokerFactory getInvokerFactory(I m);
+
+ XMLSCDLProcessor getSCDLProcessor();
+
+}
diff --git a/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/Invoker.java b/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/Invoker.java
new file mode 100644
index 0000000000..423aef4d7e
--- /dev/null
+++ b/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/Invoker.java
@@ -0,0 +1,26 @@
+/*
+ * 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.tuscany.spi.implementation;
+
+public interface Invoker {
+
+ Object invoke(Object instance, Object[] args);
+
+}
diff --git a/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/InvokerFactory.java b/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/InvokerFactory.java
new file mode 100644
index 0000000000..c4f0b4a69f
--- /dev/null
+++ b/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/InvokerFactory.java
@@ -0,0 +1,31 @@
+/*
+ * 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.tuscany.spi.implementation;
+
+import java.util.Map;
+
+import org.apache.tuscany.interfacedef.Operation;
+
+public interface InvokerFactory {
+
+ Invoker createInvoker(Operation operation);
+
+ Object getInstance(Map<String, Object> references, Map<String, Object> properties);
+}
diff --git a/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/XMLSCDLProcessor.java b/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/XMLSCDLProcessor.java
new file mode 100644
index 0000000000..1a79256cc9
--- /dev/null
+++ b/sandbox/SPI/implementation-spi/src/main/java/org/apache/tuscany/spi/implementation/XMLSCDLProcessor.java
@@ -0,0 +1,33 @@
+/*
+ * 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.tuscany.spi.implementation;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.assembly.Implementation;
+
+public interface XMLSCDLProcessor<I extends Implementation> {
+
+ public void read(I implementation, XMLStreamReader reader);
+
+ public void write(I implementation, XMLStreamWriter outputSource);
+
+}