summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java')
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__Implementation.java52
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__ImplementationFactory.java35
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__BindingProviderFactory.java50
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceBindingProvider.java58
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceInvoker.java56
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceBindingProvider.java60
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceInvoker.java43
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__Stash.java47
8 files changed, 401 insertions, 0 deletions
diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__Implementation.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__Implementation.java
new file mode 100644
index 0000000000..d9cbdb954d
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__Implementation.java
@@ -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;
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__ImplementationFactory.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__ImplementationFactory.java
new file mode 100644
index 0000000000..ae1cd88745
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__ImplementationFactory.java
@@ -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();
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__BindingProviderFactory.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__BindingProviderFactory.java
new file mode 100644
index 0000000000..93c6bf3c04
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__BindingProviderFactory.java
@@ -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);
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceBindingProvider.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceBindingProvider.java
new file mode 100644
index 0000000000..dc2991014e
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceBindingProvider.java
@@ -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;
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceInvoker.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceInvoker.java
new file mode 100644
index 0000000000..d3e2bd1812
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceInvoker.java
@@ -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);
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceBindingProvider.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceBindingProvider.java
new file mode 100644
index 0000000000..59d41091d8
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceBindingProvider.java
@@ -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;
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceInvoker.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceInvoker.java
new file mode 100644
index 0000000000..8ea20d41ed
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceInvoker.java
@@ -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);
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__Stash.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__Stash.java
new file mode 100644
index 0000000000..416a10e7b1
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__Stash.java
@@ -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);
+ }
+
+}