summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle')
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBinding.java49
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingFactory.java32
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingProviderFactory.java47
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceBindingProvider.java63
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceInvoker.java48
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceBindingProvider.java56
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceInvoker.java40
7 files changed, 335 insertions, 0 deletions
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBinding.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBinding.java
new file mode 100644
index 0000000000..ecd4393e4d
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBinding.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package binding.lifecycle;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.provider.BaseBindingImpl;
+
+/**
+ * Represents a binding to a Sample service.
+ */
+public class LifecycleBinding extends BaseBindingImpl {
+
+ public static final QName TYPE = new QName(SCA11_TUSCANY_NS, "binding.lifecycle");
+
+ private String someAttr;
+
+ public LifecycleBinding() {
+ }
+
+ 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/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingFactory.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingFactory.java
new file mode 100644
index 0000000000..4fdf09bdf0
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingFactory.java
@@ -0,0 +1,32 @@
+/*
+ * 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 binding.lifecycle;
+
+
+/**
+ * Factory implementation to create Sample Models
+ */
+public class LifecycleBindingFactory {
+
+ public LifecycleBinding createLifecycleBinding() {
+ return new LifecycleBinding();
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingProviderFactory.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingProviderFactory.java
new file mode 100644
index 0000000000..f197578e84
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingProviderFactory.java
@@ -0,0 +1,47 @@
+/*
+ * 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 binding.lifecycle;
+
+import binding.lifecycle.LifecycleBinding;
+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 LifecycleBindingProviderFactory implements BindingProviderFactory<LifecycleBinding> {
+
+ public LifecycleBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ }
+
+ public Class<LifecycleBinding> getModelType() {
+ return LifecycleBinding.class;
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpoint) {
+ return new LifecycleReferenceBindingProvider(endpoint);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
+ return new LifecycleServiceBindingProvider(endpoint);
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceBindingProvider.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceBindingProvider.java
new file mode 100644
index 0000000000..5c2ca0bf77
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceBindingProvider.java
@@ -0,0 +1,63 @@
+/*
+ * 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 binding.lifecycle;
+
+import helloworld.StatusImpl;
+
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.impl.EndpointImpl;
+import org.apache.tuscany.sca.assembly.impl.EndpointReferenceImpl;
+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 LifecycleReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private EndpointReference endpoint;
+ private InterfaceContract contract;
+
+ public LifecycleReferenceBindingProvider(EndpointReference endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return new LifecycleReferenceInvoker(operation, endpoint);
+ }
+
+ public void start() {
+ StatusImpl.appendStatus("Reference binding start",
+ ((EndpointReferenceImpl)endpoint).toStringWithoutHash());
+ }
+
+ public void stop() {
+ StatusImpl.appendStatus("Reference binding stop",
+ ((EndpointReferenceImpl)endpoint).toStringWithoutHash());
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return contract;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceInvoker.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceInvoker.java
new file mode 100644
index 0000000000..023be8613b
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceInvoker.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package binding.lifecycle;
+
+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 LifecycleReferenceInvoker implements Invoker {
+
+ protected Operation operation;
+ protected EndpointReference endpoint;
+
+ public LifecycleReferenceInvoker(Operation operation, EndpointReference endpoint) {
+ this.operation = operation;
+ this.endpoint = endpoint;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] body = msg.getBody();
+ msg.setBody(body[0]);
+ return msg;
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceBindingProvider.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceBindingProvider.java
new file mode 100644
index 0000000000..158aa27201
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceBindingProvider.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package binding.lifecycle;
+
+import helloworld.StatusImpl;
+
+import org.apache.tuscany.sca.assembly.impl.EndpointImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+
+public class LifecycleServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeEndpoint endpoint;
+ private InterfaceContract contract;
+
+ public LifecycleServiceBindingProvider(RuntimeEndpoint endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public void start() {
+ StatusImpl.appendStatus("Service binding start",
+ ((EndpointImpl)endpoint).toStringWithoutHash());
+ }
+
+ public void stop() {
+ StatusImpl.appendStatus("Service binding stop",
+ ((EndpointImpl)endpoint).toStringWithoutHash());
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return contract;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceInvoker.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceInvoker.java
new file mode 100644
index 0000000000..09ca7a051e
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceInvoker.java
@@ -0,0 +1,40 @@
+/*
+ * 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 binding.lifecycle;
+
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+
+public class LifecycleServiceInvoker {
+
+ private RuntimeEndpoint wire;
+
+ public LifecycleServiceInvoker(RuntimeEndpoint wire) {
+ this.wire = wire;
+ }
+
+ /**
+ * Send the request down the wire to invoke the service
+ */
+ public Message invokeService(Message msg) {
+ return wire.invoke(msg);
+ }
+
+}