Author: stefanegli
Date: Tue Oct 20 14:12:31 2015
New Revision: 1709601

URL: http://svn.apache.org/viewvc?rev=1709601&view=rev
Log:
SLING-5173 : introducing discovery.base which is the sharable parts of 
discovery.impl for discovery.oak - eg it includes topology connectors and base 
classes - plus it also includes many it-kind tests of discovery.impl

Added:
    sling/trunk/bundles/extensions/discovery/base/   (with props)
    sling/trunk/bundles/extensions/discovery/base/pom.xml   (with props)
    sling/trunk/bundles/extensions/discovery/base/src/
    sling/trunk/bundles/extensions/discovery/base/src/main/
    sling/trunk/bundles/extensions/discovery/base/src/main/java/
    sling/trunk/bundles/extensions/discovery/base/src/main/java/org/
    sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseDiscoveryService.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseViewChecker.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewHelper.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewService.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/DefaultTopologyView.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/UndefinedClusterViewException.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ViewChecker.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/package-info.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/BaseConfig.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/announcement/
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/announcement/Announcement.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/announcement/AnnouncementFilter.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/announcement/AnnouncementRegistry.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/announcement/AnnouncementRegistryImpl.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/announcement/CachedAnnouncement.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/announcement/package-info.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/package-info.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/ConnectorRegistry.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/ConnectorRegistryImpl.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/TopologyConnectorClient.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/TopologyConnectorClientInformation.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/TopologyConnectorServlet.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/TopologyRequestValidator.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/package-info.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/wl/
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/wl/SubnetWhitelistEntry.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/wl/WhitelistEntry.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/wl/WildcardHelper.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/wl/WildcardWhitelistEntry.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/ping/wl/package-info.java
   (with props)
    sling/trunk/bundles/extensions/discovery/base/src/test/
    sling/trunk/bundles/extensions/discovery/base/src/test/java/
    sling/trunk/bundles/extensions/discovery/base/src/test/java/org/
    sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/commons/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/commons/DefaultTopologyViewTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/commons/DummyDiscoveryService.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/connectors/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/connectors/DummyVirtualInstanceBuilder.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/connectors/LargeTopologyWithHubTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/connectors/announcement/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/connectors/announcement/AnnouncementRegistryImplTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/connectors/ping/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/connectors/ping/ConnectorRegistryImplTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/connectors/ping/TopologyConnectorServletTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/connectors/ping/TopologyRequestValidatorTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/connectors/ping/wl/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/connectors/ping/wl/WildcardHelperTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterLoadTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/AbstractClusterTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/AbstractSingleInstanceTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/AbstractTopologyEventTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/TopologyTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/ModifiableTestBaseConfig.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/OSGiMock.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/TopologyHelper.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/VirtualConnector.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/VirtualInstance.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/VirtualInstanceBuilder.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/VirtualInstanceHelper.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/VirtualRepository.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/WithholdingAppender.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/AcceptsMultiple.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/AcceptsParticularTopologyEvent.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/AssertingTopologyEventListener.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/DummyViewChecker.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/FailingScheduler.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/MockFactory.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/MockedResource.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/MockedResourceResolver.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/PropertyProviderImpl.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/SimpleClusterViewService.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/SimpleConnectorConfig.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/base/src/test/java/org/apache/sling/discovery/base/its/setup/mock/TopologyEventAsserter.java
   (with props)
    sling/trunk/bundles/extensions/discovery/base/src/test/resources/
    
sling/trunk/bundles/extensions/discovery/base/src/test/resources/log4j.properties
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/DefaultClusterView.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/DefaultInstanceDescription.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/NonLocalInstanceDescription.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/impl/package-info.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/LocalClusterView.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/impl/AbstractServiceWithBackgroundCheck.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/impl/DiscoveryLiteConfig.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/impl/DiscoveryLiteDescriptor.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/impl/IdMapService.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/impl/package-info.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/package-info.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/util/
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/util/PropertyNameHelper.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/util/ResourceHelper.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/util/package-info.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/BaseTopologyViewTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/DefaultClusterViewTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/DefaultInstanceDescriptionTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/DummyTopologyView.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/EventFactoryTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/NonLocalInstanceDescriptionTest.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/DummyDiscoveryService.java
      - copied, changed from r1708050, 
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/SimpleDiscoveryService.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/DummyListener.java
      - copied, changed from r1708050, 
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/Listener.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/DummyScheduler.java
      - copied, changed from r1708050, 
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/SimpleScheduler.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/impl/DescriptorHelper.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/impl/DiscoveryLiteDescriptorBuilder.java
      - copied, changed from r1708050, 
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/impl/DiscoLite.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/impl/DummySlingSettingsService.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/impl/RepositoryTestHelper.java
      - copied, changed from r1708050, 
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/impl/RepositoryHelper.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/FullJR2VirtualInstance.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/FullJR2VirtualInstanceBuilder.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/TestConfig.java
   (with props)
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/VotingEventListener.java
   (with props)
Removed:
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/Listener.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/SimpleClusterView.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/SimpleDiscoveryService.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/SimpleInstanceDescription.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/SimpleScheduler.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/SimpleTopologyView.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/impl/DiscoLite.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/impl/MockFactory.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/impl/RepositoryHelper.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/cluster/ClusterViewService.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/cluster/UndefinedClusterViewException.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/DefaultClusterViewImpl.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/DefaultInstanceDescriptionImpl.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/WildcardHelper.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/resource/IsolatedInstanceDescription.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/resource/ResourceHelper.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/topology/
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/cluster/ClusterLoadTest.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/cluster/ClusterTest.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/cluster/SingleInstanceTest.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/cluster/TopologyEventTest.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/cluster/helpers/
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/common/ClusterViewTest.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/common/InstanceDescriptionTest.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/common/WildcardHelperTest.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/Instance.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/MockFactory.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/MockedResource.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/MockedResourceResolver.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/OSGiFactory.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/OSGiMock.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/PropertyProviderImpl.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/setup/WithholdingAppender.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/topology/
Modified:
    sling/trunk/bundles/extensions/discovery/commons/pom.xml
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/package-info.java
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/ViewStateManager.java
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/impl/MinEventDelayHandler.java
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/impl/ViewStateManagerImpl.java
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/package-info.java
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/impl/OakSyncTokenConsistencyService.java
    
sling/trunk/bundles/extensions/discovery/commons/src/main/java/org/apache/sling/discovery/commons/providers/spi/impl/SyncTokenConsistencyService.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/ClusterTest.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/TestHelper.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/TestMinEventDelayHandler.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/impl/TestViewStateManager.java
    
sling/trunk/bundles/extensions/discovery/commons/src/test/java/org/apache/sling/discovery/commons/providers/spi/impl/TestOakSyncTokenConsistencyService.java
    sling/trunk/bundles/extensions/discovery/impl/pom.xml
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/Config.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/TopologyWebConsolePlugin.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/cluster/ClusterViewServiceImpl.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/cluster/voting/VotingHandler.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/cluster/voting/VotingHelper.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/cluster/voting/VotingView.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/heartbeat/HeartbeatHandler.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/resource/EstablishedClusterView.java
    
sling/trunk/bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/resource/EstablishedInstanceDescription.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/common/heartbeat/HeartbeatTest.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/common/resource/EstablishedInstanceDescriptionTest.java
    
sling/trunk/bundles/extensions/discovery/impl/src/test/java/org/apache/sling/discovery/impl/common/resource/ResourceHelperWithoutJcrTest.java

Propchange: sling/trunk/bundles/extensions/discovery/base/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 20 14:12:31 2015
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: sling/trunk/bundles/extensions/discovery/base/pom.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base/pom.xml?rev=1709601&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/discovery/base/pom.xml (added)
+++ sling/trunk/bundles/extensions/discovery/base/pom.xml Tue Oct 20 14:12:31 
2015
@@ -0,0 +1,295 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  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>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>25</version>
+        <relativePath />
+    </parent>
+
+    <artifactId>org.apache.sling.discovery.base</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+
+    <name>Apache Sling Discovery Base</name>
+    <description>Contains Connector and Properties support that some 
implementations might choose to build upon</description>
+
+    <scm>
+        
<connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/discovery/base</connection>
+        
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/discovery/base</developerConnection>
+        
<url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base</url>
+    </scm>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                 <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                               
<redirectTestOutputToFile>false</redirectTestOutputToFile>
+                               <argLine>-Xmx2048m</argLine>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                  <instructions>
+                           <Embed-Dependency>
+                             
commons-net;inline=org/apache/commons/net/util/SubnetUtils*
+                           </Embed-Dependency>
+                         </instructions>
+                       </configuration>
+            </plugin>
+                       <!-- discovery.base exports a few test classes for 
reuse.
+                 In order for others to use these, the test-jar must be 
built/installed too.
+                 Note that 'mvn -Dmaven.test.skip=true' does NOT build the 
test-jar,
+                 however 'mvn -DskipTests' does. -->
+             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>biz.aQute</groupId>
+            <artifactId>bndlib</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+               <version>1.6.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+               <dependency>
+                       <groupId>org.apache.sling</groupId>
+                       <artifactId>org.apache.sling.jcr.api</artifactId>
+                       <version>2.1.0</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>javax.jcr</groupId>
+                       <artifactId>jcr</artifactId>
+                       <version>2.0</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.jackrabbit</groupId>
+                       <artifactId>jackrabbit-api</artifactId>
+                       <version>2.2.4</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.sling</groupId>
+                       <artifactId>org.apache.sling.commons.osgi</artifactId>
+                       <version>2.1.0</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.sling</groupId>
+                       <artifactId>org.apache.sling.settings</artifactId>
+                       <version>1.2.2</version>
+            <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.sling</groupId>
+                       <artifactId>org.apache.sling.discovery.api</artifactId>
+                       <version>1.0.0</version>
+            <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.sling</groupId>
+                       
<artifactId>org.apache.sling.discovery.commons</artifactId>
+                       <version>1.0.0-SNAPSHOT</version>
+               </dependency>
+        <!-- besides including discovery.commons' normal jar above, 
+              for testing a few test helper classes are also reused.
+              in order to achieve that, also adding a test/test-jar 
dependency: --> 
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.discovery.commons</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>test</scope>
+            <type>test-jar</type>
+        </dependency>
+               <dependency>
+                       <groupId>org.apache.sling</groupId>
+                       <artifactId>org.apache.sling.api</artifactId>
+                       <version>2.4.0</version>
+            <scope>provided</scope>
+               </dependency>
+        <dependency>
+               <groupId>org.apache.sling</groupId>
+               <artifactId>org.apache.sling.commons.scheduler</artifactId>
+               <version>2.3.4</version>
+            <scope>provided</scope>
+        </dependency>
+               <dependency>
+                       <groupId>org.apache.felix</groupId>
+                       <artifactId>org.apache.felix.webconsole</artifactId>
+                       <version>3.0.0</version>
+            <scope>provided</scope>
+               </dependency>
+           <dependency>
+             <groupId>org.eclipse.jetty</groupId>
+             <artifactId>jetty-servlet</artifactId>
+             <version>8.1.2.v20120308</version>
+             <scope>test</scope>
+           </dependency>
+               <dependency>
+                       <groupId>javax.servlet</groupId>
+                       <artifactId>servlet-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.httpcomponents</groupId>
+                       <artifactId>httpclient-osgi</artifactId>
+                       <version>4.3.5</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.sling</groupId>
+                       <artifactId>org.apache.sling.commons.json</artifactId>
+                       <version>2.0.6</version>
+            <scope>provided</scope>
+               </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.launchpad.api</artifactId>
+                   <version>1.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-net</groupId>
+            <artifactId>commons-net</artifactId>
+            <version>3.3</version>
+            <scope>provided</scope>
+        </dependency>
+      <!-- Testing -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit-addons</groupId>
+            <artifactId>junit-addons</artifactId>
+            <version>1.4</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock-junit4</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <version>1.9.5</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+               <groupId>org.apache.sling</groupId>
+               <artifactId>org.apache.sling.commons.testing</artifactId>
+               <version>2.0.16</version>
+               <scope>test</scope>
+            <exclusions>
+                <!-- slf4j simple implementation logs INFO + higher to stdout 
(we don't want that behaviour) -->
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-simple</artifactId>
+                </exclusion>
+                <!--  also excluding jcl-over-slf4j as we need a newer vesion 
of this which is compatible with slf4j 1.6 -->
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>jcl-over-slf4j</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        
+        <!-- using log4j under slf4j to allow fine-grained logging config (see 
src/test/resources/log4j.properties) -->
+        <dependency>
+               <groupId>org.slf4j</groupId>
+               <artifactId>slf4j-log4j12</artifactId>
+               <version>1.7.5</version>
+               <scope>test</scope>
+        </dependency>
+        <dependency>
+               <groupId>org.apache.sling</groupId>
+               <artifactId>org.apache.sling.jcr.resource</artifactId>
+               <version>2.3.8</version>
+               <scope>test</scope>
+        </dependency>
+           <dependency>
+                       <groupId>log4j</groupId>
+                       <artifactId>log4j</artifactId>
+                       <version>1.2.13</version>
+                       <scope>test</scope>
+           </dependency>
+        <dependency>
+               <groupId>org.apache.sling</groupId>
+               <artifactId>org.apache.sling.commons.threads</artifactId>
+               <version>3.1.0</version>
+               <type>bundle</type>
+               <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.tools</artifactId>
+            <version>1.0.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.sling</groupId>
+          <artifactId>org.apache.sling.testing.sling-mock</artifactId>
+          <version>1.2.0</version>
+        </dependency>
+    </dependencies>
+</project>

Propchange: sling/trunk/bundles/extensions/discovery/base/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseDiscoveryService.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseDiscoveryService.java?rev=1709601&view=auto
==============================================================================
--- 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseDiscoveryService.java
 (added)
+++ 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseDiscoveryService.java
 Tue Oct 20 14:12:31 2015
@@ -0,0 +1,104 @@
+/*
+ * 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.sling.discovery.base.commons;
+
+import java.util.Collection;
+
+import org.apache.sling.discovery.DiscoveryService;
+import org.apache.sling.discovery.InstanceDescription;
+import org.apache.sling.discovery.TopologyView;
+import 
org.apache.sling.discovery.base.commons.UndefinedClusterViewException.Reason;
+import 
org.apache.sling.discovery.base.connectors.announcement.AnnouncementRegistry;
+import org.apache.sling.discovery.commons.providers.spi.LocalClusterView;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstract base class for DiscoveryService implementations which uses the 
+ * ClusterViewService plus Topology Connectors to calculate
+ * the current TopologyView
+ */
+public abstract class BaseDiscoveryService implements DiscoveryService {
+
+    private final static Logger logger = 
LoggerFactory.getLogger(BaseDiscoveryService.class);
+
+    /** the old view previously valid and sent to the TopologyEventListeners 
**/
+    private DefaultTopologyView oldView;
+
+    protected abstract ClusterViewService getClusterViewService();
+    
+    protected abstract AnnouncementRegistry getAnnouncementRegistry();
+    
+    protected abstract void handleIsolatedFromTopology();
+    
+    public abstract void updateProperties();
+
+    public abstract void handlePotentialTopologyChange();
+
+    public abstract void handleTopologyChanging();
+
+    protected DefaultTopologyView getOldView() {
+        return oldView;
+    }
+    
+    protected void setOldView(DefaultTopologyView view) {
+        if (view==null) {
+            throw new IllegalArgumentException("view must not be null");
+        }
+        logger.debug("setOldView: oldView is now: {}", oldView);
+        oldView = view;
+    }
+    
+    /**
+     * @see DiscoveryService#getTopology()
+     */
+    public TopologyView getTopology() {
+        ClusterViewService clusterViewService = getClusterViewService();
+        if (clusterViewService == null) {
+            throw new IllegalStateException(
+                    "DiscoveryService not yet initialized with 
IClusterViewService");
+        }
+        // create a new topology view
+        final DefaultTopologyView topology = new DefaultTopologyView();
+
+        LocalClusterView localClusterView = null;
+        try {
+            localClusterView = clusterViewService.getLocalClusterView();
+            topology.setLocalClusterView(localClusterView);
+        } catch (UndefinedClusterViewException e) {
+            // SLING-5030 : when we're cut off from the local cluster we also
+            // treat it as being cut off from the entire topology, ie we don't
+            // update the announcements but just return
+            // the previous oldView marked as !current
+            logger.info("getTopology: undefined cluster view: 
"+e.getReason()+"] "+e);
+            oldView.setNotCurrent();
+            if (e.getReason()==Reason.ISOLATED_FROM_TOPOLOGY) {
+                handleIsolatedFromTopology();
+            }
+            return oldView;
+        }
+
+        Collection<InstanceDescription> attachedInstances = 
getAnnouncementRegistry()
+                .listInstances(localClusterView);
+        topology.addInstances(attachedInstances);
+
+        return topology;
+    }
+
+}

Propchange: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseDiscoveryService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseViewChecker.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseViewChecker.java?rev=1709601&view=auto
==============================================================================
--- 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseViewChecker.java
 (added)
+++ 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseViewChecker.java
 Tue Oct 20 14:12:31 2015
@@ -0,0 +1,335 @@
+/*
+ * 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.sling.discovery.base.commons;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.commons.scheduler.Scheduler;
+import org.apache.sling.discovery.base.connectors.BaseConfig;
+import 
org.apache.sling.discovery.base.connectors.announcement.AnnouncementRegistry;
+import org.apache.sling.discovery.base.connectors.ping.ConnectorRegistry;
+import org.apache.sling.launchpad.api.StartupListener;
+import org.apache.sling.launchpad.api.StartupMode;
+import org.apache.sling.settings.SlingSettingsService;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The heartbeat handler is responsible and capable of issuing both local and
+ * remote heartbeats and registers a periodic job with the scheduler for doing 
so.
+ * <p>
+ * Local heartbeats are stored in the repository. Remote heartbeats are POSTs 
to
+ * remote TopologyConnectorServlets.
+ */
+public abstract class BaseViewChecker implements ViewChecker, Runnable, 
StartupListener {
+
+    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    /** Endpoint service registration property from RFC 189 */
+    private static final String REG_PROPERTY_ENDPOINTS = 
"osgi.http.service.endpoints";
+
+    protected static final String PROPERTY_ID_ENDPOINTS = "endpoints";
+
+    protected static final String PROPERTY_ID_SLING_HOME_PATH = 
"slingHomePath";
+
+    protected static final String PROPERTY_ID_RUNTIME = "runtimeId";
+
+    /** the name used for the period job with the scheduler **/
+    protected String NAME = "discovery.impl.heartbeat.runner.";
+
+    @Reference
+    protected SlingSettingsService slingSettingsService;
+
+    @Reference
+    protected ResourceResolverFactory resourceResolverFactory;
+
+    @Reference
+    protected ConnectorRegistry connectorRegistry;
+
+    @Reference
+    protected AnnouncementRegistry announcementRegistry;
+
+    @Reference
+    protected Scheduler scheduler;
+
+    @Reference
+    protected BaseConfig connectorConfig;
+
+    /** the discovery service reference is used to get properties updated 
before heartbeats are sent **/
+    protected BaseDiscoveryService discoveryService;
+
+    /** the sling id of the local instance **/
+    protected String slingId;
+    
+    /** SLING-2901: the runtimeId is a unique id, set on activation, used for 
robust duplicate sling.id detection **/
+    protected String runtimeId;
+
+    /** lock object for synchronizing the run method **/
+    protected final Object lock = new Object();
+
+    /** SLING-2895: avoid heartbeats after deactivation **/
+    protected volatile boolean activated = false;
+
+    /** keep a reference to the component context **/
+    protected ComponentContext context;
+
+    /** SLING-2968 : start issuing remote heartbeats only after startup 
finished **/
+    protected boolean startupFinished = false;
+
+    /** SLING-3382 : force ping instructs the servlet to start the backoff 
from scratch again **/
+    private boolean forcePing;
+
+    /** SLING-4765 : store endpoints to /clusterInstances for more verbose 
duplicate slingId/ghost detection **/
+    protected final Map<Long, String[]> endpoints = new HashMap<Long, 
String[]>();
+
+    public void inform(StartupMode mode, boolean finished) {
+       if (finished) {
+               startupFinished(mode);
+       }
+    }
+
+    public void startupFinished(StartupMode mode) {
+       synchronized(lock) {
+               startupFinished = true;
+               issueHeartbeat();
+       }
+    }
+
+    public void startupProgress(float ratio) {
+       // we dont care
+    }
+
+    @Activate
+    protected void activate(ComponentContext context) {
+       synchronized(lock) {
+               this.context = context;
+
+               slingId = slingSettingsService.getSlingId();
+               NAME = "discovery.connectors.common.runner." + slingId;
+
+               doActivate();
+               activated = true;
+       }
+    }
+
+    protected void doActivate() {
+        try {
+            final long interval = connectorConfig.getConnectorPingInterval();
+            logger.info("doActivate: starting periodic connectorPing job for 
"+slingId+" with interval "+interval+" sec.");
+            scheduler.addPeriodicJob(NAME, this,
+                    null, interval, false);
+        } catch (Exception e) {
+            logger.error("doActivate: Could not start connectorPing runner: " 
+ e, e);
+        }
+        logger.info("doActivate: activated with slingId: {}, this: {}", 
slingId, this);
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        // SLING-3365 : dont synchronize on deactivate
+        activated = false;
+        logger.info("deactivate: deactivated slingId: {}, this: {}", slingId, 
this);
+       scheduler.removeJob(NAME);
+    }
+    
+    /** for testing only **/
+    @Override
+    public void checkView() {
+        synchronized(lock) {
+            doCheckView();
+        }
+    }
+    
+    public void run() {
+        heartbeatAndCheckView();
+    }
+    
+    @Override
+    public void heartbeatAndCheckView() {
+        logger.info("run: start. [ConnectorPinger of slingId="+slingId+"]");
+        synchronized(lock) {
+               if (!activated) {
+                       // SLING:2895: avoid heartbeats if not activated
+                   logger.debug("run: not activated yet");
+                       return;
+               }
+
+            // issue a heartbeat
+            issueHeartbeat();
+
+            // check the view
+            doCheckView();
+        }
+        logger.info("run: end. [ConnectorPinger of slingId="+slingId+"]");
+    }
+
+    /** Trigger the issuance of the next heartbeat asap instead of at next 
heartbeat interval **/
+    public void triggerAsyncConnectorPing() {
+        forcePing = true;
+        try {
+            // then fire a job immediately
+            // use 'fireJobAt' here, instead of 'fireJob' to make sure the job 
can always be triggered
+            // 'fireJob' checks for a job from the same job-class to already 
exist
+            // 'fireJobAt' though allows to pass a name for the job - which 
can be made unique, thus does not conflict/already-exist
+            logger.info("triggerConnectorPing: firing job to trigger 
heartbeat");
+            scheduler.fireJobAt(NAME+UUID.randomUUID(), this, null, new 
Date(System.currentTimeMillis()-1000 /* make sure it gets triggered 
immediately*/));
+        } catch (Exception e) {
+            logger.info("triggerConnectorPing: Could not trigger heartbeat: " 
+ e);
+        }
+    }
+    
+    /**
+     * Issue a heartbeat.
+     * <p>
+     * This action consists of first updating the local properties,
+     * then issuing a cluster-local heartbeat (within the repository)
+     * and then a remote heartbeat (to all the topology connectors
+     * which announce this part of the topology to others)
+     */
+    protected void issueHeartbeat() {
+        if (discoveryService == null) {
+            logger.error("issueHeartbeat: discoveryService is null");
+        } else {
+            discoveryService.updateProperties();
+        }
+//        issueClusterLocalHeartbeat();
+        issueConnectorPings();
+    }
+
+    /** Issue a remote heartbeat using the topology connectors **/
+    protected void issueConnectorPings() {
+        if (connectorRegistry == null) {
+            logger.error("issueConnectorPings: connectorRegistry is null");
+            return;
+        }
+        if (!startupFinished) {
+               logger.debug("issueConnectorPings: not issuing remote heartbeat 
yet, startup not yet finished");
+               return;
+        }
+        if (logger.isDebugEnabled()) {
+            logger.debug("issueConnectorPings: pinging outgoing topology 
connectors (if there is any) for "+slingId);
+        }
+        connectorRegistry.pingOutgoingConnectors(forcePing);
+        forcePing = false;
+    }
+
+    /** Check whether the established view matches the reality, ie matches the
+     * heartbeats
+     */
+    protected void doCheckView() {
+        // check the remotes first
+        if (announcementRegistry == null) {
+            logger.error("announcementRegistry is null");
+            return;
+        }
+        announcementRegistry.checkExpiredAnnouncements();
+    }
+
+    /**
+     * Bind a http service
+     */
+    protected void bindHttpService(final ServiceReference reference) {
+        final String[] endpointUrls = 
toStringArray(reference.getProperty(REG_PROPERTY_ENDPOINTS));
+        if ( endpointUrls != null ) {
+            synchronized ( lock ) {
+                
this.endpoints.put((Long)reference.getProperty(Constants.SERVICE_ID), 
endpointUrls);
+            }
+        }
+    }
+
+    /**
+     * Unbind a http service
+     */
+    protected void unbindHttpService(final ServiceReference reference) {
+        synchronized ( lock ) {
+            if ( 
this.endpoints.remove(reference.getProperty(Constants.SERVICE_ID)) != null ) {
+            }
+        }
+    }
+    
+    private String[] toStringArray(final Object propValue) {
+        if (propValue == null) {
+            // no value at all
+            return null;
+
+        } else if (propValue instanceof String) {
+            // single string
+            return new String[] { (String) propValue };
+
+        } else if (propValue instanceof String[]) {
+            // String[]
+            return (String[]) propValue;
+
+        } else if (propValue.getClass().isArray()) {
+            // other array
+            Object[] valueArray = (Object[]) propValue;
+            List<String> values = new ArrayList<String>(valueArray.length);
+            for (Object value : valueArray) {
+                if (value != null) {
+                    values.add(value.toString());
+                }
+            }
+            return values.toArray(new String[values.size()]);
+
+        } else if (propValue instanceof Collection<?>) {
+            // collection
+            Collection<?> valueCollection = (Collection<?>) propValue;
+            List<String> valueList = new 
ArrayList<String>(valueCollection.size());
+            for (Object value : valueCollection) {
+                if (value != null) {
+                    valueList.add(value.toString());
+                }
+            }
+            return valueList.toArray(new String[valueList.size()]);
+        }
+
+        return null;
+    }
+    
+    protected String getEndpointsAsString() {
+        final StringBuilder sb = new StringBuilder();
+        boolean first = true;
+        for(final String[] points : endpoints.values()) {
+            for(final String point : points) {
+                if ( first ) {
+                    first = false;
+                } else {
+                    sb.append(",");
+                }
+                sb.append(point);
+            }
+        }
+        return sb.toString();
+        
+    }
+
+}

Propchange: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/BaseViewChecker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewHelper.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewHelper.java?rev=1709601&view=auto
==============================================================================
--- 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewHelper.java
 (added)
+++ 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewHelper.java
 Tue Oct 20 14:12:31 2015
@@ -0,0 +1,55 @@
+/*
+ * 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.sling.discovery.base.commons;
+
+import java.util.Collection;
+
+import org.apache.sling.discovery.ClusterView;
+import org.apache.sling.discovery.InstanceDescription;
+
+/**
+ * Contains some static helper methods around ClusterView
+ */
+public class ClusterViewHelper {
+
+    /** checks whether the cluster view contains a particular sling id **/
+    public static boolean contains(ClusterView clusterView, String slingId) 
throws UndefinedClusterViewException {
+        InstanceDescription found = null;
+        for (InstanceDescription i : clusterView.getInstances()) {
+            if (i.getSlingId().equals(slingId)) {
+                if (found!=null) {
+                    throw new IllegalStateException("multiple instances with 
slingId found: "+slingId);
+                }
+                found = i;
+            }
+        }
+        return found!=null;
+    }
+
+    /** checks whether the cluster contains any of the provided instances **/
+    public static boolean containsAny(ClusterView clusterView, 
Collection<InstanceDescription> listInstances) 
+            throws UndefinedClusterViewException {
+        for (InstanceDescription i : listInstances) {
+            if (contains(clusterView, i.getSlingId())) {
+                return true;
+            }
+        }
+        return false;
+    }
+}

Propchange: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewService.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewService.java?rev=1709601&view=auto
==============================================================================
--- 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewService.java
 (added)
+++ 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewService.java
 Tue Oct 20 14:12:31 2015
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.discovery.base.commons;
+
+import org.apache.sling.discovery.commons.providers.spi.LocalClusterView;
+
+/**
+ * The ClusterViewService is capable of determining the 
+ * ClusterView of the local cluster (ie of the instances
+ * that are all hooked to the same underlying repository).
+ */
+public interface ClusterViewService {
+
+    /** the sling id of the local instance **/
+    String getSlingId();
+
+    /**
+     * Returns the current, local cluster view - throwing an
+     * UndefinedClusterViewException if it cannot determine
+     * a clusterView at the moment.
+     * @return the current cluster view - never returns null 
+     * (it rather throws an UndefinedClusterViewException that
+     * contains more details about why exactly the clusterView
+     * is undefined at the moment)
+     * @throws UndefinedClusterViewException thrown when
+     * the ClusterView cannot be determined at the moment
+     * (also contains more details as to why exactly)
+     */
+    LocalClusterView getLocalClusterView() throws 
UndefinedClusterViewException;
+
+}

Propchange: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ClusterViewService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/DefaultTopologyView.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/DefaultTopologyView.java?rev=1709601&view=auto
==============================================================================
--- 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/DefaultTopologyView.java
 (added)
+++ 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/DefaultTopologyView.java
 Tue Oct 20 14:12:31 2015
@@ -0,0 +1,252 @@
+/*
+ * 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.sling.discovery.base.commons;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.sling.discovery.ClusterView;
+import org.apache.sling.discovery.InstanceDescription;
+import org.apache.sling.discovery.InstanceFilter;
+import org.apache.sling.discovery.TopologyEvent.Type;
+import org.apache.sling.discovery.commons.providers.BaseTopologyView;
+import org.apache.sling.discovery.commons.providers.spi.LocalClusterView;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Default Implementation of the topology view interface
+ */
+public class DefaultTopologyView extends BaseTopologyView {
+
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    /** the instances that are part of this topology **/
+    private final Set<InstanceDescription> instances = new 
HashSet<InstanceDescription>();
+
+    private String localClusterSyncTokenId;
+
+    /** Create a new empty topology **/
+    public DefaultTopologyView() {
+        // nothing to be initialized then
+    }
+
+    /** Create a new topology filled with the given list of instances **/
+    public DefaultTopologyView(final Collection<InstanceDescription> 
instances) {
+        if (instances != null) {
+            this.instances.addAll(instances);
+        }
+    }
+
+    /**
+     * Compare this topology with the given one and determine how they compare
+     * @param other the other topology against which to compare
+     * @return the type describing how these two compare
+     * @see Type
+     */
+    public Type compareTopology(final DefaultTopologyView other) {
+        if (other == null) {
+            throw new IllegalArgumentException("other must not be null");
+        }
+        if (this.instances.size() != other.instances.size()) {
+               logger.debug("compareTopology: different number of instances");
+            return Type.TOPOLOGY_CHANGED;
+        }
+        boolean propertiesChanged = false;
+        for(final InstanceDescription instance : this.instances) {
+
+            final Iterator<InstanceDescription> it2 = 
other.instances.iterator();
+            InstanceDescription matchingInstance = null;
+            while (it2.hasNext()) {
+                final InstanceDescription otherInstance = it2.next();
+                if (instance.getSlingId().equals(otherInstance.getSlingId())) {
+                    matchingInstance = otherInstance;
+                    break;
+                }
+            }
+            if (matchingInstance == null) {
+               if (logger.isDebugEnabled()) {
+                       logger.debug("compareTopology: no matching instance 
found for {}", instance);
+               }
+                return Type.TOPOLOGY_CHANGED;
+            }
+            if (!instance.getClusterView().getId()
+                    .equals(matchingInstance.getClusterView().getId())) {
+               logger.debug("compareTopology: cluster view id does not match");
+                return Type.TOPOLOGY_CHANGED;
+            }
+            if (!instance.isLeader()==matchingInstance.isLeader()) {
+                logger.debug("compareTopology: leaders differ");
+                return Type.TOPOLOGY_CHANGED;
+            }
+            if (!instance.getProperties().equals(
+                    matchingInstance.getProperties())) {
+                propertiesChanged = true;
+            }
+        }
+        if (propertiesChanged) {
+            return Type.PROPERTIES_CHANGED;
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (obj == null || !(obj instanceof DefaultTopologyView)) {
+            return false;
+        }
+        DefaultTopologyView other = (DefaultTopologyView) obj;
+        if (this.isCurrent() != other.isCurrent()) {
+            return false;
+        }
+        Type diff = compareTopology(other);
+        return diff == null;
+    }
+
+    @Override
+    public int hashCode() {
+        int code = 0;
+        for (Iterator<InstanceDescription> it = instances.iterator(); it
+                .hasNext();) {
+            InstanceDescription instance = it.next();
+            code += instance.hashCode();
+        }
+        return code;
+    }
+
+    /**
+     * @see org.apache.sling.discovery.TopologyView#getLocalInstance()
+     */
+    public InstanceDescription getLocalInstance() {
+        for (Iterator<InstanceDescription> it = instances.iterator(); it
+                .hasNext();) {
+            InstanceDescription instance = it.next();
+            if (instance.isLocal()) {
+                return instance;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * @see org.apache.sling.discovery.TopologyView#getInstances()
+     */
+    public Set<InstanceDescription> getInstances() {
+        return Collections.unmodifiableSet(instances);
+    }
+
+    /**
+     * Adds the instances of the given ClusterView to this topology
+     */
+    public void setLocalClusterView(final LocalClusterView localClusterView) {
+        if (localClusterView == null) {
+            throw new IllegalArgumentException("localClusterView must not be 
null");
+        }
+        final List<InstanceDescription> instances = 
localClusterView.getInstances();
+        addInstances(instances);
+        
+        this.localClusterSyncTokenId = 
localClusterView.getLocalClusterSyncTokenId();
+    }
+    
+    /**
+     * Adds the given instances to this topology
+     */
+    public void addInstances(final Collection<InstanceDescription> instances) {
+        if (instances == null) {
+            return;
+        }
+        outerLoop: for (Iterator<InstanceDescription> it = 
instances.iterator(); it
+                .hasNext();) {
+            InstanceDescription instanceDescription = it.next();
+            for (Iterator<InstanceDescription> it2 = 
this.instances.iterator(); it2.hasNext();) {
+                InstanceDescription existingInstance = it2.next();
+                if 
(existingInstance.getSlingId().equals(instanceDescription.getSlingId())) {
+                    // SLING-3726:
+                    // while 'normal duplicate instances' are filtered out 
here correctly,
+                    // 'hidden duplicate instances' that are added via this 
instanceDescription's
+                    // cluster, are not caught.
+                    // there is, however, no simple fix for this. Since the 
reason is 
+                    // inconsistent state information in /var/discovery/impl - 
either
+                    // due to stale-announcements (SLING-4139) - or by some 
manualy
+                    // copying of data from one cluster to the next (which 
will also
+                    // be cleaned up by SLING-4139 though)
+                    // so the fix for avoiding duplicate instances is really 
SLING-4139
+                    logger.info("addInstance: cannot add same instance twice: "
+                            + instanceDescription);
+                    continue outerLoop;
+                }
+            }
+            this.instances.add(instanceDescription);
+        }
+    }
+
+    /**
+     * @see 
org.apache.sling.discovery.TopologyView#findInstances(org.apache.sling.discovery.InstanceFilter)
+     */
+    public Set<InstanceDescription> findInstances(final InstanceFilter picker) 
{
+        if (picker == null) {
+            throw new IllegalArgumentException("picker must not be null");
+        }
+        Set<InstanceDescription> result = new HashSet<InstanceDescription>();
+        for (Iterator<InstanceDescription> it = instances.iterator(); it
+                .hasNext();) {
+            InstanceDescription instance = it.next();
+            if (picker.accept(instance)) {
+                result.add(instance);
+            }
+        }
+        return result;
+    }
+
+    /**
+     * @see org.apache.sling.discovery.TopologyView#getClusterViews()
+     */
+    public Set<ClusterView> getClusterViews() {
+        Set<ClusterView> result = new HashSet<ClusterView>();
+        for (Iterator<InstanceDescription> it = instances.iterator(); it
+                .hasNext();) {
+            InstanceDescription instance = it.next();
+            ClusterView cluster = instance.getClusterView();
+            if (cluster != null) {
+                result.add(cluster);
+            }
+        }
+        return new HashSet<ClusterView>(result);
+    }
+
+    @Override
+    public String toString() {
+        return "TopologyViewImpl [current=" + isCurrent() + ", num=" + 
instances.size() + ", instances="
+                + instances + "]";
+    }
+
+    @Override
+    public String getLocalClusterSyncTokenId() {
+        if (localClusterSyncTokenId==null) {
+            throw new IllegalStateException("no syncToken set");
+        } else {
+            return localClusterSyncTokenId;
+        }
+    }
+}

Propchange: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/DefaultTopologyView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/UndefinedClusterViewException.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/UndefinedClusterViewException.java?rev=1709601&view=auto
==============================================================================
--- 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/UndefinedClusterViewException.java
 (added)
+++ 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/UndefinedClusterViewException.java
 Tue Oct 20 14:12:31 2015
@@ -0,0 +1,64 @@
+/*
+ * 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.sling.discovery.base.commons;
+
+/**
+ * This exception is thrown when the ClusterViewService
+ * does not have a cluster view that is valid. 
+ * That can either be because it cannot access the repository
+ * (login or other repository exception) or that there is
+ * no established view yet at all (not yet voted case) - 
+ * or that there is an established view but it doesn't include 
+ * the local instance (isolated case)
+ */
+@SuppressWarnings("serial")
+public class UndefinedClusterViewException extends Exception {
+
+    public static enum Reason {
+        /** used when the local instance is isolated from the topology
+         * (which is noticed by an established view that does not include
+         * the local instance)
+         */
+        ISOLATED_FROM_TOPOLOGY,
+        
+        /** used when there is no established view yet
+         * (happens on a fresh installation)
+         */
+        NO_ESTABLISHED_VIEW,
+        
+        /** used when we couldn't reach the repository **/
+        REPOSITORY_EXCEPTION
+    }
+
+    private final Reason reason;
+    
+    public UndefinedClusterViewException(Reason reason) {
+        super();
+        this.reason = reason;
+    }
+
+    public UndefinedClusterViewException(Reason reason, String msg) {
+        super(msg);
+        this.reason = reason;
+    }
+    
+    public Reason getReason() {
+        return reason;
+    }
+}

Propchange: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/UndefinedClusterViewException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ViewChecker.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ViewChecker.java?rev=1709601&view=auto
==============================================================================
--- 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ViewChecker.java
 (added)
+++ 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ViewChecker.java
 Tue Oct 20 14:12:31 2015
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.discovery.base.commons;
+
+/**
+ * A ViewChecker is capable of issuing a heartbeat and
+ * subsequently checking the resulting, current view 
+ * in the local cluster.
+ * <p>
+ * This is mostly used as hooks for testing
+ */
+public interface ViewChecker {
+
+    /**
+     * Check the view (without issuing a heartbeat)
+     */
+    public void checkView();
+    
+    /**
+     * Issue a heartbeat and check the view
+     */
+    public void heartbeatAndCheckView();
+
+}

Propchange: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/ViewChecker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/package-info.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/package-info.java?rev=1709601&view=auto
==============================================================================
--- 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/package-info.java
 (added)
+++ 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/package-info.java
 Tue Oct 20 14:12:31 2015
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+/**
+ * Provides some common classes for discovery implementors that 
+ * choose to extend from discovery.base
+ *
+ * @version 1.0.0
+ */
+@Version("1.0.0")
+package org.apache.sling.discovery.base.commons;
+
+import aQute.bnd.annotation.Version;
+

Propchange: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/commons/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/BaseConfig.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/BaseConfig.java?rev=1709601&view=auto
==============================================================================
--- 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/BaseConfig.java
 (added)
+++ 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/BaseConfig.java
 Tue Oct 20 14:12:31 2015
@@ -0,0 +1,129 @@
+/*
+ * 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.sling.discovery.base.connectors;
+
+import java.net.URL;
+
+/**
+ * Configuration for discovery.base
+ */
+public interface BaseConfig {
+
+    /**
+     * Returns the socket connect() timeout used by the topology connector, 0 
disables the timeout
+     * @return the socket connect() timeout used by the topology connector, 0 
disables the timeout
+     */
+    public int getSocketConnectionTimeout();
+
+    /**
+     * Returns the socket read timeout (SO_TIMEOUT) used by the topology 
connector, 0 disables the timeout
+     * @return the socket read timeout (SO_TIMEOUT) used by the topology 
connector, 0 disables the timeout
+     */
+    public int getSoTimeout();
+    
+    /**
+     * Returns the URLs to which to open a topology connector - or null/empty 
if no topology connector
+     * is configured (default is null)
+     * @return the URLs to which to open a topology connector - or null/empty 
if no topology connector
+     * is configured
+     */
+    public URL[] getTopologyConnectorURLs();
+
+    /**
+     * Returns a comma separated list of hostnames and/or ip addresses which 
are allowed as
+     * remote hosts to open connections to the topology connector servlet
+     * @return a comma separated list of hostnames and/or ip addresses which 
are allowed as
+     * remote hosts to open connections to the topology connector servlet
+     */
+    public String[] getTopologyConnectorWhitelist();
+
+    /**
+     * Returns the resource path where cluster instance informations are 
stored.
+     * @return the resource path where cluster instance informations are stored
+     */
+    public String getClusterInstancesPath();
+
+
+    /**
+     * @return true if hmac is enabled.
+     */
+    public boolean isHmacEnabled();
+
+    /**
+     * @return the shared key
+     */
+    public String getSharedKey();
+
+    /**
+     * @return the interval of the shared key for hmac.
+     */
+    public long getKeyInterval();
+
+    /**
+     * @return true if encryption is enabled.
+     */
+    public boolean isEncryptionEnabled();
+    
+    /**
+     * @return true if requests on the topology connector should be gzipped
+     * (which only works if the server accepts that.. ie discovery.impl 1.0.4+)
+     */
+    public boolean isGzipConnectorRequestsEnabled();
+    
+    /**
+     * @return true if the auto-stopping of local-loop topology connectors is 
enabled.
+     */
+    public boolean isAutoStopLocalLoopEnabled();
+
+    /**
+     * Returns the backoff factor to be used for standby (loop) connectors
+     * @return the backoff factor to be used for standby (loop) connectors
+     */
+    public int getBackoffStandbyFactor();
+
+    /**
+     * Returns the (maximum) backoff factor to be used for stable connectors
+     * @return the (maximum) backoff factor to be used for stable connectors
+     */
+    public int getBackoffStableFactor();
+
+    /**
+     * Returns the backoff interval for standby (loop) connectors in seconds
+     * @return the backoff interval for standby (loop) connectors in seconds
+     */
+    public long getBackoffStandbyInterval();
+
+    /**
+     * Returns the interval (in seconds) in which connectors are pinged
+     * @return the interval (in seconds) in which connectors are pinged
+     */
+    public long getConnectorPingInterval();
+
+    /**
+     * Returns the timeout (in seconds) after which a connector ping is 
considered invalid/timed out
+     * @return the timeout (in seconds) after which a connector ping is 
considered invalid/timed out
+     */
+    public long getConnectorPingTimeout();
+
+    /**
+     * The minEventDelay to apply to the ViewStateManager
+     */
+    public int getMinEventDelay();
+
+}

Propchange: 
sling/trunk/bundles/extensions/discovery/base/src/main/java/org/apache/sling/discovery/base/connectors/BaseConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to