diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-09 21:20:45 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-09 21:20:45 +0000 |
commit | 6c51c6d6f32b9972ed825f1444309212f9d99a21 (patch) | |
tree | 8acdefe3ff30f2336d73aafb59a2651e0dd4f026 /sca-java-2.x/trunk | |
parent | bee47a62dc7805d7cfd71ee379ebc29519268c4e (diff) |
Start to clean up the node-api (remove Node.destroy())
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@908233 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
49 files changed, 244 insertions, 152 deletions
diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/server-config.xml b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/server-config.xml index 2067c9e96b..590cf3bddb 100644 --- a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/server-config.xml +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/server-config.xml @@ -20,7 +20,7 @@ <node xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns="http://tuscany.apache.org/xmlns/sca/1.1" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" - uri="http://sample/nodes/TestNode1" + uri="http://sample/nodes/TestNode2" domainRegistry = "tribes://228.0.0.100:50000" domain="http://domain1"> diff --git a/sca-java-2.x/trunk/itest/scaclient-api/src/main/java/itest/HelloworldServiceImpl.java b/sca-java-2.x/trunk/itest/scaclient-api/src/main/java/itest/HelloworldServiceImpl.java index 4b9910bb21..5af221313e 100644 --- a/sca-java-2.x/trunk/itest/scaclient-api/src/main/java/itest/HelloworldServiceImpl.java +++ b/sca-java-2.x/trunk/itest/scaclient-api/src/main/java/itest/HelloworldServiceImpl.java @@ -21,15 +21,21 @@ package itest; import org.oasisopen.sca.annotation.EagerInit; import org.oasisopen.sca.annotation.Init; import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; @EagerInit @Scope("COMPOSITE") -public class HelloworldServiceImpl implements HelloworldService { +@Service({HelloworldService.class, RemoteHelloworldService.class}) +public class HelloworldServiceImpl implements HelloworldService, RemoteHelloworldService { public String sayHello(String name) { return "Hello " + name; } + public String sayHelloRemote(String name) { + return "Hello " + name; + } + @Init public void init() { System.out.println(sayHello("world")); diff --git a/sca-java-2.x/trunk/itest/scaclient-api/src/main/java/itest/RemoteHelloworldService.java b/sca-java-2.x/trunk/itest/scaclient-api/src/main/java/itest/RemoteHelloworldService.java new file mode 100644 index 0000000000..a8640bf484 --- /dev/null +++ b/sca-java-2.x/trunk/itest/scaclient-api/src/main/java/itest/RemoteHelloworldService.java @@ -0,0 +1,28 @@ +/* + * 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 itest; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface RemoteHelloworldService { + + String sayHelloRemote(String name); + +} diff --git a/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java b/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java index 891581ea36..ccd25ea8cd 100644 --- a/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java +++ b/sca-java-2.x/trunk/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java @@ -20,6 +20,7 @@ package test.scaclient; import itest.HelloworldService; +import itest.RemoteHelloworldService; import java.net.URI; @@ -27,7 +28,6 @@ import junit.framework.TestCase; import org.apache.tuscany.sca.node.Node; import org.apache.tuscany.sca.node.NodeFactory; -import org.junit.Ignore; import org.junit.Test; import org.oasisopen.sca.client.SCAClientFactory; @@ -46,8 +46,13 @@ public class SCAClientTestCase extends TestCase { node = NodeFactory.getInstance().createNode((String)null, new String[] {"target/classes"}); node.start(); - HelloworldService service = SCAClientFactory.newInstance(URI.create("default")).getService(HelloworldService.class, "HelloworldComponent"); + SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("default")); + HelloworldService service = clientFactory.getService(HelloworldService.class, "HelloworldComponent/HelloworldService"); assertEquals("Hello petra", service.sayHello("petra")); + + RemoteHelloworldService remoteService = clientFactory.getService(RemoteHelloworldService.class, "HelloworldComponent/RemoteHelloworldService"); + assertEquals("Hello petra", remoteService.sayHelloRemote("petra")); + } @Test @@ -55,7 +60,12 @@ public class SCAClientTestCase extends TestCase { node = NodeFactory.getInstance().createNode(URI.create("myFooDomain"), new String[] {"target/classes"}); node.start(); - HelloworldService service = SCAClientFactory.newInstance(URI.create("myFooDomain")).getService(HelloworldService.class, "HelloworldComponent"); + SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("myFooDomain")); + HelloworldService service = clientFactory.getService(HelloworldService.class, "HelloworldComponent/HelloworldService"); + assertEquals("Hello petra", service.sayHello("petra")); + + RemoteHelloworldService remoteService = clientFactory.getService(RemoteHelloworldService.class, "HelloworldComponent/RemoteHelloworldService"); + assertEquals("Hello petra", remoteService.sayHelloRemote("petra")); assertEquals("Hello petra", service.sayHello("petra")); } diff --git a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/AbstractProviderConsumerTestCase.java b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/AbstractProviderConsumerTestCase.java index 19c100483c..77c2562c0f 100644 --- a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/AbstractProviderConsumerTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/AbstractProviderConsumerTestCase.java @@ -45,11 +45,9 @@ public abstract class AbstractProviderConsumerTestCase { protected static void destroyTestEnvironment() throws Exception { if (scaConsumerNode != null) { scaConsumerNode.stop(); - scaConsumerNode.destroy(); } if (scaProviderNode != null) { scaProviderNode.stop(); - scaProviderNode.destroy(); } } } diff --git a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java index da7683d84a..9c0ad5a26a 100644 --- a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java +++ b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java @@ -99,11 +99,9 @@ public class AtomFeedNonCollectionTest { public static void destroy() throws Exception { if (scaConsumerNode != null) { scaConsumerNode.stop(); - scaConsumerNode.destroy(); } if (scaProviderNode != null) { scaProviderNode.stop(); - scaProviderNode.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.java b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.java index e93c1aeea6..e6fa67883a 100644 --- a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.java +++ b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.java @@ -39,6 +39,5 @@ public class Consumer { testService.testCustomerCollection(); node.stop(); - node.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ContentNegotiationTest.java b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ContentNegotiationTest.java index b707c71d2b..32b2a286b8 100644 --- a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ContentNegotiationTest.java +++ b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ContentNegotiationTest.java @@ -85,7 +85,6 @@ public class ContentNegotiationTest { //System.out.println(">>>ContentNegotiationTest.destroy");
if (scaProviderNode != null) {
scaProviderNode.stop();
- scaProviderNode.destroy();
}
}
diff --git a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java index 2870002c66..6d4a173d30 100644 --- a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java @@ -90,7 +90,6 @@ public class MediaCollectionTestCase { System.out.println(">>>MediaCollectionTestCase.destroy"); if (scaProviderNode != null) { scaProviderNode.stop(); - scaProviderNode.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.java b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.java index f802d3891f..e2759235b0 100644 --- a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.java +++ b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.java @@ -45,6 +45,5 @@ public class Provider { } node.stop(); - node.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderEntryEntityTagsTestCase.java b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderEntryEntityTagsTestCase.java index 534c2c901f..6dbb15f6b9 100644 --- a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderEntryEntityTagsTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderEntryEntityTagsTestCase.java @@ -81,7 +81,6 @@ public class ProviderEntryEntityTagsTestCase { //System.out.println(">>>ProviderEntryEntityTagsTestCase.destroy"); if (scaProviderNode != null) { scaProviderNode.stop(); - scaProviderNode.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderFeedEntityTagsTestCase.java b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderFeedEntityTagsTestCase.java index b091045b8c..34131f6195 100644 --- a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderFeedEntityTagsTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderFeedEntityTagsTestCase.java @@ -87,7 +87,6 @@ public class ProviderFeedEntityTagsTestCase { //System.out.println(">>>ProviderFeedEntityTagsTestCase.destroy"); if (scaProviderNode != null) { scaProviderNode.stop(); - scaProviderNode.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java index 98e4e0ee48..45d4c94768 100644 --- a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java @@ -60,7 +60,6 @@ public class AggregatorTestCase { public static void destroy() throws Exception { if(node != null) { node.stop(); - node.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/news/NewsServiceTestCase.java b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/news/NewsServiceTestCase.java index 5b9e0848a0..b19f477912 100644 --- a/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/news/NewsServiceTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-atom-runtime/src/test/java/org/apache/tuscany/sca/binding/atom/news/NewsServiceTestCase.java @@ -54,7 +54,6 @@ public class NewsServiceTestCase { public static void destroy() throws Exception { if(node != null) { node.stop(); - node.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java b/sca-java-2.x/trunk/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java index 87616330dc..e002e6ccb8 100644 --- a/sca-java-2.x/trunk/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java @@ -59,7 +59,6 @@ public class EJBReferenceTestCase extends TestCase { @Override protected void tearDown() throws Exception { node.stop(); - node.destroy(); } public void testCalculator() throws Exception { diff --git a/sca-java-2.x/trunk/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java b/sca-java-2.x/trunk/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java index 41cf245735..eed7975bc6 100644 --- a/sca-java-2.x/trunk/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java @@ -75,7 +75,6 @@ public class HTTPBindingCacheTestCase { @AfterClass public static void tearDown() throws Exception { node.stop(); - node.destroy(); } /** diff --git a/sca-java-2.x/trunk/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java b/sca-java-2.x/trunk/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java index b5850b7670..f314bed909 100644 --- a/sca-java-2.x/trunk/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java @@ -88,7 +88,6 @@ public class HTTPBindingTestCase { @AfterClass public static void tearDown() throws Exception { node.stop(); - node.destroy(); } /** diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java index 96dea057e8..b84df66f40 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java @@ -60,7 +60,6 @@ public class JSONRPCDataTypeTestCase { @AfterClass public static void tearDown() throws Exception { node.stop(); - node.destroy(); } @Test diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java index 635c99a462..56080058c8 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java @@ -61,7 +61,6 @@ public class JSONRPCExceptionTestCase{ @AfterClass public static void tearDown() throws Exception { node.stop(); - node.destroy(); } @Test diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTestCase.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTestCase.java index 0fb748b0d9..efdb0a23db 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTestCase.java @@ -50,7 +50,6 @@ public class JSONRPCReferenceTestCase { @AfterClass public static void tearDown() throws Exception { nodeServer.stop(); - nodeServer.destroy(); } @Test @@ -66,7 +65,6 @@ public class JSONRPCReferenceTestCase { Assert.assertEquals("echo: ABC", result); if (node != null) { node.stop(); - node.destroy(); } } } diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java index 502b2c2862..946cd60745 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java @@ -61,7 +61,6 @@ public class JSONRPCServiceTestCase{ @AfterClass public static void tearDown() throws Exception { node.stop(); - node.destroy(); } @Test diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java index 6a13a7d951..a1b076c0e8 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java @@ -61,7 +61,6 @@ public class JSONRPCSmdTestCase { @AfterClass public static void tearDown() throws Exception { node.stop(); - node.destroy(); } @Test diff --git a/sca-java-2.x/trunk/modules/binding-rmi-runtime/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java b/sca-java-2.x/trunk/modules/binding-rmi-runtime/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java index c62e3a6b8b..c3cd710f1d 100644 --- a/sca-java-2.x/trunk/modules/binding-rmi-runtime/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-rmi-runtime/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java @@ -75,7 +75,6 @@ public class BindingTestCase { @AfterClass public static void destroy() throws Exception { node.stop(); - node.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HelloWorldTestCase.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HelloWorldTestCase.java index 4a560dea87..a482477d3b 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HelloWorldTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/HelloWorldTestCase.java @@ -46,7 +46,6 @@ public class HelloWorldTestCase extends TestCase { @Override protected void tearDown() throws Exception { node.stop(); - node.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingTestCase.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingTestCase.java index 4882da594f..b55779fa25 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingTestCase.java @@ -46,7 +46,6 @@ public class WSDLBindingTestCase extends TestCase { @Override protected void tearDown() throws Exception { node.stop(); - node.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingURITestCase.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingURITestCase.java index 806a6b6fba..54f25694e1 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingURITestCase.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingURITestCase.java @@ -46,7 +46,6 @@ public class WSDLBindingURITestCase extends TestCase { @Override protected void tearDown() throws Exception { node.stop(); - node.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingWSATestCase.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingWSATestCase.java index 3e8ee0c486..addcf67ac0 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingWSATestCase.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLBindingWSATestCase.java @@ -46,7 +46,6 @@ public class WSDLBindingWSATestCase extends TestCase { @Override protected void tearDown() throws Exception { node.stop(); - node.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/core-spi/pom.xml b/sca-java-2.x/trunk/modules/core-spi/pom.xml index 3d456b89f1..08cb196fa6 100644 --- a/sca-java-2.x/trunk/modules/core-spi/pom.xml +++ b/sca-java-2.x/trunk/modules/core-spi/pom.xml @@ -85,7 +85,7 @@ <configuration> <buildNumberPropertyName>sources.version</buildNumberPropertyName> <timestampPropertyName>build.timestamp</timestampPropertyName> - <doCheck>true</doCheck> + <doCheck>false</doCheck> <doUpdate>true</doUpdate> <revisionOnScmFailure>00000</revisionOnScmFailure> </configuration> diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java index 8cea5e1423..d45631d576 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseEndpointRegistry.java @@ -199,7 +199,7 @@ public abstract class BaseEndpointRegistry implements EndpointRegistry, LifeCycl listeners.remove(listener); } - public String getDomainName() { + public String getDomainURI() { return domainURI; } diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/CompositeActivator.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/CompositeActivator.java index f4e18f60cc..d9bdc2b6f6 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/CompositeActivator.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/CompositeActivator.java @@ -42,14 +42,6 @@ public interface CompositeActivator { * @param component * @param ref */ - void start(CompositeContext compositeContext, RuntimeComponent component, RuntimeComponentReference ref); - - /** - * Activate a component reference - * @param compositeContext The context of the Node - * @param component - * @param ref - */ void activate(CompositeContext compositeContext, RuntimeComponent component, RuntimeComponentReference ref); /** @@ -59,7 +51,7 @@ public interface CompositeActivator { * @param ref */ void activate(CompositeContext compositeContext, RuntimeComponent component, RuntimeComponentService service); - + /** * De-activate a component reference * @param component @@ -81,6 +73,15 @@ public interface CompositeActivator { void deactivate(Composite composite) throws ActivationException; /** + * Start a component reference + * @param compositeContext The context of the Node + * @param component + * @param ref + */ + void start(CompositeContext compositeContext, RuntimeComponent component, RuntimeComponentReference ref); + + + /** * Start a component * @param component */ @@ -104,4 +105,55 @@ public interface CompositeActivator { */ void stop(CompositeContext compositeContext, Composite composite) throws ActivationException; + /** + * Activate an endpoint + * @param compositeContext + * @param endpoint + */ + void activate(CompositeContext compositeContext, RuntimeEndpoint endpoint); + + /** + * Activate an endpoint reference + * @param compositeContext + * @param endpointReference + */ + void activate(CompositeContext compositeContext, RuntimeEndpointReference endpointReference); + + /** + * Deactivate an endpoint + * @param endpoint + */ + void deactivate(RuntimeEndpoint endpoint); + + /** + * Deactivate an endpoint reference + * @param endpointReference + */ + void deactivate(RuntimeEndpointReference endpointReference); + + /** + * Start an endpoint + * @param compositeContext + * @param endpoint + */ + void start(CompositeContext compositeContext, RuntimeEndpoint endpoint); + + /** + * Start an endpoint reference + * @param compositeContext + * @param endpointReference + */ + void start(CompositeContext compositeContext, RuntimeEndpointReference endpointReference); + + /** + * Stop an endpoint + * @param endpoint + */ + void stop(RuntimeEndpoint endpoint); + + /** + * Stop an endpoint reference + * @param endpointReference + */ + void stop(RuntimeEndpointReference endpointReference); } diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistryFactory.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistryFactory.java index bd97a525c0..c79fab1f47 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistryFactory.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistryFactory.java @@ -22,7 +22,8 @@ package org.apache.tuscany.sca.runtime; import java.util.Collection; /** - * + * A DomainRegistryFactory is responsible for creating an instance of the DomainRegistry for a given + * registry URI and domain URI */ public interface DomainRegistryFactory { /** @@ -33,13 +34,28 @@ public interface DomainRegistryFactory { * @return */ EndpointRegistry getEndpointRegistry(String endpointRegistryURI, String domainURI); - + /** * Return all active endpoint registries * @return */ Collection<EndpointRegistry> getEndpointRegistries(); + + /** + * Add an EndpointListener + * @param listener + */ void addListener(EndpointListener listener); + + /** + * Remove an EndpointListener + * @param listener + */ void removeListener(EndpointListener listener); + + /** + * Return an array of schemes that this factory supports + * @return + */ String[] getSupportedSchemes(); } diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistryFactoryExtensionPoint.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistryFactoryExtensionPoint.java index 4b823c0e7d..a373402db4 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistryFactoryExtensionPoint.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistryFactoryExtensionPoint.java @@ -22,12 +22,23 @@ package org.apache.tuscany.sca.runtime; import java.util.List; /** - * + * Extension point for DomainRegistryFactory */ public interface DomainRegistryFactoryExtensionPoint { + /** + * Add a DomainRegistryFactory + * @param factory + */ void addDomainRegistryFactory(DomainRegistryFactory factory); + /** + * Remove a DomainRegistryFactory + * @param factory + */ void removeDomainRegistryFactory(DomainRegistryFactory factory); + /** + * @return A list of DomainRegistryFactory + */ List<DomainRegistryFactory> getDomainRegistryFactories(); } diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/TuscanyURI.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistryURI.java index 2bb22ad634..74e5d431ca 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/TuscanyURI.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistryURI.java @@ -39,7 +39,7 @@ import java.util.Map; * remotes - a list of ipAddress:port for remote nodes
*
*/
-public class TuscanyURI {
+public class DomainRegistryURI {
private String domainName = "default";
private String bindAddress = null; // null means all network adapters
@@ -51,7 +51,7 @@ public class TuscanyURI { private List<String> remotes = new ArrayList<String>();
private String uri;
- public TuscanyURI(String uri) {
+ public DomainRegistryURI(String uri) {
this.uri = uri;
parseURI(uri);
}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java index 0c0c0f2b0e..43388c612a 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointRegistry.java @@ -66,5 +66,5 @@ public interface EndpointRegistry { void addListener(EndpointListener listener); void removeListener(EndpointListener listener); - String getDomainName(); + String getDomainURI(); } diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistry.java index 62ba7cce8d..7b96903dae 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistry.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ExtensibleDomainRegistry.java @@ -68,7 +68,7 @@ public class ExtensibleDomainRegistry implements DomainRegistryFactory { // See if there is a previously created registry for that domain for (DomainRegistryFactory factory : factories.getDomainRegistryFactories()) { for (EndpointRegistry endpointRegistry : factory.getEndpointRegistries()) { - if (endpointRegistry.getDomainName().equals(domainURI)) { + if (endpointRegistry.getDomainURI().equals(domainURI)) { return endpointRegistry; } } diff --git a/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/ConfigURITestCase.java b/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/ConfigURITestCase.java index 525cf80587..8ac2c3ceb8 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/ConfigURITestCase.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/test/java/org/apache/tuscany/sca/runtime/ConfigURITestCase.java @@ -23,7 +23,7 @@ import java.net.UnknownHostException; import junit.framework.Assert;
-import org.apache.tuscany.sca.runtime.TuscanyURI;
+import org.apache.tuscany.sca.runtime.DomainRegistryURI;
import org.junit.Test;
public class ConfigURITestCase {
@@ -31,7 +31,7 @@ public class ConfigURITestCase { @Test
public void testInvalidPrefix() throws UnknownHostException {
try {
- new TuscanyURI("foo");
+ new DomainRegistryURI("foo");
Assert.fail();
} catch (IllegalArgumentException e) {
// expected
@@ -40,14 +40,14 @@ public class ConfigURITestCase { @Test
public void testDomainName() throws UnknownHostException {
- TuscanyURI configURI = new TuscanyURI("tuscany:myDomain");
+ DomainRegistryURI configURI = new DomainRegistryURI("tuscany:myDomain");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertFalse(configURI.isMulticastDisabled());
}
@Test
public void testListenAddr() throws UnknownHostException {
- TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?listen=4321");
+ DomainRegistryURI configURI = new DomainRegistryURI("tuscany:myDomain?listen=4321");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertFalse(configURI.isMulticastDisabled());
Assert.assertEquals(4321, configURI.getListenPort());
@@ -55,7 +55,7 @@ public class ConfigURITestCase { }
@Test
public void testListenAddr2() throws UnknownHostException {
- TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?listen=1.1.1.1:4321");
+ DomainRegistryURI configURI = new DomainRegistryURI("tuscany:myDomain?listen=1.1.1.1:4321");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertFalse(configURI.isMulticastDisabled());
Assert.assertEquals(4321, configURI.getListenPort());
@@ -64,14 +64,14 @@ public class ConfigURITestCase { @Test
public void testMulticase1() throws UnknownHostException {
- TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?multicast=off");
+ DomainRegistryURI configURI = new DomainRegistryURI("tuscany:myDomain?multicast=off");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertTrue(configURI.isMulticastDisabled());
}
@Test
public void testMulticase2() throws UnknownHostException {
- TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?multicast=1.2.3.4:67");
+ DomainRegistryURI configURI = new DomainRegistryURI("tuscany:myDomain?multicast=1.2.3.4:67");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertFalse(configURI.isMulticastDisabled());
Assert.assertEquals("1.2.3.4", configURI.getMulticastAddress());
@@ -80,7 +80,7 @@ public class ConfigURITestCase { @Test
public void testMulticase3() throws UnknownHostException {
- TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?multicast=1.2.3.4");
+ DomainRegistryURI configURI = new DomainRegistryURI("tuscany:myDomain?multicast=1.2.3.4");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertFalse(configURI.isMulticastDisabled());
Assert.assertEquals("1.2.3.4", configURI.getMulticastAddress());
@@ -89,14 +89,14 @@ public class ConfigURITestCase { @Test
public void testPassword() {
- TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?password=bla");
+ DomainRegistryURI configURI = new DomainRegistryURI("tuscany:myDomain?password=bla");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertEquals("bla", configURI.getPassword());
}
@Test
public void testRemotes() throws UnknownHostException {
- TuscanyURI configURI = new TuscanyURI("tuscany:myDomain?remotes=1.1.1.1:23,2.2.2.2");
+ DomainRegistryURI configURI = new DomainRegistryURI("tuscany:myDomain?remotes=1.1.1.1:23,2.2.2.2");
Assert.assertEquals("myDomain", configURI.getDomainName());
Assert.assertTrue(configURI.isMulticastDisabled());
Assert.assertEquals(2, configURI.getRemotes().size());
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java index d9c6eec137..5d07bdad89 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java @@ -24,7 +24,6 @@ import java.security.PrivilegedAction; import java.util.logging.Level; import java.util.logging.Logger; -import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.ComponentService; @@ -35,7 +34,6 @@ import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.context.CompositeContext; import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.core.scope.ScopeContainer; import org.apache.tuscany.sca.core.scope.ScopeRegistry; @@ -50,7 +48,6 @@ import org.apache.tuscany.sca.provider.ReferenceBindingProvider; import org.apache.tuscany.sca.provider.ServiceBindingProvider; import org.apache.tuscany.sca.runtime.ActivationException; import org.apache.tuscany.sca.runtime.CompositeActivator; -import org.apache.tuscany.sca.runtime.EndpointRegistry; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -63,14 +60,11 @@ import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; public class CompositeActivatorImpl implements CompositeActivator { final Logger logger = Logger.getLogger(CompositeActivatorImpl.class.getName()); - private final AssemblyFactory assemblyFactory; private final ScopeRegistry scopeRegistry; private final ProviderFactoryExtensionPoint providerFactories; public CompositeActivatorImpl(ExtensionPointRegistry extensionPoints) { UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - FactoryExtensionPoint factories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); - this.assemblyFactory = factories.getFactory(AssemblyFactory.class); this.scopeRegistry = utilities.getUtility(ScopeRegistry.class); this.providerFactories = extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class); } @@ -235,7 +229,7 @@ public class CompositeActivatorImpl implements CompositeActivator { // Add a wire for each service Endpoint for ( Endpoint endpoint : service.getEndpoints()){ RuntimeEndpoint ep = (RuntimeEndpoint) endpoint; - ep.bind(compositeContext); + activate(compositeContext, ep); // create the interface contract for the binding and service ends of the wire // that are created as forward only contracts @@ -248,17 +242,25 @@ public class CompositeActivatorImpl implements CompositeActivator { } } + public void activate(CompositeContext compositeContext, RuntimeEndpoint ep) { + ep.bind(compositeContext); + } + public void deactivate(RuntimeComponent component, RuntimeComponentService service) { if (logger.isLoggable(Level.FINE)) { logger.fine("Deactivating component service: " + component.getURI() + "#" + service.getName()); } for(Endpoint ep: service.getEndpoints()) { if(ep instanceof RuntimeEndpoint) { - ((RuntimeEndpoint) ep).unbind(); + deactivate((RuntimeEndpoint) ep); } } } + public void deactivate(RuntimeEndpoint ep) { + ep.unbind(); + } + // Reference activation/deactivation public void activate(CompositeContext compositeContext, RuntimeComponent component, RuntimeComponentReference reference) { @@ -271,7 +273,7 @@ public class CompositeActivatorImpl implements CompositeActivator { // asks the component context to start the reference which creates the wires reference.setComponent(component); for(EndpointReference epr: reference.getEndpointReferences()) { - addReferenceWire(compositeContext, epr); + activate(compositeContext, (RuntimeEndpointReference) epr); } // TODO reference wires are added at component start for some reason @@ -282,10 +284,14 @@ public class CompositeActivatorImpl implements CompositeActivator { logger.fine("Deactivating component reference: " + component.getURI() + "#" + reference.getName()); } for(EndpointReference endpointReference: reference.getEndpointReferences()) { - ((RuntimeEndpointReference) endpointReference).unbind(); + deactivate((RuntimeEndpointReference)endpointReference); } } + public void deactivate(RuntimeEndpointReference endpointReference) { + endpointReference.unbind(); + } + //========================================================================= // Start //========================================================================= @@ -351,23 +357,7 @@ public class CompositeActivatorImpl implements CompositeActivator { } for (Endpoint endpoint : service.getEndpoints()) { RuntimeEndpoint ep = (RuntimeEndpoint) endpoint; - // FIXME: Should the policy providers be started before the endpoint is started? - for (PolicyProvider policyProvider : ep.getPolicyProviders()) { - policyProvider.start(); - } - - final ServiceBindingProvider bindingProvider = ep.getBindingProvider(); - if (bindingProvider != null) { - // bindingProvider.start(); - // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy. - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { - bindingProvider.start(); - return null; - } - }); - compositeContext.getEndpointRegistry().addEndpoint(endpoint); - } + start(compositeContext, ep); } } @@ -375,6 +365,26 @@ public class CompositeActivatorImpl implements CompositeActivator { runtimeComponent.setStarted(true); } + public void start(CompositeContext compositeContext, RuntimeEndpoint ep) { + // FIXME: Should the policy providers be started before the endpoint is started? + for (PolicyProvider policyProvider : ep.getPolicyProviders()) { + policyProvider.start(); + } + + final ServiceBindingProvider bindingProvider = ep.getBindingProvider(); + if (bindingProvider != null) { + // bindingProvider.start(); + // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy. + AccessController.doPrivileged(new PrivilegedAction<Object>() { + public Object run() { + bindingProvider.start(); + return null; + } + }); + compositeContext.getEndpointRegistry().addEndpoint(ep); + } + } + public void stop(CompositeContext compositeContext, Component component) { if (!((RuntimeComponent)component).isStarted()) { return; @@ -388,20 +398,7 @@ public class CompositeActivatorImpl implements CompositeActivator { } for (Endpoint endpoint : service.getEndpoints()) { RuntimeEndpoint ep = (RuntimeEndpoint) endpoint; - compositeContext.getEndpointRegistry().removeEndpoint(endpoint); - final ServiceBindingProvider bindingProvider = ep.getBindingProvider(); - if (bindingProvider != null) { - // Allow bindings to read properties. Requires PropertyPermission read in security policy. - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { - bindingProvider.stop(); - return null; - } - }); - } - for (PolicyProvider policyProvider : ep.getPolicyProviders()) { - policyProvider.stop(); - } + stop(ep); } } for (ComponentReference reference : component.getReferences()) { @@ -411,21 +408,7 @@ public class CompositeActivatorImpl implements CompositeActivator { for (EndpointReference endpointReference : reference.getEndpointReferences()) { RuntimeEndpointReference epr = (RuntimeEndpointReference) endpointReference; - compositeContext.getEndpointRegistry().removeEndpointReference(endpointReference); - final ReferenceBindingProvider bindingProvider = epr.getBindingProvider(); - if (bindingProvider != null) { - // Allow bindings to read properties. Requires PropertyPermission read in security policy. - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { - bindingProvider.stop(); - return null; - } - }); - } - for (PolicyProvider policyProvider : epr.getPolicyProviders()) { - policyProvider.stop(); - } - + stop(epr); } } Implementation implementation = component.getImplementation(); @@ -458,6 +441,23 @@ public class CompositeActivatorImpl implements CompositeActivator { ((RuntimeComponent)component).setStarted(false); } + public void stop(RuntimeEndpoint ep) { + ep.getCompositeContext().getEndpointRegistry().removeEndpoint(ep); + final ServiceBindingProvider bindingProvider = ep.getBindingProvider(); + if (bindingProvider != null) { + // Allow bindings to read properties. Requires PropertyPermission read in security policy. + AccessController.doPrivileged(new PrivilegedAction<Object>() { + public Object run() { + bindingProvider.stop(); + return null; + } + }); + } + for (PolicyProvider policyProvider : ep.getPolicyProviders()) { + policyProvider.stop(); + } + } + // Scope container start/stop // separate off from component start that all endpoints are // registered before any @EagerInit takes place @@ -490,40 +490,49 @@ public class CompositeActivatorImpl implements CompositeActivator { // is first used (when the chains are created) for (EndpointReference endpointReference : componentReference.getEndpointReferences()){ // addReferenceWire(compositeContext, endpointReference); - compositeContext.getEndpointRegistry().addEndpointReference(endpointReference); + start(compositeContext, (RuntimeEndpointReference) endpointReference); } } } + public void start(CompositeContext compositeContext, RuntimeEndpointReference endpointReference) { + compositeContext.getEndpointRegistry().addEndpointReference(endpointReference); + } + public void stop(Component component, ComponentReference reference) { if (logger.isLoggable(Level.FINE)) { logger.fine("Stopping component reference: " + component.getURI() + "#" + reference.getName()); } RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference); - RuntimeComponent runtimeComponent = (RuntimeComponent) component; - EndpointRegistry endpointRegistry = runtimeComponent.getComponentContext().getCompositeContext().getEndpointRegistry(); for ( EndpointReference endpointReference : runtimeRef.getEndpointReferences()){ RuntimeEndpointReference epr = (RuntimeEndpointReference) endpointReference; - endpointRegistry.removeEndpointReference(endpointReference); - ReferenceBindingProvider bindingProvider = epr.getBindingProvider(); - if (bindingProvider != null) { - bindingProvider.stop(); - } - for (PolicyProvider policyProvider : epr.getPolicyProviders()) { - policyProvider.stop(); - } + stop(epr); + } + } + + public void stop(RuntimeEndpointReference epr) { + CompositeContext compositeContext = epr.getCompositeContext(); + if (compositeContext == null) { + throw new IllegalStateException("The endpoint reference is not bound"); + } + compositeContext.getEndpointRegistry().removeEndpointReference(epr); + ReferenceBindingProvider bindingProvider = epr.getBindingProvider(); + if (bindingProvider != null) { + bindingProvider.stop(); + } + for (PolicyProvider policyProvider : epr.getPolicyProviders()) { + policyProvider.stop(); } } - private void addReferenceWire(CompositeContext compositeContext, EndpointReference endpointReference) { - RuntimeEndpointReference epr = (RuntimeEndpointReference) endpointReference; + public void activate(CompositeContext compositeContext, RuntimeEndpointReference epr) { // create the wire // null endpoint passed in here as the endpoint reference may // not be resolved yet epr.bind(compositeContext); - ComponentReference reference = endpointReference.getReference(); + ComponentReference reference = epr.getReference(); InterfaceContract sourceContract = epr.getComponentTypeReferenceInterfaceContract(); // TODO - EPR - interface contract seems to be null in the implementation.web @@ -531,7 +540,7 @@ public class CompositeActivatorImpl implements CompositeActivator { if (sourceContract == null){ // TODO - Can't do this with move of matching to wire // take the contract from the service to which the reference is connected - sourceContract = ((RuntimeEndpoint) endpointReference.getTargetEndpoint()).getComponentTypeServiceInterfaceContract(); + sourceContract = ((RuntimeEndpoint) epr.getTargetEndpoint()).getComponentTypeServiceInterfaceContract(); reference.setInterfaceContract(sourceContract); } diff --git a/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java index ce1224fcbc..8bf237c993 100644 --- a/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java @@ -336,7 +336,7 @@ public class OverlayEndpointRegistry implements EndpointRegistry, LifeCycleListe // TODO Auto-generated method stub return null; } - public String getDomainName() { + public String getDomainURI() { return domainURI; } } diff --git a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java index 40a7a6de65..d921ec3a48 100644 --- a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java @@ -32,7 +32,7 @@ import org.apache.tuscany.sca.core.LifeCycleListener; import org.apache.tuscany.sca.runtime.BaseEndpointRegistry;
import org.apache.tuscany.sca.runtime.EndpointRegistry;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.TuscanyURI;
+import org.apache.tuscany.sca.runtime.DomainRegistryURI;
import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
@@ -54,7 +54,7 @@ import com.hazelcast.nio.Address; public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements EndpointRegistry, LifeCycleListener, EntryListener<String, Endpoint>, MembershipListener {
private final static Logger logger = Logger.getLogger(HazelcastEndpointRegistry.class.getName());
- protected TuscanyURI configURI;
+ protected DomainRegistryURI configURI;
private HazelcastInstance hazelcastInstance;
protected Map<Object, Object> map;
@@ -65,7 +65,7 @@ public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements E String domainRegistryURI,
String domainURI) {
super(registry, attributes, domainRegistryURI, domainURI);
- this.configURI = new TuscanyURI(domainRegistryURI);
+ this.configURI = new DomainRegistryURI(domainRegistryURI);
}
public void start() {
diff --git a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java index 5f46615001..e581fa22d1 100644 --- a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java @@ -51,7 +51,7 @@ import org.apache.tuscany.sca.endpoint.tribes.MapStore.MapListener; import org.apache.tuscany.sca.runtime.BaseEndpointRegistry; import org.apache.tuscany.sca.runtime.EndpointRegistry; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; -import org.apache.tuscany.sca.runtime.TuscanyURI; +import org.apache.tuscany.sca.runtime.DomainRegistryURI; /** * A replicated EndpointRegistry based on Apache Tomcat Tribes @@ -148,7 +148,7 @@ public class ReplicatedEndpointRegistry extends BaseEndpointRegistry implements } private void setTuscanyConfig(Map<String, String> map, String domainRegistryURI) { - TuscanyURI tuscanyURI = new TuscanyURI(domainRegistryURI); + DomainRegistryURI tuscanyURI = new DomainRegistryURI(domainRegistryURI); map.put("address", tuscanyURI.getMulticastAddress()); map.put("port", Integer.toString(tuscanyURI.getMulticastPort())); map.put("bind", tuscanyURI.getBindAddress()); diff --git a/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java b/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java index 0c2e648f1f..9923b1e0f7 100644 --- a/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java @@ -305,7 +305,7 @@ public class DistributedRegistry extends AbstractDistributedMap<Endpoint> implem return endpoints; } - public String getDomainName() { + public String getDomainURI() { return domainURI; } diff --git a/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/Node.java b/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/Node.java index 0c1633b9d9..b02919fb8f 100644 --- a/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/Node.java +++ b/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/Node.java @@ -46,10 +46,5 @@ public interface Node extends Client { */ void stop(); - /** - * Destroy the node. - */ - void destroy(); - - public List<String> getServiceNames(); + List<String> getServiceNames(); } diff --git a/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeMain2.java b/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeMain2.java index 6ffdde2634..c42bacdd00 100644 --- a/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeMain2.java +++ b/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeMain2.java @@ -51,6 +51,5 @@ public class NodeMain2 { } node.stop(); - node.destroy(); } } diff --git a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java index 7b8e20c2c1..9741abeeee 100644 --- a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java +++ b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java @@ -163,7 +163,6 @@ public class NodeFactoryImpl extends NodeFactory { if (inited) { for (Node node : nodes.values()) { node.stop(); - node.destroy(); } nodes.clear(); deployer.stop(); diff --git a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index 6e90b5ef5f..f6d86231fc 100644 --- a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -102,9 +102,6 @@ public class NodeImpl implements Node, Client { return getConfiguration().getURI(); } - public void destroy() { - } - public Node start() { logger.log(Level.INFO, "Starting node: " + configuration.getURI() + " domain: " + configuration.getDomainName()); diff --git a/sca-java-2.x/trunk/samples/calculator-equinox/src/test/java/calculator/CalculatorTestCase.java b/sca-java-2.x/trunk/samples/calculator-equinox/src/test/java/calculator/CalculatorTestCase.java index b49e1da130..f6a682920c 100644 --- a/sca-java-2.x/trunk/samples/calculator-equinox/src/test/java/calculator/CalculatorTestCase.java +++ b/sca-java-2.x/trunk/samples/calculator-equinox/src/test/java/calculator/CalculatorTestCase.java @@ -52,7 +52,6 @@ public class CalculatorTestCase { public static void tearDownAfterClass() throws Exception { if (node != null) { node.stop(); - node.destroy(); } if (launcher != null) { launcher.destroy(); diff --git a/sca-java-2.x/trunk/samples/calculator-osgi/src/test/java/calculator/CalculatorTestCase.java b/sca-java-2.x/trunk/samples/calculator-osgi/src/test/java/calculator/CalculatorTestCase.java index 9d9b0a9ffb..d6a3ccb24e 100644 --- a/sca-java-2.x/trunk/samples/calculator-osgi/src/test/java/calculator/CalculatorTestCase.java +++ b/sca-java-2.x/trunk/samples/calculator-osgi/src/test/java/calculator/CalculatorTestCase.java @@ -45,7 +45,6 @@ public class CalculatorTestCase { public static void tearDownAfterClass() throws Exception { if (node != null) { node.stop(); - node.destroy(); } } diff --git a/sca-java-2.x/trunk/samples/implementation-java-calculator/src/test/java/calculator/CalculatorTestCase.java b/sca-java-2.x/trunk/samples/implementation-java-calculator/src/test/java/calculator/CalculatorTestCase.java index 461c970373..5e76d5f84b 100644 --- a/sca-java-2.x/trunk/samples/implementation-java-calculator/src/test/java/calculator/CalculatorTestCase.java +++ b/sca-java-2.x/trunk/samples/implementation-java-calculator/src/test/java/calculator/CalculatorTestCase.java @@ -59,7 +59,6 @@ public class CalculatorTestCase { public static void tearDownAfterClass() throws Exception { if (node != null) { node.stop(); - node.destroy(); } if (launcher != null) { launcher.destroy(); diff --git a/sca-java-2.x/trunk/samples/store/src/main/java/launch/Launch.java b/sca-java-2.x/trunk/samples/store/src/main/java/launch/Launch.java index 06981d17eb..8e4b5839e4 100644 --- a/sca-java-2.x/trunk/samples/store/src/main/java/launch/Launch.java +++ b/sca-java-2.x/trunk/samples/store/src/main/java/launch/Launch.java @@ -34,7 +34,6 @@ public class Launch { System.in.read(); System.out.println("Stopping ..."); node.stop(); - node.destroy(); System.out.println(); } } |