summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main')
-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
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/Helloworld.java31
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java78
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java80
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java78
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldServiceImpl.java35
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/StatusImpl.java32
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementation.java41
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementationProcessor.java105
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleJavaInvoker.java46
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProvider.java77
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProviderFactory.java50
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/binding.lifecycle.BindingFactory20
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor21
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema21
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory20
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory20
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/binding-lifecycle.xsd37
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/implementation-lifecycle.xsd38
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/lifecycle.composite55
26 files changed, 1220 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);
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/Helloworld.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/Helloworld.java
new file mode 100644
index 0000000000..7b9c17cf59
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/Helloworld.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Helloworld {
+
+ String sayHello(String name) throws Exception;
+
+ String throwException(String name) throws Exception;
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java
new file mode 100644
index 0000000000..931e61677d
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java
@@ -0,0 +1,78 @@
+/*
+ * 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.Destroy;
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Scope;
+
+/*
+ * C = a composite scoped component that throws exceptions
+ */
+
+@Scope("COMPOSITE")
+public class HelloworldClientImplC implements Helloworld {
+
+ public static boolean throwTestExceptionOnConstruction = false;
+ public static boolean throwTestExceptionOnInit = false;
+ public static boolean throwTestExceptionOnDestroy = false;
+
+
+ @Reference
+ public Helloworld service;
+
+ public HelloworldClientImplC() throws Exception {
+ if(throwTestExceptionOnConstruction){
+ StatusImpl.appendStatus("Exception on construction", "HelloworldClientImplC");
+ throw new Exception("Exception on construction");
+ }
+ }
+
+ @Init
+ public void initialize() throws Exception{
+ if (throwTestExceptionOnInit) {
+ StatusImpl.appendStatus("Exception on init", "HelloworldClientImplC");
+ throw new Exception("Exception on init");
+ }
+
+ StatusImpl.appendStatus("Init", "HelloworldClientImplC");
+ System.out.println(">>>>>> " + sayHello("init"));
+ }
+
+ @Destroy
+ public void destroy() throws Exception{
+ if (throwTestExceptionOnDestroy) {
+ StatusImpl.appendStatus("Exception on destroy", "HelloworldClientImplC");
+ throw new Exception("Exception on destroy");
+ }
+
+ StatusImpl.appendStatus("Destroy", "HelloworldClientImplC");
+ }
+
+ public String sayHello(String name) throws Exception {
+ return "Hi " + service.sayHello(name);
+ }
+
+ public String throwException(String name) throws Exception {
+ throw new Exception("test exception");
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java
new file mode 100644
index 0000000000..af97452ee9
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import org.oasisopen.sca.annotation.Destroy;
+import org.oasisopen.sca.annotation.EagerInit;
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Scope;
+
+/*
+ * CE = a composite scoped component with EagerInit that throws exceptions
+ */
+
+@EagerInit
+@Scope("COMPOSITE")
+public class HelloworldClientImplCE implements Helloworld {
+
+ public static boolean throwTestExceptionOnConstruction = false;
+ public static boolean throwTestExceptionOnInit = false;
+ public static boolean throwTestExceptionOnDestroy = false;
+
+
+ @Reference
+ public Helloworld service;
+
+ public HelloworldClientImplCE() throws Exception {
+ if(throwTestExceptionOnConstruction){
+ StatusImpl.appendStatus("Exception on construction", "HelloworldClientImplCE");
+ throw new Exception("Exception on construction");
+ }
+ }
+
+ @Init
+ public void initialize() throws Exception{
+ if (throwTestExceptionOnInit) {
+ StatusImpl.appendStatus("Exception on init", "HelloworldClientImplCE");
+ throw new Exception("Exception on init");
+ }
+
+ StatusImpl.appendStatus("Init", "HelloworldClientImplCE");
+ System.out.println(">>>>>> " + sayHello("init"));
+ }
+
+ @Destroy
+ public void destroy() throws Exception{
+ if (throwTestExceptionOnDestroy) {
+ StatusImpl.appendStatus("Exception on destroy", "HelloworldClientImplCE");
+ throw new Exception("Exception on destroy");
+ }
+
+ StatusImpl.appendStatus("Destroy", "HelloworldClientImplCE");
+ }
+
+ public String sayHello(String name) throws Exception {
+ return "Hi " + service.sayHello(name);
+ }
+
+ public String throwException(String name) throws Exception {
+ throw new Exception("test exception");
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java
new file mode 100644
index 0000000000..493ccca972
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java
@@ -0,0 +1,78 @@
+/*
+ * 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.Destroy;
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Scope;
+
+/*
+ * S = a stateless scoped component that throws exceptions
+ */
+
+@Scope("STATELESS")
+public class HelloworldClientImplS implements Helloworld {
+
+ public static boolean throwTestExceptionOnConstruction = false;
+ public static boolean throwTestExceptionOnInit = false;
+ public static boolean throwTestExceptionOnDestroy = false;
+
+
+ @Reference
+ public Helloworld service;
+
+ public HelloworldClientImplS() throws Exception {
+ if(throwTestExceptionOnConstruction){
+ StatusImpl.appendStatus("Exception on construction", "HelloworldClientImplS");
+ throw new Exception("Exception on construction");
+ }
+ }
+
+ @Init
+ public void initialize() throws Exception{
+ if (throwTestExceptionOnInit) {
+ StatusImpl.appendStatus("Exception on init", "HelloworldClientImplS");
+ throw new Exception("Exception on init");
+ }
+
+ StatusImpl.appendStatus("Init", "HelloworldClientImplS");
+ System.out.println(">>>>>> " + sayHello("init"));
+ }
+
+ @Destroy
+ public void destroy() throws Exception{
+ if (throwTestExceptionOnDestroy) {
+ StatusImpl.appendStatus("Exception on destroy", "HelloworldClientImplS");
+ throw new Exception("Exception on destroy");
+ }
+
+ StatusImpl.appendStatus("Destroy", "HelloworldClientImplS");
+ }
+
+ public String sayHello(String name) throws Exception {
+ return "Hi " + service.sayHello(name);
+ }
+
+ public String throwException(String name) throws Exception {
+ throw new Exception("test exception");
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldServiceImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldServiceImpl.java
new file mode 100644
index 0000000000..2d27ec8f58
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/HelloworldServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * 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 HelloworldServiceImpl implements Helloworld {
+
+ public String sayHello(String name) {
+ String response = "Hello " + name;
+ System.out.println("At service - " + response);
+ return response;
+ }
+
+ public String throwException(String name) throws Exception {
+ // not used
+ return null;
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/StatusImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/StatusImpl.java
new file mode 100644
index 0000000000..644853d6c2
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/helloworld/StatusImpl.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 helloworld;
+
+public class StatusImpl {
+
+ public static String statusString = "";
+
+ public static void appendStatus(String event, String location){
+ // remove any addresses from the strings
+ location = location.replaceAll("\\(@.*Endpoint", "Endpoint");
+ statusString += event + " - " + location + "\n";
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementation.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementation.java
new file mode 100644
index 0000000000..ebed204b87
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementation.java
@@ -0,0 +1,41 @@
+/*
+ * 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 implementation.lifecycle;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+
+/**
+ * Model representing a Sample implementation in an SCA assembly.
+ *
+ * @version $Rev$ $Date$
+ */
+public class LifecycleImplementation extends ImplementationImpl {
+ static final QName QN = new QName(SCA11_TUSCANY_NS, "implementation.lifecycle");
+
+ final String name;
+ Class<?> clazz;
+
+ LifecycleImplementation(final String name) {
+ super(QN);
+ this.name = name;
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementationProcessor.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementationProcessor.java
new file mode 100644
index 0000000000..c7989b291c
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementationProcessor.java
@@ -0,0 +1,105 @@
+/*
+ * 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 implementation.lifecycle;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
+
+/**
+ * StAX artifact processor for Sample implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class LifecycleImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<LifecycleImplementation> {
+ final AssemblyFactory af;
+ final JavaInterfaceFactory jif;
+ final WSDLFactory wf;
+
+ public LifecycleImplementationProcessor(final ExtensionPointRegistry ep) {
+ final FactoryExtensionPoint fep = ep.getExtensionPoint(FactoryExtensionPoint.class);
+ this.af = fep.getFactory(AssemblyFactory.class);
+ this.jif = fep.getFactory(JavaInterfaceFactory.class);
+ this.wf = fep.getFactory(WSDLFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return LifecycleImplementation.QN;
+ }
+
+ public Class<LifecycleImplementation> getModelType() {
+ return LifecycleImplementation.class;
+ }
+
+ public LifecycleImplementation read(final XMLStreamReader r, final ProcessorContext ctx) throws ContributionReadException, XMLStreamException {
+ // not actually going to read any config for this test
+ // so just create a model
+ LifecycleImplementation impl = new LifecycleImplementation("helloworld.Helloworld");
+ impl.setUnresolved(true);
+ return impl;
+ }
+
+ public void resolve(final LifecycleImplementation impl, final ModelResolver res, final ProcessorContext ctx) throws ContributionResolveException {
+ try {
+ Class c = Class.forName("helloworld.Helloworld");
+ Service s = af.createService();
+ s.setName("Helloworld");
+ JavaInterfaceContract ic = jif.createJavaInterfaceContract();
+ ic.setInterface(jif.createJavaInterface(c));
+ s.setInterfaceContract(ic);
+ impl.getServices().add(s);
+ impl.setUnresolved(false);
+ } catch (Exception ex){
+ throw new ContributionResolveException(ex);
+ }
+ }
+
+ public void write(final LifecycleImplementation impl, final XMLStreamWriter w, final ProcessorContext ctx) throws ContributionWriteException, XMLStreamException {
+ // not required for this test
+ }
+
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleJavaInvoker.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleJavaInvoker.java
new file mode 100644
index 0000000000..ac750fe040
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleJavaInvoker.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package implementation.lifecycle;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Invoker for Sample components that implement a Java interface.
+ *
+ * @version $Rev$ $Date$
+ */
+class SampleJavaInvoker implements Invoker {
+ final Object instance;
+ final Method method;
+
+ SampleJavaInvoker(final JavaOperation op, final Class<?> clazz, final Object instance) throws SecurityException, NoSuchMethodException {
+ this.instance = instance;
+ this.method = clazz.getMethod(op.getJavaMethod().getName(), op.getJavaMethod().getParameterTypes());
+ }
+
+ public Message invoke(final Message msg) {
+ // we don't actually do anything here
+ return msg;
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProvider.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProvider.java
new file mode 100644
index 0000000000..f1e303882f
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProvider.java
@@ -0,0 +1,77 @@
+/*
+ * 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 implementation.lifecycle;
+
+import helloworld.StatusImpl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Implementation provider for Sample component implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+class LifecycleProvider implements ImplementationProvider {
+ final RuntimeComponent comp;
+ final LifecycleImplementation impl;
+ final ProxyFactory pxf;
+ final ExtensionPointRegistry ep;
+ Object instance;
+
+ // make this static rather than worrying about persistence on the reference side
+ static Map<String, Object> asyncMessageMap = new HashMap<String, Object>();
+
+ LifecycleProvider(final RuntimeComponent comp, final LifecycleImplementation impl, ProxyFactory pf, ExtensionPointRegistry ep) {
+ this.comp = comp;
+ this.impl = impl;
+ this.pxf = pf;
+ this.ep = ep;
+ }
+
+ public void start() {
+ StatusImpl.appendStatus("Implementation start", comp.getName());
+ }
+
+ public void stop() {
+ StatusImpl.appendStatus("Implementation stop", comp.getName());
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public Invoker createInvoker(final RuntimeComponentService s, final Operation op) {
+ try {
+ return new SampleJavaInvoker((JavaOperation)op, impl.clazz, instance);
+ } 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/implementation/lifecycle/LifecycleProviderFactory.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProviderFactory.java
new file mode 100644
index 0000000000..dfd39716fd
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProviderFactory.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package implementation.lifecycle;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Factory for Sample implementation providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public class LifecycleProviderFactory implements ImplementationProviderFactory<LifecycleImplementation> {
+ final ProxyFactory pxf;
+ final ExtensionPointRegistry ep;
+
+ public LifecycleProviderFactory(final ExtensionPointRegistry ep) {
+ this.ep = ep;
+ pxf = ExtensibleProxyFactory.getInstance(ep);
+ }
+
+ public ImplementationProvider createImplementationProvider(final RuntimeComponent comp, final LifecycleImplementation impl) {
+ return new LifecycleProvider(comp, impl, pxf, ep);
+ }
+
+ public Class<LifecycleImplementation> getModelType() {
+ return LifecycleImplementation.class;
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/binding.lifecycle.BindingFactory b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/binding.lifecycle.BindingFactory
new file mode 100644
index 0000000000..357cf65727
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/binding.lifecycle.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
+binding.lifecycle.LifecycleBindingFactory
+
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..09a474a567
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#binding.lifecycle,model=binding.lifecycle.LifecycleBinding,factory=binding.lifecycle.LifecycleBindingFactory
+implementation.lifecycle.LifecycleImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#implementation.lifecycle,model=implementation.lifecycle.LifecycleImplementation
+
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
new file mode 100644
index 0000000000..e436702181
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+implementation-lifecycle.xsd
+binding-lifecycle.xsd
+
+
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..9a814793b2
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/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
+binding.lifecycle.LifecycleBindingProviderFactory;model=binding.lifecycle.LifecycleBinding
+
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..c9b5077888
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -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 provider for Sample components
+implementation.lifecycle.LifecycleProviderFactory;model=implementation.lifecycle.LifecycleImplementation
+
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/binding-lifecycle.xsd b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/binding-lifecycle.xsd
new file mode 100644
index 0000000000..b798446c26
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/binding-lifecycle.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<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="binding.lifecycle" type="t:BindingLifecycle" substitutionGroup="sca:binding"/>
+
+ <complexType name="BindingLifecycle">
+ <complexContent>
+ <extension base="sca:Binding">
+ <attribute name="someAttr" type="string" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/implementation-lifecycle.xsd b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/implementation-lifecycle.xsd
new file mode 100644
index 0000000000..c029a43922
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/implementation-lifecycle.xsd
@@ -0,0 +1,38 @@
+<?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.lifecycle" type="t:LifecycleImplementation" substitutionGroup="sca:implementation"/>
+
+ <complexType name="LifecycleImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <attribute name="class" type="string" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/lifecycle.composite b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/lifecycle.composite
new file mode 100644
index 0000000000..f08f6fe57b
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/lifecycle/src/main/resources/lifecycle.composite
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://sample"
+ name="lifecycle">
+
+ <component name="HelloworldService">
+ <implementation.java class="helloworld.HelloworldServiceImpl"/>
+ <service name="Helloworld">
+ <tuscany:binding.lifecycle name="lifecycle"/>
+ </service>
+ </component>
+
+
+ <component name="HelloworldServiceTestImpl">
+ <tuscany:implementation.lifecycle class="helloworld.HelloworldServiceImpl"/>
+ <service name="Helloworld">
+ <tuscany:binding.lifecycle name="lifecycle"/>
+ </service>
+ </component>
+
+ <component name="HelloworldClientC">
+ <implementation.java class="helloworld.HelloworldClientImplC"/>
+ <reference name="service" target="HelloworldService"/>
+ </component>
+
+ <component name="HelloworldClientCE">
+ <implementation.java class="helloworld.HelloworldClientImplCE"/>
+ <reference name="service" target="HelloworldService"/>
+ </component>
+
+ <component name="HelloworldClientS">
+ <implementation.java class="helloworld.HelloworldClientImplS"/>
+ <reference name="service" target="HelloworldService"/>
+ </component>
+
+</composite>