Author: antelder
Date: Wed Jun 29 07:58:41 2011
New Revision: 1140988

URL: http://svn.apache.org/viewvc?rev=1140988&view=rev
Log:
Start of an archetype for creating implementation extensions. Not finished yet 
and doesn't work

Added:
    tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/
      - copied from r1140467, 
tuscany/sca-java-2.x/trunk/maven/archetypes/binding/
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__Implementation.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__ImplementationFactory.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__BindingProviderFactory.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceBindingProvider.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceInvoker.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceBindingProvider.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceInvoker.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__Stash.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/implementation-__artifactId__.xsd
Removed:
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__bindingName__Binding.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__bindingName__BindingFactory.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__bindingName__BindingProviderFactory.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__bindingName__ReferenceBindingProvider.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__bindingName__ReferenceInvoker.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__bindingName__ServiceBindingProvider.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__bindingName__ServiceInvoker.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__bindingName__Stash.java
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/binding-__artifactId__.xsd
Modified:
    tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/pom.xml
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/META-INF/maven/archetype-metadata.xml
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/META-INF/MANIFEST.MF
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/pom.xml
    
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/test/resources/projects/basic/archetype.properties

Modified: tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/pom.xml?rev=1140988&r1=1140467&r2=1140988&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/pom.xml 
(original)
+++ tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/pom.xml Wed Jun 
29 07:58:41 2011
@@ -26,10 +26,10 @@
         <relativePath>../../../pom.xml</relativePath>
     </parent>
 
-    <artifactId>tuscany-binding-archetype</artifactId>
+    <artifactId>tuscany-implementation-archetype</artifactId>
     <packaging>maven-archetype</packaging>
-    <name>Create a Tuscany binding extension project</name>
-    <description>Create a Tuscany binding extension project</description>
+    <name>Create a Tuscany implementation extension project</name>
+    <description>Create a Tuscany implementation extension 
project</description>
 
     <build>
        <extensions>

Modified: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/META-INF/maven/archetype-metadata.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/META-INF/maven/archetype-metadata.xml?rev=1140988&r1=1140467&r2=1140988&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/META-INF/maven/archetype-metadata.xml
 (original)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/META-INF/maven/archetype-metadata.xml
 Wed Jun 29 07:58:41 2011
@@ -22,7 +22,7 @@
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
 
   <requiredProperties>
-    <requiredProperty key="bindingName">
+    <requiredProperty key="implementationName">
     </requiredProperty>
   </requiredProperties>
 

Modified: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/META-INF/MANIFEST.MF
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/META-INF/MANIFEST.MF?rev=1140988&r1=1140467&r2=1140988&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/META-INF/MANIFEST.MF
 (original)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/META-INF/MANIFEST.MF
 Wed Jun 29 07:58:41 2011
@@ -1,17 +1,17 @@
 Manifest-Version: 1.0
 SCA-Version: 1.1
-Bundle-Name: Apache Tuscany SCA ${bindingName} Binding
+Bundle-Name: Apache Tuscany SCA ${implementationName} Implementation
 Bundle-Vendor: The Apache Software Foundation
 Bundle-Version: 2.0.0
 Bundle-ManifestVersion: 2
 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-Description: Apache Tuscany SCA ${bindingName} Binding
+Bundle-Description: Apache Tuscany SCA ${implementationName} Binding
 Import-Package: org.apache.tuscany.sca.assembly;version="2.0.0",
  org.apache.tuscany.sca.core;version="2.0.0",
  org.apache.tuscany.sca.interfacedef;version="2.0.0",
  org.apache.tuscany.sca.invocation;version="2.0.0",
  org.apache.tuscany.sca.provider;version="2.0.0",
  org.apache.tuscany.sca.runtime;version="2.0.0"
-Bundle-SymbolicName: org.apache.tuscany.sca.binding.${artifactId}
+Bundle-SymbolicName: org.apache.tuscany.sca.implementation.${artifactId}
 Bundle-DocURL: http://www.apache.org/
-Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6

Modified: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/pom.xml?rev=1140988&r1=1140467&r2=1140988&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/pom.xml
 (original)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/pom.xml
 Wed Jun 29 07:58:41 2011
@@ -26,10 +26,10 @@
         <relativePath>../pom.xml</relativePath>
     </parent>
 
-    <artifactId>binding-${project.artifactId}</artifactId>
+    <artifactId>binding-${artifactId}</artifactId>
     <groupId>${groupId}</groupId>
-    <version>${project.version}</version>
-    <name>Apache Tuscany SCA ${bindingName} Binding Extension</name>
+    <version>${version}</version>
+    <name>Apache Tuscany SCA ${implementationName} Implementation 
Extension</name>
 
     <dependencies>
 
@@ -42,42 +42,7 @@
 
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-host-http</artifactId>
-            <version>2.0-SNAPSHOT</version>
-            <scope>provided</scope>
-        </dependency>   
-                
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-            <version>2.5</version>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-host-jetty</artifactId>
-            <version>2.0-SNAPSHOT</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-node-impl</artifactId>
-            <version>2.0-SNAPSHOT</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-implementation-java-runtime</artifactId>
-            <version>2.0-SNAPSHOT</version>
-            <scope>test</scope>
-        </dependency>    
-
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-sca-api</artifactId>
+            <artifactId>tuscany-domain-node</artifactId>
             <version>2.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>

Added: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__Implementation.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__Implementation.java?rev=1140988&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__Implementation.java
 (added)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__Implementation.java
 Wed Jun 29 07:58:41 2011
@@ -0,0 +1,52 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 ${package};
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.provider.BaseBindingImpl;
+
+/**
+ * Represents a binding to a ${bindingName} service.
+ */
+public class ${bindingName}Binding extends BaseBindingImpl {
+
+    public static final QName TYPE = new QName(SCA11_TUSCANY_NS, 
"binding.${artifactId}");
+
+    private String someAttr;
+
+    public ${bindingName}Binding() {
+    }
+
+    public QName getType() {
+        return TYPE;
+    }
+    
+    public String getSomeAttr() {
+        return someAttr;
+    }
+
+    public void setSomeAttr(String someAttr) {
+        this.someAttr = someAttr;
+    }
+
+}

Added: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__ImplementationFactory.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__ImplementationFactory.java?rev=1140988&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__ImplementationFactory.java
 (added)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__ImplementationFactory.java
 Wed Jun 29 07:58:41 2011
@@ -0,0 +1,35 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 ${package};
+
+
+/**
+ * Factory implementation to create ${bindingName} Models
+ */
+public class ${bindingName}BindingFactory {
+
+    public ${bindingName}Binding create${bindingName}Binding() {
+        return new ${bindingName}Binding();
+    }
+
+}

Added: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__BindingProviderFactory.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__BindingProviderFactory.java?rev=1140988&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__BindingProviderFactory.java
 (added)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__BindingProviderFactory.java
 Wed Jun 29 07:58:41 2011
@@ -0,0 +1,50 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 ${package}.runtime;
+
+import ${package}.${bindingName}Binding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
+
+public class ${bindingName}BindingProviderFactory implements 
BindingProviderFactory<${bindingName}Binding> {
+
+    public ${bindingName}BindingProviderFactory(ExtensionPointRegistry 
extensionPoints) {
+    }
+
+    public Class<${bindingName}Binding> getModelType() {
+        return ${bindingName}Binding.class;
+    }
+
+    public ReferenceBindingProvider 
createReferenceBindingProvider(RuntimeEndpointReference endpoint) {
+        return new ${bindingName}ReferenceBindingProvider(endpoint);
+    }
+
+    public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint 
endpoint) {
+        return new ${bindingName}ServiceBindingProvider(endpoint);
+    }
+
+}

Added: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceBindingProvider.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceBindingProvider.java?rev=1140988&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceBindingProvider.java
 (added)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceBindingProvider.java
 Wed Jun 29 07:58:41 2011
@@ -0,0 +1,58 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 ${package}.runtime;
+
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+
+public class ${bindingName}ReferenceBindingProvider implements 
ReferenceBindingProvider {
+
+    private EndpointReference endpoint;
+    private InterfaceContract contract;
+
+    public ${bindingName}ReferenceBindingProvider(EndpointReference endpoint) {
+        this.endpoint = endpoint;
+    }
+    
+    public Invoker createInvoker(Operation operation) {
+        return new ${bindingName}ReferenceInvoker(operation, endpoint);
+    }
+
+    public void start() {
+    }
+
+    public void stop() {
+    }
+
+    public InterfaceContract getBindingInterfaceContract() {
+        return contract;
+    }
+
+    public boolean supportsOneWayInvocation() {
+        return false;
+    }
+
+}

Added: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceInvoker.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceInvoker.java?rev=1140988&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceInvoker.java
 (added)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceInvoker.java
 Wed Jun 29 07:58:41 2011
@@ -0,0 +1,56 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 ${package}.runtime;
+
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+public class ${bindingName}ReferenceInvoker implements Invoker {
+    
+    protected Operation operation;
+    protected EndpointReference endpoint;
+
+    public ${bindingName}ReferenceInvoker(Operation operation, 
EndpointReference endpoint) {
+        this.operation = operation;
+        this.endpoint = endpoint;
+    }
+
+    public Message invoke(Message msg) {
+        try {
+
+            return doInvoke(msg);
+            
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public Message doInvoke(Message msg) {
+        // Add some code here to make an invocation over the ${bindingName} 
binding protocol
+        // For this sample we'll just get it from the static stash
+        ${bindingName}ServiceInvoker fi = 
${bindingName}Stash.getService(endpoint.getBinding().getURI());
+        return fi.invokeService(msg);
+    }
+}

Added: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceBindingProvider.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceBindingProvider.java?rev=1140988&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceBindingProvider.java
 (added)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceBindingProvider.java
 Wed Jun 29 07:58:41 2011
@@ -0,0 +1,60 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 ${package}.runtime;
+
+import ${package}.${bindingName}Binding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+
+public class ${bindingName}ServiceBindingProvider implements 
ServiceBindingProvider {
+
+    private RuntimeEndpoint endpoint;
+    private InterfaceContract contract;
+
+    public ${bindingName}ServiceBindingProvider(RuntimeEndpoint endpoint) {
+        this.endpoint = endpoint;
+    }
+
+    public void start() {
+        // add some code here to start the service
+
+        // For this sample we'll just share it in a static
+        ${bindingName}Stash.addService(endpoint.getBinding().getURI(), new 
${bindingName}ServiceInvoker(endpoint));
+        
+        System.out.println("someAttr=" + 
((${bindingName}Binding)endpoint.getBinding()).getSomeAttr());
+    }
+
+    public void stop() {
+        ${bindingName}Stash.removeService(endpoint.getBinding().getURI());
+    }
+
+    public InterfaceContract getBindingInterfaceContract() {
+        return contract;
+    }
+
+    public boolean supportsOneWayInvocation() {
+        return false;
+    }
+
+}

Added: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceInvoker.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceInvoker.java?rev=1140988&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceInvoker.java
 (added)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceInvoker.java
 Wed Jun 29 07:58:41 2011
@@ -0,0 +1,43 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 ${package}.runtime;
+
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+
+public class ${bindingName}ServiceInvoker {
+
+    private RuntimeEndpoint wire;
+    
+    public ${bindingName}ServiceInvoker(RuntimeEndpoint wire) {
+        this.wire = wire;
+    }
+
+    /**
+     * Send the request down the wire to invoke the service 
+     */
+    public Message invokeService(Message msg) {
+        return wire.invoke(msg);
+    }
+    
+}

Added: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__Stash.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__Stash.java?rev=1140988&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__Stash.java
 (added)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__Stash.java
 Wed Jun 29 07:58:41 2011
@@ -0,0 +1,47 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 ${package}.runtime;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Simplistic static Map to share service endpoints with references
+ */
+public class ${bindingName}Stash {
+    
+    private static Map<String, ${bindingName}ServiceInvoker> services = new 
HashMap<String, ${bindingName}ServiceInvoker>();
+    
+    public static void addService(String uri, ${bindingName}ServiceInvoker 
${bindingName}ServiceInvoker) {
+        services.put(uri, ${bindingName}ServiceInvoker);
+    }
+
+    public static ${bindingName}ServiceInvoker getService(String uri) {
+        return services.get(uri);
+    }
+
+    public static void removeService(String uri) {
+        services.remove(uri);
+    }
+
+}

Added: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/implementation-__artifactId__.xsd
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/implementation-__artifactId__.xsd?rev=1140988&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/implementation-__artifactId__.xsd
 (added)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/implementation-__artifactId__.xsd
 Wed Jun 29 07:58:41 2011
@@ -0,0 +1,37 @@
+#set( $implementationNameLC = ${implementationName} )<?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.    
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"; 
+    targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1"; 
+    xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912";
+    xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"; 
+    elementFormDefault="qualified">
+
+    <import namespace="http://docs.oasis-open.org/ns/opencsa/sca/200912"; />
+
+    <element name="implementation.${artifactId}" 
type="t:${implementationName}Implementation" 
substitutionGroup="sca:implementation"/>
+    
+    <complexType name="${implementationName}Implementation">
+        <complexContent>
+            <extension base="sca:Implementation">
+                <attribute name="someAttr" type="string" use="optional"/>
+            </extension>
+        </complexContent>
+    </complexType>
+</schema>

Modified: 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/test/resources/projects/basic/archetype.properties
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/test/resources/projects/basic/archetype.properties?rev=1140988&r1=1140467&r2=1140988&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/test/resources/projects/basic/archetype.properties
 (original)
+++ 
tuscany/sca-java-2.x/trunk/maven/archetypes/implementation/src/test/resources/projects/basic/archetype.properties
 Wed Jun 29 07:58:41 2011
@@ -19,5 +19,5 @@ version=0.1-SNAPSHOT
 groupId=archetype.it
 package=archetype.it.basic
 artifactId=basic
-bindingName=Basic
+implementationName=Basic
 


Reply via email to