You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2016/03/11 20:43:40 UTC
[41/50] [abbrv] aries-rsa git commit: Switch project setup to Aries
Switch project setup to Aries
Project: http://git-wip-us.apache.org/repos/asf/aries-rsa/repo
Commit: http://git-wip-us.apache.org/repos/asf/aries-rsa/commit/d73a3a7f
Tree: http://git-wip-us.apache.org/repos/asf/aries-rsa/tree/d73a3a7f
Diff: http://git-wip-us.apache.org/repos/asf/aries-rsa/diff/d73a3a7f
Branch: refs/heads/master
Commit: d73a3a7f06dda3ceeae11910488a11bf84b52975
Parents: 9ed37be
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Fri Mar 11 17:33:34 2016 +0100
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Fri Mar 11 17:33:34 2016 +0100
----------------------------------------------------------------------
cxf-dosgi-ri-repository/pom.xml | 85 ---
discovery/distributed/cxf-discovery/pom.xml | 120 ----
.../dosgi/discovery/zookeeper/Activator.java | 43 --
.../discovery/zookeeper/ZooKeeperDiscovery.java | 164 ------
.../zookeeper/publish/DiscoveryPlugin.java | 54 --
.../publish/PublishingEndpointListener.java | 216 -------
.../PublishingEndpointListenerFactory.java | 105 ----
.../subscribe/EndpointListenerTracker.java | 56 --
.../zookeeper/subscribe/InterfaceMonitor.java | 262 ---------
.../subscribe/InterfaceMonitorManager.java | 218 -------
.../dosgi/discovery/zookeeper/util/Utils.java | 165 ------
.../zookeeper/DiscoveryDriverTest.java | 135 -----
.../FindInZooKeeperCustomizerTest.java | 301 ----------
.../InterfaceDataMonitorListenerImplTest.java | 183 ------
.../PublishingEndpointListenerFactoryTest.java | 100 ----
.../publish/PublishingEndpointListenerTest.java | 201 -------
.../subscribe/InterfaceMonitorManagerTest.java | 139 -----
.../subscribe/InterfaceMonitorTest.java | 67 ---
.../discovery/zookeeper/util/UtilsTest.java | 110 ----
discovery/distributed/pom.xml | 42 --
.../distributed/zookeeper-server-config/pom.xml | 78 ---
.../zookeeper/server/config/Activator.java | 110 ----
discovery/distributed/zookeeper-server/pom.xml | 114 ----
.../discovery/zookeeper/server/Activator.java | 44 --
.../dosgi/discovery/zookeeper/server/Utils.java | 108 ----
.../zookeeper/server/ZookeeperStarter.java | 164 ------
.../resources/OSGI-INF/metatype/zookeeper.xml | 34 --
.../zookeeper/server/ZookeeperStarterTest.java | 81 ---
discovery/local/bnd.bnd | 1 +
discovery/local/pom.xml | 50 +-
discovery/pom.xml | 19 +-
discovery/zookeeper-server-config/bnd.bnd | 1 +
discovery/zookeeper-server-config/pom.xml | 40 ++
.../zookeeper/server/config/Activator.java | 110 ++++
discovery/zookeeper-server/bnd.bnd | 1 +
discovery/zookeeper-server/pom.xml | 84 +++
.../discovery/zookeeper/server/Activator.java | 44 ++
.../dosgi/discovery/zookeeper/server/Utils.java | 108 ++++
.../zookeeper/server/ZookeeperStarter.java | 164 ++++++
.../resources/OSGI-INF/metatype/zookeeper.xml | 34 ++
.../zookeeper/server/ZookeeperStarterTest.java | 81 +++
discovery/zookeeper/bnd.bnd | 1 +
discovery/zookeeper/pom.xml | 77 +++
.../dosgi/discovery/zookeeper/Activator.java | 43 ++
.../discovery/zookeeper/ZooKeeperDiscovery.java | 164 ++++++
.../zookeeper/publish/DiscoveryPlugin.java | 54 ++
.../publish/PublishingEndpointListener.java | 216 +++++++
.../PublishingEndpointListenerFactory.java | 105 ++++
.../subscribe/EndpointListenerTracker.java | 56 ++
.../zookeeper/subscribe/InterfaceMonitor.java | 262 +++++++++
.../subscribe/InterfaceMonitorManager.java | 218 +++++++
.../dosgi/discovery/zookeeper/util/Utils.java | 165 ++++++
.../zookeeper/DiscoveryDriverTest.java | 135 +++++
.../FindInZooKeeperCustomizerTest.java | 301 ++++++++++
.../InterfaceDataMonitorListenerImplTest.java | 183 ++++++
.../PublishingEndpointListenerFactoryTest.java | 100 ++++
.../publish/PublishingEndpointListenerTest.java | 201 +++++++
.../subscribe/InterfaceMonitorManagerTest.java | 139 +++++
.../subscribe/InterfaceMonitorTest.java | 67 +++
.../discovery/zookeeper/util/UtilsTest.java | 110 ++++
distribution/features/pom.xml | 90 ---
.../features/src/main/resources/features.xml | 59 --
distribution/multi-bundle/pom.xml | 124 ----
.../main/appended-resources/META-INF/LICENSE.vm | 39 --
.../src/main/appended-resources/META-INF/NOTICE | 42 --
.../multi-bundle/src/main/assembly/assembly.xml | 54 --
.../multi-bundle/src/main/release/README | 63 --
.../src/main/release/release_notes.txt | 295 ----------
.../src/main/xsl/equinox_distro_config.xslt | 17 -
.../src/main/xsl/felix_distro_config.xslt | 75 ---
.../src/main/xsl/filter_features.xslt | 18 -
distribution/pom.xml | 45 --
distribution/sources/pom.xml | 66 ---
distribution/sources/src/main/assembly/src.xml | 68 ---
distribution/sources/src/main/release/LICENSE | 262 ---------
distribution/sources/src/main/release/NOTICE | 9 -
distribution/sources/src/main/release/README | 57 --
.../sources/src/main/release/release_notes.txt | 295 ----------
distribution/subsystem/pom.xml | 393 -------------
.../src/main/assembly/subsystem-assembly.xml | 46 --
.../src/main/resources/OSGI-INF/SUBSYSTEM.MF | 51 --
dsw/cxf-dosgi-provider-api/pom.xml | 67 ---
.../cxf/dosgi/dsw/api/DistributionProvider.java | 56 --
.../org/apache/cxf/dosgi/dsw/api/Endpoint.java | 27 -
.../cxf/dosgi/dsw/api/EndpointHelper.java | 41 --
.../apache/cxf/dosgi/dsw/api/ExportPolicy.java | 46 --
.../dsw/api/IntentUnsatisfiedException.java | 35 --
dsw/cxf-dosgi-rsa/pom.xml | 73 ---
.../apache/cxf/dosgi/dsw/service/Activator.java | 37 --
.../dosgi/dsw/service/ClientServiceFactory.java | 110 ----
.../service/DistributionProviderTracker.java | 73 ---
.../cxf/dosgi/dsw/service/EventAdminHelper.java | 151 -----
.../cxf/dosgi/dsw/service/EventProducer.java | 114 ----
.../dosgi/dsw/service/ExportReferenceImpl.java | 77 ---
.../dsw/service/ExportRegistrationImpl.java | 152 -----
.../dsw/service/ImportRegistrationImpl.java | 230 --------
.../cxf/dosgi/dsw/service/PackageUtil.java | 85 ---
.../dsw/service/RemoteServiceAdminCore.java | 587 -------------------
.../dsw/service/RemoteServiceAdminInstance.java | 99 ----
.../dsw/service/RemoteServiceadminFactory.java | 51 --
.../cxf/dosgi/dsw/service/StringPlus.java | 72 ---
.../dsw/service/ClientServiceFactoryTest.java | 92 ---
.../DistributionProviderTrackerTest.java | 82 ---
.../dosgi/dsw/service/EventProducerTest.java | 189 ------
.../dsw/service/ImportRegistrationImplTest.java | 178 ------
.../dsw/service/RemoteServiceAdminCoreTest.java | 517 ----------------
.../cxf/dosgi/dsw/service/StringPlusTest.java | 63 --
dsw/cxf-dosgi-tcp/pom.xml | 72 ---
.../aries/rsa/provider/tcp/Activator.java | 45 --
.../provider/tcp/LoaderObjectInputStream.java | 43 --
.../aries/rsa/provider/tcp/LocalHostUtil.java | 92 ---
.../aries/rsa/provider/tcp/TCPProvider.java | 67 ---
.../aries/rsa/provider/tcp/TCPServer.java | 118 ----
.../aries/rsa/provider/tcp/TcpEndpoint.java | 58 --
.../rsa/provider/tcp/TcpInvocationHandler.java | 68 ---
.../aries/rsa/provider/tcp/TcpProviderTest.java | 107 ----
.../rsa/provider/tcp/myservice/MyService.java | 30 -
.../provider/tcp/myservice/MyServiceImpl.java | 36 --
dsw/cxf-dsw/pom.xml | 155 -----
.../org/apache/cxf/dosgi/dsw/Activator.java | 160 -----
.../org/apache/cxf/dosgi/dsw/Constants.java | 146 -----
.../dosgi/dsw/decorator/DecorationParser.java | 85 ---
.../cxf/dosgi/dsw/decorator/InterfaceRule.java | 96 ---
.../apache/cxf/dosgi/dsw/decorator/Rule.java | 41 --
.../dosgi/dsw/decorator/ServiceDecorator.java | 28 -
.../ServiceDecoratorBundleListener.java | 48 --
.../dsw/decorator/ServiceDecoratorImpl.java | 97 ---
.../AbstractPojoConfigurationTypeHandler.java | 243 --------
.../dsw/handlers/CXFDistributionProvider.java | 178 ------
.../cxf/dosgi/dsw/handlers/ClassUtils.java | 142 -----
.../dosgi/dsw/handlers/HttpServiceManager.java | 176 ------
.../JaxRSPojoConfigurationTypeHandler.java | 201 -------
.../cxf/dosgi/dsw/handlers/JaxRSUtils.java | 121 ----
.../cxf/dosgi/dsw/handlers/LocalHostUtil.java | 92 ---
.../handlers/PojoConfigurationTypeHandler.java | 172 ------
.../handlers/SecurityDelegatingHttpContext.java | 133 -----
.../cxf/dosgi/dsw/handlers/ServerWrapper.java | 49 --
.../dsw/handlers/ServiceInvocationHandler.java | 100 ----
.../handlers/WsdlConfigurationTypeHandler.java | 160 -----
.../dosgi/dsw/qos/DefaultIntentMapFactory.java | 52 --
.../apache/cxf/dosgi/dsw/qos/IntentManager.java | 31 -
.../cxf/dosgi/dsw/qos/IntentManagerImpl.java | 155 -----
.../org/apache/cxf/dosgi/dsw/qos/IntentMap.java | 62 --
.../apache/cxf/dosgi/dsw/qos/IntentTracker.java | 62 --
.../apache/cxf/dosgi/dsw/qos/IntentUtils.java | 86 ---
.../apache/cxf/dosgi/dsw/util/OsgiUtils.java | 132 -----
.../apache/cxf/dosgi/dsw/util/StringPlus.java | 72 ---
.../src/main/resources/service-decoration.xsd | 67 ---
.../org/apache/cxf/dosgi/dsw/ActivatorTest.java | 66 ---
.../org/apache/cxf/dosgi/dsw/TestUtils.java | 37 --
.../dsw/decorator/DecorationParserTest.java | 63 --
.../dosgi/dsw/decorator/InterfaceRuleTest.java | 163 -----
.../ServiceDecoratorBundleListenerTest.java | 69 ---
.../dsw/decorator/ServiceDecoratorImplTest.java | 187 ------
.../handlers/CXFDistributionProviderTest.java | 104 ----
.../cxf/dosgi/dsw/handlers/ClassUtilsTest.java | 134 -----
.../dsw/handlers/HttpServiceManagerTest.java | 125 ----
.../cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java | 195 ------
.../PojoConfigurationTypeHandlerTest.java | 422 -------------
.../SecurityDelegatingHttpContextTest.java | 267 ---------
.../handlers/ServiceInvocationHandlerTest.java | 75 ---
.../WsdlConfigurationTypeHandlerTest.java | 67 ---
.../dsw/handlers/jaxws/MyJaxWsEchoService.java | 26 -
.../handlers/jaxws/MyJaxWsEchoServiceImpl.java | 27 -
.../handlers/simple/MySimpleEchoService.java | 23 -
.../simple/MySimpleEchoServiceImpl.java | 27 -
.../dsw/hooks/CxfFindListenerHookTest.java | 341 -----------
.../cxf/dosgi/dsw/hooks/CxfPublishHookTest.java | 299 ----------
.../dosgi/dsw/hooks/ServiceHookUtilsTest.java | 116 ----
.../apache/cxf/dosgi/dsw/hooks/TestService.java | 22 -
.../dosgi/dsw/qos/IntentManagerImplTest.java | 278 ---------
.../apache/cxf/dosgi/dsw/qos/IntentMapTest.java | 41 --
.../cxf/dosgi/dsw/qos/IntentTrackerTest.java | 80 ---
.../cxf/dosgi/dsw/qos/IntentUtilsTest.java | 70 ---
.../cxf/dosgi/dsw/util/OsgiUtilsTest.java | 152 -----
.../org/apache/cxf/dosgi/dsw/util/Provider.java | 23 -
.../remote-service/alt-remote-services.xml | 32 -
.../OSGI-INF/remote-service/multi-services.xml | 38 --
.../OSGI-INF/remote-service/remote-services.xml | 32 -
.../src/test/resources/test-resources/rs1.xml | 31 -
.../src/test/resources/test-resources/rs2.xml | 28 -
.../src/test/resources/test-resources/sd-1.xml | 3 -
.../src/test/resources/test-resources/sd.xml | 8 -
.../src/test/resources/test-resources/sd0.xml | 2 -
.../src/test/resources/test-resources/sd1.xml | 8 -
.../src/test/resources/test-resources/sd2.xml | 14 -
dsw/cxf-topology-manager/pom.xml | 111 ----
.../cxf/dosgi/topologymanager/Activator.java | 192 ------
.../exporter/DefaultExportPolicy.java | 37 --
.../exporter/EndpointListenerNotifier.java | 133 -----
.../exporter/EndpointRepository.java | 140 -----
.../topologymanager/exporter/StringPlus.java | 57 --
.../exporter/TopologyManagerExport.java | 195 ------
.../importer/EndpointListenerManager.java | 98 ----
.../topologymanager/importer/FilterHelper.java | 43 --
.../importer/ListenerHookImpl.java | 119 ----
.../topologymanager/importer/RSATracker.java | 26 -
.../importer/ReferenceCounter.java | 76 ---
.../importer/ServiceInterestListener.java | 26 -
.../importer/TopologyManagerImport.java | 345 -----------
.../dosgi/topologymanager/ActivatorTest.java | 68 ---
.../exporter/EndpointListenerNotifierTest.java | 160 -----
.../exporter/EndpointRepositoryTest.java | 82 ---
.../exporter/TopologyManagerExportTest.java | 153 -----
.../importer/EndpointListenerImplTest.java | 111 ----
.../importer/ListenerHookImplTest.java | 89 ---
.../importer/ReferenceCounterTest.java | 42 --
.../importer/TopologyManagerImportTest.java | 87 ---
dsw/pom.xml | 46 --
features/pom.xml | 82 +++
features/src/main/resources/features.xml | 31 +
felix/pom.xml | 42 --
felix/profiles/pom.xml | 201 -------
.../remote-service/alt-remote-services.xml | 32 -
.../OSGI-INF/remote-service/multi-services.xml | 38 --
.../OSGI-INF/remote-service/remote-services.xml | 32 -
felix/profiles/resources/test-resources/rs1.xml | 31 -
felix/profiles/resources/test-resources/rs2.xml | 28 -
.../profiles/resources/test-resources/sd-1.xml | 3 -
felix/profiles/resources/test-resources/sd.xml | 8 -
felix/profiles/resources/test-resources/sd0.xml | 2 -
felix/profiles/resources/test-resources/sd1.xml | 8 -
felix/profiles/resources/test-resources/sd2.xml | 14 -
.../src/main/java/felix/EmptyClass.java | 22 -
.../src/main/resources/client_bundles.txt | 82 ---
.../src/main/resources/dosgi_bundles.txt | 78 ---
.../src/main/resources/server_bundles.txt | 82 ---
felix/remote-debug.txt | 1 -
felix/shell.tui/LICENSE | 202 -------
felix/shell.tui/NOTICE | 20 -
felix/shell.tui/pom.xml | 92 ---
.../org/apache/felix/shell/tui/Activator.java | 187 ------
osgi-api/pom.xml | 70 ---
parent/pom.xml | 336 +++--------
pom.xml | 118 ++--
provider/pom.xml | 43 ++
provider/tcp/bnd.bnd | 1 +
provider/tcp/pom.xml | 28 +
.../aries/rsa/provider/tcp/Activator.java | 45 ++
.../provider/tcp/LoaderObjectInputStream.java | 43 ++
.../aries/rsa/provider/tcp/LocalHostUtil.java | 92 +++
.../aries/rsa/provider/tcp/TCPProvider.java | 67 +++
.../aries/rsa/provider/tcp/TCPServer.java | 118 ++++
.../aries/rsa/provider/tcp/TcpEndpoint.java | 58 ++
.../rsa/provider/tcp/TcpInvocationHandler.java | 68 +++
.../aries/rsa/provider/tcp/TcpProviderTest.java | 107 ++++
.../rsa/provider/tcp/myservice/MyService.java | 30 +
.../provider/tcp/myservice/MyServiceImpl.java | 36 ++
repository/pom.xml | 83 +++
rsa-api/bnd.bnd | 6 +
rsa-api/pom.xml | 40 ++
rsa/bnd.bnd | 5 +
rsa/pom.xml | 27 +
.../apache/cxf/dosgi/dsw/service/Activator.java | 37 ++
.../dosgi/dsw/service/ClientServiceFactory.java | 110 ++++
.../service/DistributionProviderTracker.java | 73 +++
.../cxf/dosgi/dsw/service/EventAdminHelper.java | 151 +++++
.../cxf/dosgi/dsw/service/EventProducer.java | 114 ++++
.../dosgi/dsw/service/ExportReferenceImpl.java | 77 +++
.../dsw/service/ExportRegistrationImpl.java | 152 +++++
.../dsw/service/ImportRegistrationImpl.java | 230 ++++++++
.../cxf/dosgi/dsw/service/PackageUtil.java | 85 +++
.../dsw/service/RemoteServiceAdminCore.java | 587 +++++++++++++++++++
.../dsw/service/RemoteServiceAdminInstance.java | 99 ++++
.../dsw/service/RemoteServiceadminFactory.java | 51 ++
.../cxf/dosgi/dsw/service/StringPlus.java | 72 +++
.../dsw/service/ClientServiceFactoryTest.java | 92 +++
.../DistributionProviderTrackerTest.java | 82 +++
.../dosgi/dsw/service/EventProducerTest.java | 189 ++++++
.../dsw/service/ImportRegistrationImplTest.java | 178 ++++++
.../dsw/service/RemoteServiceAdminCoreTest.java | 517 ++++++++++++++++
.../cxf/dosgi/dsw/service/StringPlusTest.java | 63 ++
samples/discovery/client/pom.xml | 66 ---
.../samples/discovery/consumer/Activator.java | 86 ---
samples/discovery/impl/pom.xml | 61 --
.../dosgi/samples/discovery/impl/Activator.java | 71 ---
.../discovery/impl/DisplayServiceImpl.java | 40 --
samples/discovery/interface/pom.xml | 52 --
.../dosgi/samples/discovery/DisplayService.java | 24 -
samples/discovery/pom.xml | 42 --
samples/ds/client/pom.xml | 63 --
.../dosgi/samples/ds/consumer/Activator.java | 45 --
.../samples/ds/consumer/AdderConsumer.java | 39 --
.../src/main/resources/OSGI-INF/component.xml | 20 -
.../OSGI-INF/remote-service/remote-services.xml | 26 -
samples/ds/impl/pom.xml | 60 --
.../dosgi/samples/ds/impl/AdderServiceImpl.java | 30 -
.../src/main/resources/OSGI-INF/component.xml | 26 -
samples/ds/interface/pom.xml | 52 --
.../cxf/dosgi/samples/ds/AdderService.java | 23 -
samples/ds/pom.xml | 41 --
samples/greeter/client/pom.xml | 77 ---
.../dosgi/samples/greeter/client/Activator.java | 106 ----
.../samples/greeter/client/GreeterDataImpl.java | 46 --
.../samples/greeter/client/GreeterDialog.java | 208 -------
.../OSGI-INF/cxf/intents/intent-map.xml | 75 ---
.../OSGI-INF/remote-service/remote-services.xml | 27 -
samples/greeter/impl/pom.xml | 76 ---
.../dosgi/samples/greeter/impl/Activator.java | 47 --
.../greeter/impl/GreeterServiceImpl.java | 59 --
samples/greeter/interface/pom.xml | 72 ---
.../cxf/dosgi/samples/greeter/GreeterData.java | 25 -
.../dosgi/samples/greeter/GreeterException.java | 45 --
.../dosgi/samples/greeter/GreeterService.java | 27 -
.../dosgi/samples/greeter/GreetingPhrase.java | 50 --
samples/greeter/pom.xml | 42 --
samples/greeter_rest/client/pom.xml | 76 ---
.../samples/greeter/client/rest/Activator.java | 126 ----
.../OSGI-INF/remote-service/remote-services.xml | 31 -
samples/greeter_rest/impl/pom.xml | 77 ---
.../samples/greeter/impl/rest/Activator.java | 59 --
.../greeter/impl/rest/GreeterServiceImpl.java | 49 --
.../greeter/impl/rest/GreeterServiceImpl2.java | 33 --
samples/greeter_rest/impl2/pom.xml | 77 ---
.../samples/greeter/impl2/rest/Activator.java | 53 --
.../greeter/impl2/rest/GreeterServiceImpl2.java | 49 --
samples/greeter_rest/interface/pom.xml | 81 ---
.../samples/greeter/rest/GreeterException.java | 45 --
.../dosgi/samples/greeter/rest/GreeterInfo.java | 37 --
.../samples/greeter/rest/GreeterService.java | 31 -
.../samples/greeter/rest/GreeterService2.java | 24 -
.../samples/greeter/rest/GreetingPhrase.java | 64 --
.../cxf/jaxrs/GreeterService2-model.xml | 7 -
samples/greeter_rest/pom.xml | 43 --
samples/pom.xml | 45 --
samples/security_filter/pom.xml | 73 ---
.../cxf/dosgi/samples/security/Activator.java | 65 --
.../samples/security/SampleSecurityFilter.java | 61 --
.../samples/security/SecureRestEndpoint.java | 35 --
samples/spring_dm/client/pom.xml | 60 --
.../springdm/client/DinnerServiceConsumer.java | 38 --
.../resources/META-INF/spring/client-spring.xml | 31 -
.../OSGI-INF/remote-service/remote-services.xml | 29 -
samples/spring_dm/impl/pom.xml | 60 --
.../springdm/impl/DinnerServiceImpl.java | 39 --
.../main/resources/META-INF/spring/spring.xml | 32 -
samples/spring_dm/interface/pom.xml | 52 --
.../dosgi/samples/springdm/DinnerService.java | 25 -
.../cxf/dosgi/samples/springdm/Restaurant.java | 59 --
samples/spring_dm/pom.xml | 41 --
spi/pom.xml | 67 +++
.../cxf/dosgi/dsw/api/DistributionProvider.java | 56 ++
.../org/apache/cxf/dosgi/dsw/api/Endpoint.java | 27 +
.../cxf/dosgi/dsw/api/EndpointHelper.java | 41 ++
.../apache/cxf/dosgi/dsw/api/ExportPolicy.java | 46 ++
.../dsw/api/IntentUnsatisfiedException.java | 35 ++
systests2/common/pom.xml | 108 ----
.../systests2/common/test1/GreeterDataImpl.java | 39 --
.../systests2/common/test1/MyActivator.java | 45 --
.../common/test1/MyServiceTracker.java | 76 ---
.../common/test1/StartServiceTracker.java | 41 --
.../systests2/common/test2/Test2Service.java | 23 -
.../common/test2/client/ClientActivator.java | 37 --
.../test2/client/Test2ServiceTracker.java | 70 ---
.../common/test2/server/ServerActivator.java | 53 --
.../common/test2/server/Test2ServiceImpl.java | 36 --
.../common/src/main/resources/rs-test1.xml | 28 -
systests2/multi-bundle/pom.xml | 243 --------
.../systests2/multi/AbstractDosgiTest.java | 176 ------
.../dosgi/systests2/multi/MultiBundleTools.java | 106 ----
.../dosgi/systests2/multi/TestCustomIntent.java | 109 ----
.../systests2/multi/TestDiscoveryExport.java | 109 ----
.../systests2/multi/TestExportRestService.java | 96 ---
.../systests2/multi/TestExportService.java | 137 -----
.../systests2/multi/TestImportService.java | 161 -----
.../AddGreetingPhraseInterceptor.java | 44 --
.../multi/customintent/CustomFeature.java | 33 --
.../customintent/CustomIntentActivator.java | 37 --
.../service/EmptyGreeterService.java | 41 --
...GreeterServiceWithCustomIntentActivator.java | 42 --
.../systests2/multi/rest/RestTranslate.java | 34 --
.../systests2/multi/rest/RestTranslateImpl.java | 41 --
.../multi/rest/TranslateActivator.java | 40 --
.../src/test/resources/log4j.properties | 13 -
systests2/pom.xml | 42 --
topology-manager/bnd.bnd | 1 +
topology-manager/pom.xml | 47 ++
.../cxf/dosgi/topologymanager/Activator.java | 192 ++++++
.../exporter/DefaultExportPolicy.java | 37 ++
.../exporter/EndpointListenerNotifier.java | 133 +++++
.../exporter/EndpointRepository.java | 140 +++++
.../topologymanager/exporter/StringPlus.java | 57 ++
.../exporter/TopologyManagerExport.java | 195 ++++++
.../importer/EndpointListenerManager.java | 98 ++++
.../topologymanager/importer/FilterHelper.java | 43 ++
.../importer/ListenerHookImpl.java | 119 ++++
.../topologymanager/importer/RSATracker.java | 26 +
.../importer/ReferenceCounter.java | 76 +++
.../importer/ServiceInterestListener.java | 26 +
.../importer/TopologyManagerImport.java | 345 +++++++++++
.../dosgi/topologymanager/ActivatorTest.java | 68 +++
.../exporter/EndpointListenerNotifierTest.java | 160 +++++
.../exporter/EndpointRepositoryTest.java | 82 +++
.../exporter/TopologyManagerExportTest.java | 153 +++++
.../importer/EndpointListenerImplTest.java | 111 ++++
.../importer/ListenerHookImplTest.java | 89 +++
.../importer/ReferenceCounterTest.java | 42 ++
.../importer/TopologyManagerImportTest.java | 87 +++
398 files changed, 10003 insertions(+), 26424 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/cxf-dosgi-ri-repository/pom.xml
----------------------------------------------------------------------
diff --git a/cxf-dosgi-ri-repository/pom.xml b/cxf-dosgi-ri-repository/pom.xml
deleted file mode 100644
index 7e12753..0000000
--- a/cxf-dosgi-ri-repository/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.cxf.dosgi</groupId>
- <artifactId>cxf-dosgi-ri-parent</artifactId>
- <version>1.8-SNAPSHOT</version>
- <relativePath>../../parent/pom.xml</relativePath>
- </parent>
- <artifactId>cxf-dosgi-ri-repository</artifactId>
- <packaging>pom</packaging>
- <properties>
- <bnd.version>3.1.0</bnd.version>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <local.index.policy>ALLOWED</local.index.policy>
- </properties>
- <profiles>
- <profile>
- <id>RunningInCI</id>
- <activation>
- <property>
- <name>running.in.ci</name>
- <value>true</value>
- </property>
- </activation>
- <properties>
- <local.url.policy>FORBIDDEN</local.url.policy>
- </properties>
- </profile>
- <profile>
- <id>apache-release</id>
- <properties>
- <local.url.policy>FORBIDDEN</local.url.policy>
- </properties>
- </profile>
- </profiles>
- <build>
- <plugins>
- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-indexer-maven-plugin</artifactId>
- <version>${bnd.version}</version>
- <configuration>
- <localURLs>${local.index.policy}</localURLs>
- <includeTransitive>true</includeTransitive>
- </configuration>
- <executions>
- <execution>
- <id>index</id>
- <goals>
- <goal>index</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.apache.cxf.dosgi</groupId>
- <artifactId>cxf-dosgi-ri-rsa</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.dosgi</groupId>
- <artifactId>cxf-dosgi-ri-tcp</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.dosgi</groupId>
- <artifactId>cxf-dosgi-ri-discovery-distributed</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.dosgi</groupId>
- <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.dosgi</groupId>
- <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-server-config</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/discovery/distributed/cxf-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/pom.xml b/discovery/distributed/cxf-discovery/pom.xml
deleted file mode 100644
index b34a1db..0000000
--- a/discovery/distributed/cxf-discovery/pom.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>cxf-dosgi-ri-discovery-distributed</artifactId>
- <packaging>bundle</packaging>
- <name>CXF DOSGi ZooKeeper-based Discovery Service Bundle</name>
- <description>An implementation of the Distributed OSGi Discovery Service using ZooKeeper</description>
-
- <parent>
- <groupId>org.apache.cxf.dosgi</groupId>
- <artifactId>cxf-dosgi-ri-parent</artifactId>
- <version>1.8-SNAPSHOT</version>
- <relativePath>../../../parent/pom.xml</relativePath>
- </parent>
-
- <properties>
- <topDirectoryLocation>../../..</topDirectoryLocation>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>${zookeeper.version}</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>com.sun.jdmk</groupId>
- <artifactId>jmxtools</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.sun.jmx</groupId>
- <artifactId>jmxri</artifactId>
- </exclusion>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- We need the newer log4j as the one from zookeeper has some ugly dependencies -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.cxf.dosgi</groupId>
- <artifactId>cxf-dosgi-ri-discovery-local</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Bundle-Activator>org.apache.cxf.dosgi.discovery.zookeeper.Activator</Bundle-Activator>
- <Export-Package>
- !*
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/Activator.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/Activator.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/Activator.java
deleted file mode 100644
index cbbea58..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/Activator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 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 org.apache.cxf.dosgi.discovery.zookeeper;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.service.cm.ManagedService;
-
-public class Activator implements BundleActivator {
-
- private ZooKeeperDiscovery zkd;
-
- public synchronized void start(BundleContext bc) throws Exception {
- zkd = new ZooKeeperDiscovery(bc);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put(Constants.SERVICE_PID, "org.apache.cxf.dosgi.discovery.zookeeper");
- bc.registerService(ManagedService.class.getName(), zkd, props);
- }
-
- public synchronized void stop(BundleContext bc) throws Exception {
- zkd.stop(true);
- }
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/ZooKeeperDiscovery.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/ZooKeeperDiscovery.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/ZooKeeperDiscovery.java
deleted file mode 100644
index 33e2da4..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/ZooKeeperDiscovery.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- * 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 org.apache.cxf.dosgi.discovery.zookeeper;
-
-import java.io.IOException;
-import java.util.Dictionary;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.publish.PublishingEndpointListenerFactory;
-import org.apache.cxf.dosgi.discovery.zookeeper.subscribe.EndpointListenerTracker;
-import org.apache.cxf.dosgi.discovery.zookeeper.subscribe.InterfaceMonitorManager;
-import org.apache.cxf.dosgi.discovery.zookeeper.util.Utils;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.cm.ConfigurationException;
-import org.osgi.service.cm.ManagedService;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.util.tracker.ServiceTracker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ZooKeeperDiscovery implements Watcher, ManagedService {
-
- public static final String DISCOVERY_ZOOKEEPER_ID = "org.apache.cxf.dosgi.discovery.zookeeper";
-
- private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperDiscovery.class);
-
- private final BundleContext bctx;
-
- private PublishingEndpointListenerFactory endpointListenerFactory;
- private ServiceTracker<EndpointListener, EndpointListener> endpointListenerTracker;
- private InterfaceMonitorManager imManager;
- private ZooKeeper zk;
- private boolean closed;
- private boolean started;
-
- private Dictionary<String, ?> curConfiguration;
-
- public ZooKeeperDiscovery(BundleContext bctx) {
- this.bctx = bctx;
- }
-
- private void setDefaults(Dictionary<String, String> configuration) {
- Utils.setDefault(configuration, "zookeeper.host", "localhost");
- Utils.setDefault(configuration, "zookeeper.port", "2181");
- Utils.setDefault(configuration, "zookeeper.timeout", "3000");
- }
-
- @SuppressWarnings("unchecked")
- public synchronized void updated(Dictionary<String, ?> configuration) throws ConfigurationException {
- LOG.debug("Received configuration update for Zookeeper Discovery: {}", configuration);
- if (configuration != null) {
- setDefaults((Dictionary<String, String>)configuration);
- }
- // make changes only if config actually changed, to prevent unnecessary ZooKeeper reconnections
- if (!Utils.toMap(configuration).equals(Utils.toMap(curConfiguration))) {
- stop(false);
- curConfiguration = configuration;
- // config is null if it doesn't exist, is being deleted or has not yet been loaded
- // in which case we just stop running
- if (configuration != null) {
- createZooKeeper(configuration);
- }
- }
- }
-
- private synchronized void start() {
- if (closed) {
- return;
- }
- if (started) {
- // we must be re-entrant, i.e. can be called when already started
- LOG.debug("ZookeeperDiscovery already started");
- return;
- }
- LOG.debug("starting ZookeeperDiscovery");
- endpointListenerFactory = new PublishingEndpointListenerFactory(zk, bctx);
- endpointListenerFactory.start();
- imManager = new InterfaceMonitorManager(bctx, zk);
- endpointListenerTracker = new EndpointListenerTracker(bctx, imManager);
- endpointListenerTracker.open();
- started = true;
- }
-
- public synchronized void stop(boolean close) {
- if (started) {
- LOG.debug("stopping ZookeeperDiscovery");
- }
- started = false;
- closed |= close;
- if (endpointListenerFactory != null) {
- endpointListenerFactory.stop();
- }
- if (endpointListenerTracker != null) {
- endpointListenerTracker.close();
- }
- if (imManager != null) {
- imManager.close();
- }
- if (zk != null) {
- try {
- zk.close();
- } catch (InterruptedException e) {
- LOG.error("Error closing ZooKeeper", e);
- }
- }
- }
-
- private synchronized void createZooKeeper(Dictionary<String, ?> configuration) {
- if (closed) {
- return;
- }
- String host = configuration.get("zookeeper.host").toString();
- String port = configuration.get("zookeeper.port").toString();
- int timeout = Integer.parseInt(configuration.get("zookeeper.timeout").toString());
- LOG.debug("ZooKeeper configuration: connecting to {}:{} with timeout {}",
- new Object[]{host, port, timeout});
- try {
- zk = new ZooKeeper(host + ":" + port, timeout, this);
- } catch (IOException e) {
- LOG.error("Failed to start the ZooKeeper Discovery component.", e);
- }
- }
-
- /* Callback for ZooKeeper */
- public void process(WatchedEvent event) {
- LOG.debug("got ZooKeeper event " + event);
- switch (event.getState()) {
- case SyncConnected:
- LOG.info("Connection to ZooKeeper established");
- // this event can be triggered more than once in a row (e.g. after Disconnected event),
- // so we must be re-entrant here
- start();
- break;
-
- case Expired:
- LOG.info("Connection to ZooKeeper expired. Trying to create a new connection");
- stop(false);
- createZooKeeper(curConfiguration);
- break;
-
- default:
- // ignore other events
- break;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/DiscoveryPlugin.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/DiscoveryPlugin.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/DiscoveryPlugin.java
deleted file mode 100644
index 5d46585..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/DiscoveryPlugin.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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 org.apache.cxf.dosgi.discovery.zookeeper.publish;
-
-import java.util.Map;
-
-/**
- * This interface allows transformation of service registration information before it is pushed into the ZooKeeper
- * discovery system.
- * It can be useful for situations where a host name or port number needs to be changed in cases where the host running
- * the service is known differently from the outside to what the local Java process thinks it is.
- * Extra service properties can also be added to the registration which can be useful to refine the remote service
- * lookup process. <p/>
- *
- * DiscoveryPlugins use the OSGi WhiteBoard pattern. To add one to the system, register an instance under this interface
- * with the OSGi Service Registry. All registered DiscoveryPlugin instances are visited and given a chance to
- * process the information before it is pushed into ZooKeeper. <p/>
- *
- * Note that the changes made using this plugin do not modify the local service registration.
- *
- */
-public interface DiscoveryPlugin {
-
- /**
- * Process service registration information. Plugins can change this information before it is published into the
- * ZooKeeper discovery system.
- *
- * @param mutableProperties A map of service registration properties. The map is mutable and any changes to the map
- * will be reflected in the ZooKeeper registration.
- * @param endpointKey The key under which the service is registered in ZooKeeper. This key typically has the
- * following format: hostname#port##context. While the actual value of this key is not actually used by the
- * system (people can use it as a hint to understand where the service is located), the value <i>must</i> be
- * unique for all services of a given type.
- * @return The <tt>endpointKey</tt> value to be used. If there is no need to change this simply return the value
- * of the <tt>endpointKey</tt> parameter.
- */
- String process(Map<String, Object> mutableProperties, String endpointKey);
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListener.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListener.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListener.java
deleted file mode 100644
index c703b9f..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListener.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
- * 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 org.apache.cxf.dosgi.discovery.zookeeper.publish;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.util.Utils;
-import org.apache.cxf.dosgi.endpointdesc.EndpointDescriptionParser;
-import org.apache.cxf.dosgi.endpointdesc.PropertiesMapper;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.KeeperException.NoNodeException;
-import org.apache.zookeeper.KeeperException.NodeExistsException;
-import org.apache.zookeeper.ZooDefs.Ids;
-import org.apache.zookeeper.ZooKeeper;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.xmlns.rsa.v1_0.EndpointDescriptionType;
-import org.osgi.xmlns.rsa.v1_0.PropertyType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Listens for local Endpoints and publishes them to ZooKeeper.
- */
-public class PublishingEndpointListener implements EndpointListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(PublishingEndpointListener.class);
-
- private final ZooKeeper zk;
- private final ServiceTracker<DiscoveryPlugin, DiscoveryPlugin> discoveryPluginTracker;
- private final List<EndpointDescription> endpoints = new ArrayList<EndpointDescription>();
- private boolean closed;
-
- private final EndpointDescriptionParser endpointDescriptionParser;
-
- public PublishingEndpointListener(ZooKeeper zk, BundleContext bctx) {
- this.zk = zk;
- discoveryPluginTracker = new ServiceTracker<DiscoveryPlugin, DiscoveryPlugin>(bctx,
- DiscoveryPlugin.class, null);
- discoveryPluginTracker.open();
- endpointDescriptionParser = new EndpointDescriptionParser();
- }
-
- public void endpointAdded(EndpointDescription endpoint, String matchedFilter) {
- LOG.info("Local EndpointDescription added: {}", endpoint);
-
- synchronized (endpoints) {
- if (closed) {
- return;
- }
- if (endpoints.contains(endpoint)) {
- // TODO -> Should the published endpoint be updated here?
- return;
- }
-
- try {
- addEndpoint(endpoint);
- endpoints.add(endpoint);
- } catch (Exception ex) {
- LOG.error("Exception while processing the addition of an endpoint.", ex);
- }
- }
- }
-
- private void addEndpoint(EndpointDescription endpoint) throws URISyntaxException, KeeperException,
- InterruptedException, IOException {
- Collection<String> interfaces = endpoint.getInterfaces();
- String endpointKey = getKey(endpoint.getId());
- Map<String, Object> props = new HashMap<String, Object>(endpoint.getProperties());
-
- // process plugins
- Object[] plugins = discoveryPluginTracker.getServices();
- if (plugins != null) {
- for (Object plugin : plugins) {
- if (plugin instanceof DiscoveryPlugin) {
- endpointKey = ((DiscoveryPlugin)plugin).process(props, endpointKey);
- }
- }
- }
-
- for (String name : interfaces) {
- String path = Utils.getZooKeeperPath(name);
- String fullPath = path + '/' + endpointKey;
- LOG.debug("Creating ZooKeeper node: {}", fullPath);
- ensurePath(path, zk);
- List<PropertyType> propsOut = new PropertiesMapper().fromProps(props);
- EndpointDescriptionType epd = new EndpointDescriptionType();
- epd.getProperty().addAll(propsOut);
- byte[] epData = endpointDescriptionParser.getData(epd);
- createEphemeralNode(fullPath, epData);
- }
- }
-
- private void createEphemeralNode(String fullPath, byte[] data) throws KeeperException, InterruptedException {
- try {
- zk.create(fullPath, data, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
- } catch (NodeExistsException nee) {
- // this sometimes happens after a ZooKeeper node dies and the ephemeral node
- // that belonged to the old session was not yet deleted. We need to make our
- // session the owner of the node so it won't get deleted automatically -
- // we do this by deleting and recreating it ourselves.
- LOG.info("node for endpoint already exists, recreating: {}", fullPath);
- try {
- zk.delete(fullPath, -1);
- } catch (NoNodeException nne) {
- // it's a race condition, but as long as it got deleted - it's ok
- }
- zk.create(fullPath, data, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
- }
- }
-
- public void endpointRemoved(EndpointDescription endpoint, String matchedFilter) {
- LOG.info("Local EndpointDescription removed: {}", endpoint);
-
- synchronized (endpoints) {
- if (closed) {
- return;
- }
- if (!endpoints.contains(endpoint)) {
- return;
- }
-
- try {
- removeEndpoint(endpoint);
- endpoints.remove(endpoint);
- } catch (Exception ex) {
- LOG.error("Exception while processing the removal of an endpoint", ex);
- }
- }
- }
-
- private void removeEndpoint(EndpointDescription endpoint) throws UnknownHostException, URISyntaxException {
- Collection<String> interfaces = endpoint.getInterfaces();
- String endpointKey = getKey(endpoint.getId());
-
- for (String name : interfaces) {
- String path = Utils.getZooKeeperPath(name);
- String fullPath = path + '/' + endpointKey;
- LOG.debug("Removing ZooKeeper node: {}", fullPath);
- try {
- zk.delete(fullPath, -1);
- } catch (Exception ex) {
- LOG.debug("Error while removing endpoint: {}", ex); // e.g. session expired
- }
- }
- }
-
- private static void ensurePath(String path, ZooKeeper zk) throws KeeperException, InterruptedException {
- StringBuilder current = new StringBuilder();
- String[] parts = Utils.removeEmpty(path.split("/"));
- for (String part : parts) {
- current.append('/');
- current.append(part);
- try {
- zk.create(current.toString(), new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
- } catch (NodeExistsException nee) {
- // it's not the first node with this path to ever exist - that's normal
- }
- }
- }
-
- static String getKey(String endpoint) throws URISyntaxException {
- URI uri = new URI(endpoint);
-
- StringBuilder sb = new StringBuilder();
- sb.append(uri.getHost());
- sb.append("#");
- sb.append(uri.getPort());
- sb.append("#");
- sb.append(uri.getPath().replace('/', '#'));
- return sb.toString();
- }
-
- public void close() {
- LOG.debug("closing - removing all endpoints");
- synchronized (endpoints) {
- closed = true;
- for (EndpointDescription endpoint : endpoints) {
- try {
- removeEndpoint(endpoint);
- } catch (Exception ex) {
- LOG.error("Exception while removing endpoint during close", ex);
- }
- }
- endpoints.clear();
- }
- discoveryPluginTracker.close();
- }
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactory.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactory.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactory.java
deleted file mode 100644
index c505bb4..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/publish/PublishingEndpointListenerFactory.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * 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 org.apache.cxf.dosgi.discovery.zookeeper.publish;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.ZooKeeperDiscovery;
-import org.apache.cxf.dosgi.discovery.zookeeper.util.Utils;
-import org.apache.zookeeper.ZooKeeper;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Creates local EndpointListeners that publish to ZooKeeper.
- */
-public class PublishingEndpointListenerFactory implements ServiceFactory<PublishingEndpointListener> {
-
- private static final Logger LOG = LoggerFactory.getLogger(PublishingEndpointListenerFactory.class);
-
- private final BundleContext bctx;
- private final ZooKeeper zk;
- private final List<PublishingEndpointListener> listeners = new ArrayList<PublishingEndpointListener>();
- private ServiceRegistration serviceRegistration;
-
- public PublishingEndpointListenerFactory(ZooKeeper zk, BundleContext bctx) {
- this.bctx = bctx;
- this.zk = zk;
- }
-
- public PublishingEndpointListener getService(Bundle b, ServiceRegistration<PublishingEndpointListener> sr) {
- LOG.debug("new EndpointListener from factory");
- synchronized (listeners) {
- PublishingEndpointListener pel = new PublishingEndpointListener(zk, bctx);
- listeners.add(pel);
- return pel;
- }
- }
-
- public void ungetService(Bundle b, ServiceRegistration<PublishingEndpointListener> sr,
- PublishingEndpointListener pel) {
- LOG.debug("remove EndpointListener");
- synchronized (listeners) {
- if (listeners.remove(pel)) {
- pel.close();
- }
- }
- }
-
- public synchronized void start() {
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put(EndpointListener.ENDPOINT_LISTENER_SCOPE,
- "(&(" + Constants.OBJECTCLASS + "=*)(" + RemoteConstants.ENDPOINT_FRAMEWORK_UUID
- + "=" + Utils.getUUID(bctx) + "))");
- props.put(ZooKeeperDiscovery.DISCOVERY_ZOOKEEPER_ID, "true");
- serviceRegistration = bctx.registerService(EndpointListener.class.getName(), this, props);
- }
-
- public synchronized void stop() {
- if (serviceRegistration != null) {
- serviceRegistration.unregister();
- serviceRegistration = null;
- }
- synchronized (listeners) {
- for (PublishingEndpointListener pel : listeners) {
- pel.close();
- }
- listeners.clear();
- }
- }
-
- /**
- * Only for the test case!
- */
- protected List<PublishingEndpointListener> getListeners() {
- synchronized (listeners) {
- return listeners;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/EndpointListenerTracker.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/EndpointListenerTracker.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/EndpointListenerTracker.java
deleted file mode 100644
index 4d0a25f..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/EndpointListenerTracker.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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 org.apache.cxf.dosgi.discovery.zookeeper.subscribe;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * Tracks interest in EndpointListeners. Delegates to InterfaceMonitorManager to manage
- * interest in the scopes of each EndpointListener.
- */
-public class EndpointListenerTracker extends ServiceTracker<EndpointListener, EndpointListener> {
- private final InterfaceMonitorManager imManager;
-
- public EndpointListenerTracker(BundleContext bctx, InterfaceMonitorManager imManager) {
- super(bctx, EndpointListener.class, null);
- this.imManager = imManager;
- }
-
- @Override
- public EndpointListener addingService(ServiceReference<EndpointListener> endpointListener) {
- imManager.addInterest(endpointListener);
- return null;
- }
-
- @Override
- public void modifiedService(ServiceReference<EndpointListener> endpointListener, EndpointListener service) {
- // called when an EndpointListener updates its service properties,
- // e.g. when its interest scope is expanded/reduced
- imManager.addInterest(endpointListener);
- }
-
- @Override
- public void removedService(ServiceReference<EndpointListener> endpointListener, EndpointListener service) {
- imManager.removeInterest(endpointListener);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitor.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitor.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitor.java
deleted file mode 100644
index 95277d3..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitor.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/**
- * 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 org.apache.cxf.dosgi.discovery.zookeeper.subscribe;
-
-import java.io.ByteArrayInputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.util.Utils;
-import org.apache.cxf.dosgi.endpointdesc.EndpointDescriptionParser;
-import org.apache.cxf.dosgi.endpointdesc.PropertiesMapper;
-import org.apache.zookeeper.AsyncCallback.StatCallback;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.KeeperException.Code;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.data.Stat;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.xmlns.rsa.v1_0.EndpointDescriptionType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Monitors ZooKeeper for changes in published endpoints.
- * <p>
- * Specifically, it monitors the node path associated with a given interface class,
- * whose data is a serialized version of an EndpointDescription, and notifies an
- * EndpointListener when changes are detected (which can then propagate the
- * notification to other EndpointListeners with a matching scope).
- * <p>
- * Note that the EndpointListener is used here as a decoupling interface for
- * convenience, and is not necessarily used according to its documented contract.
- */
-public class InterfaceMonitor implements Watcher, StatCallback {
-
- private static final Logger LOG = LoggerFactory.getLogger(InterfaceMonitor.class);
-
- private final String znode;
- private final ZooKeeper zk;
- private final EndpointListener endpointListener;
- private final boolean recursive;
- private volatile boolean closed;
-
- // This map reference changes, so don't synchronize on it
- private Map<String, EndpointDescription> nodes = new HashMap<String, EndpointDescription>();
-
- private EndpointDescriptionParser parser;
-
- public InterfaceMonitor(ZooKeeper zk, String objClass, EndpointListener endpointListener, String scope) {
- this.zk = zk;
- this.znode = Utils.getZooKeeperPath(objClass);
- this.recursive = objClass == null || objClass.isEmpty();
- this.endpointListener = endpointListener;
- this.parser = new EndpointDescriptionParser();
- LOG.debug("Creating new InterfaceMonitor {} for scope [{}] and objectClass [{}]",
- new Object[] {recursive ? "(recursive)" : "", scope, objClass});
- }
-
- /**
- * Returns all endpoints that are currently known to this monitor.
- *
- * @return all endpoints that are currently known to this monitor
- */
- public synchronized List<EndpointDescription> getEndpoints() {
- return new ArrayList<EndpointDescription>(nodes.values());
- }
-
- public void start() {
- watch();
- }
-
- private void watch() {
- LOG.debug("registering a ZooKeeper.exists({}) callback", znode);
- zk.exists(znode, this, this, null);
- }
-
- /**
- * Zookeeper Watcher interface callback.
- */
- public void process(WatchedEvent event) {
- LOG.debug("ZooKeeper watcher callback on node {} for event {}", znode, event);
- processDelta();
- }
-
- /**
- * Zookeeper StatCallback interface callback.
- */
- @SuppressWarnings("deprecation")
- public void processResult(int rc, String path, Object ctx, Stat stat) {
- LOG.debug("ZooKeeper callback on node: {} code: {}", znode, rc);
-
- switch (rc) {
- case Code.Ok:
- case Code.NoNode:
- processDelta();
- return;
-
- case Code.SessionExpired:
- case Code.NoAuth:
- case Code.ConnectionLoss:
- return;
-
- default:
- watch();
- }
- }
-
- private void processDelta() {
- if (closed) {
- return;
- }
-
- if (zk.getState() != ZooKeeper.States.CONNECTED) {
- LOG.debug("ZooKeeper connection was already closed! Not processing changed event.");
- return;
- }
-
- try {
- if (zk.exists(znode, false) != null) {
- zk.getChildren(znode, this);
- refreshNodes();
- } else {
- LOG.debug("znode {} doesn't exist -> not processing any changes", znode);
- }
- } catch (Exception e) {
- if (zk.getState() != ZooKeeper.States.CONNECTED) {
- LOG.debug("Error getting Zookeeper data: " + e); // e.g. session expired, handled by ZooKeeperDiscovery
- } else {
- LOG.error("Error getting ZooKeeper data.", e);
- }
- }
- }
-
- public synchronized void close() {
- closed = true;
- for (EndpointDescription endpoint : nodes.values()) {
- endpointListener.endpointRemoved(endpoint, null);
- }
- nodes.clear();
- }
-
- private synchronized void refreshNodes() {
- if (closed) {
- return;
- }
- LOG.info("Processing change on node: {}", znode);
-
- Map<String, EndpointDescription> newNodes = new HashMap<String, EndpointDescription>();
- Map<String, EndpointDescription> prevNodes = new HashMap<String, EndpointDescription>(nodes);
- processChildren(znode, newNodes, prevNodes);
-
- // whatever is left in prevNodes now has been removed from Discovery
- LOG.debug("processChildren done. Nodes that are missing now and need to be removed: {}", prevNodes.values());
- for (EndpointDescription endpoint : prevNodes.values()) {
- endpointListener.endpointRemoved(endpoint, null);
- }
- nodes = newNodes;
- }
-
- /**
- * Iterates through all child nodes of the given node and tries to find
- * endpoints. If the recursive flag is set it also traverses into the child
- * nodes.
- *
- * @return true if an endpoint was found and if the node therefore needs to
- * be monitored for changes
- */
- private boolean processChildren(String zn, Map<String, EndpointDescription> newNodes,
- Map<String, EndpointDescription> prevNodes) {
- List<String> children;
- try {
- LOG.debug("Processing the children of {}", zn);
- children = zk.getChildren(zn, false);
-
- boolean foundANode = false;
- for (String child : children) {
- String childZNode = zn + '/' + child;
- EndpointDescription endpoint = getEndpointDescriptionFromNode(childZNode);
- if (endpoint != null) {
- EndpointDescription prevEndpoint = prevNodes.get(child);
- LOG.info("found new node " + zn + "/[" + child + "] ( []->child ) props: "
- + endpoint.getProperties().values());
- newNodes.put(child, endpoint);
- prevNodes.remove(child);
- foundANode = true;
- LOG.debug("Properties: {}", endpoint.getProperties());
- if (prevEndpoint == null) {
- // This guy is new
- endpointListener.endpointAdded(endpoint, null);
- } else if (!prevEndpoint.getProperties().equals(endpoint.getProperties())) {
- // TODO
- }
- }
- if (recursive && processChildren(childZNode, newNodes, prevNodes)) {
- zk.getChildren(childZNode, this);
- }
- }
-
- return foundANode;
- } catch (KeeperException e) {
- LOG.error("Problem processing ZooKeeper node", e);
- } catch (InterruptedException e) {
- LOG.error("Problem processing ZooKeeper node", e);
- }
- return false;
- }
-
- /**
- * Retrieves data from the given node and parses it into an EndpointDescription.
- *
- * @param node a node path
- * @return endpoint found in the node or null if no endpoint was found
- */
- private EndpointDescription getEndpointDescriptionFromNode(String node) {
- try {
- Stat stat = zk.exists(node, false);
- if (stat == null || stat.getDataLength() <= 0) {
- return null;
- }
- byte[] data = zk.getData(node, false, null);
- LOG.debug("Got data for node: {}", node);
-
- EndpointDescription endpoint = getFirstEnpointDescription(data);
- if (endpoint != null) {
- return endpoint;
- }
- LOG.warn("No Discovery information found for node: {}", node);
- } catch (Exception e) {
- LOG.error("Problem getting EndpointDescription from node " + node, e);
- }
- return null;
- }
-
- public EndpointDescription getFirstEnpointDescription(byte[] data) {
- List<EndpointDescriptionType> elements = parser.getEndpointDescriptions(new ByteArrayInputStream(data));
- if (elements.isEmpty()) {
- return null;
- }
- Map<String, Object> props = new PropertiesMapper().toProps(elements.get(0).getProperty());
- return new EndpointDescription(props);
- }
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManager.java
----------------------------------------------------------------------
diff --git a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManager.java b/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManager.java
deleted file mode 100644
index 240e5ea..0000000
--- a/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/subscribe/InterfaceMonitorManager.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- * 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 org.apache.cxf.dosgi.discovery.zookeeper.subscribe;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.cxf.dosgi.discovery.zookeeper.ZooKeeperDiscovery;
-import org.apache.cxf.dosgi.discovery.zookeeper.util.Utils;
-import org.apache.zookeeper.ZooKeeper;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.cxf.dosgi.discovery.local.util.Utils.matchFilter;
-
-/**
- * Manages the EndpointListeners and the scopes they are interested in.
- * For each scope with interested EndpointListeners an InterfaceMonitor is created.
- * The InterfaceMonitor calls back when it detects added or removed external Endpoints.
- * These events are then forwarded to all interested EndpointListeners.
- */
-public class InterfaceMonitorManager {
-
- private static final Logger LOG = LoggerFactory.getLogger(InterfaceMonitorManager.class);
-
- private final BundleContext bctx;
- private final ZooKeeper zk;
- // map of EndpointListeners and the scopes they are interested in
- private final Map<ServiceReference<EndpointListener>, List<String>> endpointListenerScopes =
- new HashMap<ServiceReference<EndpointListener>, List<String>>();
- // map of scopes and their interest data
- private final Map<String, Interest> interests = new HashMap<String, Interest>();
-
- protected static class Interest {
- List<ServiceReference<EndpointListener>> endpointListeners =
- new CopyOnWriteArrayList<ServiceReference<EndpointListener>>();
- InterfaceMonitor monitor;
- }
-
- public InterfaceMonitorManager(BundleContext bctx, ZooKeeper zk) {
- this.bctx = bctx;
- this.zk = zk;
- }
-
- public void addInterest(ServiceReference<EndpointListener> endpointListener) {
- if (isOurOwnEndpointListener(endpointListener)) {
- LOG.debug("Skipping our own EndpointListener");
- return;
- }
-
- LOG.info("updating EndpointListener interests: {}", endpointListener);
- if (LOG.isDebugEnabled()) {
- LOG.debug("updated EndpointListener properties: {}", Utils.getProperties(endpointListener));
- }
- for (String scope : Utils.getScopes(endpointListener)) {
- String objClass = Utils.getObjectClass(scope);
- LOG.debug("Adding interest in scope {}, objectClass {}", scope, objClass);
- addInterest(endpointListener, scope, objClass);
- }
- }
-
- private static boolean isOurOwnEndpointListener(ServiceReference<EndpointListener> endpointListener) {
- return Boolean.parseBoolean(String.valueOf(
- endpointListener.getProperty(ZooKeeperDiscovery.DISCOVERY_ZOOKEEPER_ID)));
- }
-
- @SuppressWarnings("unchecked")
- public synchronized void addInterest(ServiceReference<EndpointListener> endpointListener,
- String scope, String objClass) {
- // get or create interest for given scope and add listener to it
- Interest interest = interests.get(scope);
- if (interest == null) {
- // create interest, add listener and start monitor
- interest = new Interest();
- interests.put(scope, interest);
- interest.endpointListeners.add(endpointListener); // add it before monitor starts so we don't miss events
- interest.monitor = createInterfaceMonitor(scope, objClass, interest);
- interest.monitor.start();
- } else {
- // interest already exists, so just add listener to it
- if (!interest.endpointListeners.contains(endpointListener)) {
- interest.endpointListeners.add(endpointListener);
- }
- // notify listener of all known endpoints for given scope
- // (as EndpointListener contract requires of all added/modified listeners)
- for (EndpointDescription endpoint : interest.monitor.getEndpoints()) {
- notifyListeners(endpoint, scope, true, Arrays.asList(endpointListener));
- }
- }
-
- // add scope to listener's scopes list
- List<String> scopes = endpointListenerScopes.get(endpointListener);
- if (scopes == null) {
- scopes = new ArrayList<String>(1);
- endpointListenerScopes.put(endpointListener, scopes);
- }
- if (!scopes.contains(scope)) {
- scopes.add(scope);
- }
- }
-
- public synchronized void removeInterest(ServiceReference<EndpointListener> endpointListener) {
- LOG.info("removing EndpointListener interests: {}", endpointListener);
- List<String> scopes = endpointListenerScopes.get(endpointListener);
- if (scopes == null) {
- return;
- }
-
- for (String scope : scopes) {
- Interest interest = interests.get(scope);
- if (interest != null) {
- interest.endpointListeners.remove(endpointListener);
- if (interest.endpointListeners.isEmpty()) {
- interest.monitor.close();
- interests.remove(scope);
- }
- }
- }
- endpointListenerScopes.remove(endpointListener);
- }
-
- protected InterfaceMonitor createInterfaceMonitor(final String scope, String objClass, final Interest interest) {
- // holding this object's lock in the callbacks can lead to a deadlock with InterfaceMonitor
- EndpointListener endpointListener = new EndpointListener() {
-
- public void endpointRemoved(EndpointDescription endpoint, String matchedFilter) {
- notifyListeners(endpoint, scope, false, interest.endpointListeners);
- }
-
- public void endpointAdded(EndpointDescription endpoint, String matchedFilter) {
- notifyListeners(endpoint, scope, true, interest.endpointListeners);
- }
- };
- return new InterfaceMonitor(zk, objClass, endpointListener, scope);
- }
-
- private void notifyListeners(EndpointDescription endpoint, String currentScope, boolean isAdded,
- List<ServiceReference<EndpointListener>> endpointListeners) {
- for (ServiceReference<EndpointListener> endpointListenerRef : endpointListeners) {
- EndpointListener service = bctx.getService(endpointListenerRef);
- try {
- EndpointListener endpointListener = (EndpointListener)service;
- LOG.trace("matching {} against {}", endpoint, currentScope);
- if (matchFilter(bctx, currentScope, endpoint)) {
- LOG.debug("Matched {} against {}", endpoint, currentScope);
- notifyListener(endpoint, currentScope, isAdded, endpointListenerRef.getBundle(),
- endpointListener);
- }
- } finally {
- if (service != null) {
- bctx.ungetService(endpointListenerRef);
- }
- }
- }
- }
-
- private void notifyListener(EndpointDescription endpoint, String currentScope, boolean isAdded,
- Bundle endpointListenerBundle, EndpointListener endpointListener) {
- if (endpointListenerBundle == null) {
- LOG.info("listening service was unregistered, ignoring");
- } else if (isAdded) {
- LOG.info("calling EndpointListener.endpointAdded: " + endpointListener + " from bundle "
- + endpointListenerBundle.getSymbolicName() + " for endpoint: " + endpoint);
- endpointListener.endpointAdded(endpoint, currentScope);
- } else {
- LOG.info("calling EndpointListener.endpointRemoved: " + endpointListener + " from bundle "
- + endpointListenerBundle.getSymbolicName() + " for endpoint: " + endpoint);
- endpointListener.endpointRemoved(endpoint, currentScope);
- }
- }
-
- public synchronized void close() {
- for (Interest interest : interests.values()) {
- interest.monitor.close();
- }
- interests.clear();
- endpointListenerScopes.clear();
- }
-
- /**
- * Only for test case!
- */
- protected synchronized Map<String, Interest> getInterests() {
- return interests;
- }
-
- /**
- * Only for test case!
- */
- protected synchronized Map<ServiceReference<EndpointListener>, List<String>> getEndpointListenerScopes() {
- return endpointListenerScopes;
- }
-}