From 132aa8a77685ec92bc90c03f987650d275a7b639 Mon Sep 17 00:00:00 2001 From: lresende Date: Mon, 30 Sep 2013 06:59:11 +0000 Subject: 2.0.1 RC1 release tag git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1527464 13f79535-47bb-0310-9956-ffa450edef68 --- .../archetype-resources/META-INF/MANIFEST.MF | 17 ++++++ .../src/main/resources/archetype-resources/pom.xml | 59 +++++++++++++++++++++ .../java/__implementationName__Implementation.java | 52 +++++++++++++++++++ ..._implementationName__ImplementationFactory.java | 35 +++++++++++++ ...implementationName__BindingProviderFactory.java | 50 ++++++++++++++++++ ...plementationName__ReferenceBindingProvider.java | 58 +++++++++++++++++++++ .../__implementationName__ReferenceInvoker.java | 56 ++++++++++++++++++++ ...implementationName__ServiceBindingProvider.java | 60 ++++++++++++++++++++++ .../__implementationName__ServiceInvoker.java | 43 ++++++++++++++++ .../java/runtime/__implementationName__Stash.java | 47 +++++++++++++++++ .../__package__.__bindingName__BindingFactory | 20 ++++++++ ...ca.contribution.processor.StAXArtifactProcessor | 20 ++++++++ ...any.sca.contribution.processor.ValidationSchema | 19 +++++++ ...che.tuscany.sca.provider.BindingProviderFactory | 20 ++++++++ .../resources/implementation-__artifactId__.xsd | 37 +++++++++++++ .../src/test/java/helloworld/HelloWorldClient.java | 36 +++++++++++++ .../src/test/java/helloworld/HelloWorldImpl.java | 31 +++++++++++ .../test/java/helloworld/HelloWorldService.java | 31 +++++++++++ .../java/test/__bindingName__BindingTestCase.java | 55 ++++++++++++++++++++ .../src/test/resources/helloworld.composite | 39 ++++++++++++++ 20 files changed, 785 insertions(+) create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/META-INF/MANIFEST.MF create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/pom.xml create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__Implementation.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/__implementationName__ImplementationFactory.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__BindingProviderFactory.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceBindingProvider.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ReferenceInvoker.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceBindingProvider.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__ServiceInvoker.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/java/runtime/__implementationName__Stash.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/__package__.__bindingName__BindingFactory create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/implementation-__artifactId__.xsd create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldClient.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldService.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/test/__bindingName__BindingTestCase.java create mode 100644 sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/resources/helloworld.composite (limited to 'sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources') diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/META-INF/MANIFEST.MF b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..5880433840 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +SCA-Version: 1.1 +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 ${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.implementation.${artifactId} +Bundle-DocURL: http://www.apache.org/ +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/pom.xml b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 0000000000..d0a1a2aa17 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-modules + 2.0.1 + ../pom.xml + + + binding-${artifactId} + ${groupId} + ${version} + Apache Tuscany SCA ${implementationName} Implementation Extension + + + + + org.apache.tuscany.sca + tuscany-assembly-xml + 2.0.1 + provided + + + + org.apache.tuscany.sca + tuscany-domain-node + 2.0.1 + test + + + + junit + junit + 4.8.1 + test + + + + + 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 services = new HashMap(); + + 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); + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/__package__.__bindingName__BindingFactory b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/__package__.__bindingName__BindingFactory new file mode 100644 index 0000000000..3759b19fa0 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/__package__.__bindingName__BindingFactory @@ -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. + +# Implementation class for model factory +${package}.${bindingName}BindingFactory + diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor new file mode 100644 index 0000000000..eb49133022 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -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. + +# Implementation class for the artifact processor extension +org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#binding.${artifactId},model=${package}.${bindingName}Binding,factory=${package}.${bindingName}BindingFactory + diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema new file mode 100644 index 0000000000..c33264f2a4 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema @@ -0,0 +1,19 @@ +# 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. +# +binding-${artifactId}.xsd + diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory new file mode 100644 index 0000000000..3c0cfbc6d9 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory @@ -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. + +# Implementation class for the binding extension +${package}.runtime.${bindingName}BindingProviderFactory;model=${package}.${bindingName}Binding + diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/implementation-__artifactId__.xsd b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/implementation-__artifactId__.xsd new file mode 100644 index 0000000000..d0c6f62439 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/main/resources/implementation-__artifactId__.xsd @@ -0,0 +1,37 @@ +#set( $implementationNameLC = ${implementationName} ) + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldClient.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..de982cefc1 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldClient.java @@ -0,0 +1,36 @@ +#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 helloworld; + +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClient implements HelloWorldService { + + @Reference + public HelloWorldService ref; + + public String sayHello(String name) { + return ref.sayHello(name); + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldImpl.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..521f6828ce --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,31 @@ +#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 helloworld; + + +public class HelloWorldImpl implements HelloWorldService { + + public String sayHello(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldService.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..eca0df1543 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/helloworld/HelloWorldService.java @@ -0,0 +1,31 @@ +#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 helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldService { + + String sayHello(String name); + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/test/__bindingName__BindingTestCase.java b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/test/__bindingName__BindingTestCase.java new file mode 100644 index 0000000000..61847e5eda --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/java/test/__bindingName__BindingTestCase.java @@ -0,0 +1,55 @@ +#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 test; + +import helloworld.HelloWorldService; +import junit.framework.Assert; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ${bindingName}BindingTestCase { + + private static Node node; + + @Test + public void testSayHello() { + HelloWorldService service = node.getService(HelloWorldService.class, "HelloWorldClient/HelloWorldService"); + Assert.assertEquals("Hello boo", service.sayHello("boo")); + } + + @BeforeClass + public static void init() throws Exception { + node = NodeFactory.newInstance().createNode("helloworld.composite").start(); + } + + @AfterClass + public static void destroy() throws Exception { + if (node != null) { + node.stop(); + } + } + +} diff --git a/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/resources/helloworld.composite b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/resources/helloworld.composite new file mode 100644 index 0000000000..f0e6150c10 --- /dev/null +++ b/sca-java-2.x/tags/2.0.1-RC1/maven/archetypes/implementation/src/main/resources/archetype-resources/src/test/resources/helloworld.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3