You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ap...@apache.org on 2022/07/22 06:57:04 UTC

[sling-org-apache-sling-discovery-oak] branch revert-5-master created (now d4e82a3)

This is an automated email from the ASF dual-hosted git repository.

apelluru pushed a change to branch revert-5-master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-discovery-oak.git


      at d4e82a3  Revert "SLING-11355: sling discovery bundles: update to sling 48"

This branch includes the following new commits:

     new d4e82a3  Revert "SLING-11355: sling discovery bundles: update to sling 48"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[sling-org-apache-sling-discovery-oak] 01/01: Revert "SLING-11355: sling discovery bundles: update to sling 48"

Posted by ap...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

apelluru pushed a commit to branch revert-5-master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-discovery-oak.git

commit d4e82a31de3f835a12abb66d0b580e4703af3298
Author: Ashok Pelluru <37...@users.noreply.github.com>
AuthorDate: Fri Jul 22 08:56:59 2022 +0200

    Revert "SLING-11355: sling discovery bundles: update to sling 48"
---
 bnd.bnd                                            |  13 -
 pom.xml                                            | 113 +++--
 .../org/apache/sling/discovery/oak/Config.java     | 464 +++++++++++++--------
 .../oak/DiscoveryServiceCentralConfig.java         | 175 --------
 .../sling/discovery/oak/OakDiscoveryService.java   | 216 +++++-----
 .../oak/SynchronizedClocksHealthCheck.java         |  20 +-
 .../discovery/oak/TopologyWebConsolePlugin.java    |  30 +-
 .../oak/cluster/OakClusterViewService.java         |  16 +-
 .../sling/discovery/oak/pinger/OakViewChecker.java |  21 +-
 .../discovery/oak/OakDiscoveryServiceTest.java     |   1 -
 10 files changed, 528 insertions(+), 541 deletions(-)

diff --git a/bnd.bnd b/bnd.bnd
deleted file mode 100644
index c652385..0000000
--- a/bnd.bnd
+++ /dev/null
@@ -1,13 +0,0 @@
-Import-Package:\
-    org.apache.felix.webconsole;resolution:=optional,\
-    org.apache.felix.hc.api;resolution:=optional,\
-    *
-
-Export-Package:\
-    !org.apache.sling.discovery.oak
-
-Provide-Capability:\
-    osgi.service;objectClass:List<String>="org.apache.sling.discovery.oak.Config,org.apache.sling.discovery.base.connectors.BaseConfig,org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteConfig"
-
--includeresource:\
-    @commons-net-*.jar!/org/apache/commons/net/util/SubnetUtils*
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 4602203..dec13d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,31 +22,32 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.sling</groupId>
-        <artifactId>sling-bundle-parent</artifactId>
-        <version>48</version>
+        <artifactId>sling</artifactId>
+        <version>29</version>
         <relativePath />
     </parent>
 
     <artifactId>org.apache.sling.discovery.oak</artifactId>
+    <packaging>bundle</packaging>
     <version>1.2.39-SNAPSHOT</version>
 
     <name>Apache Sling Oak-Based Discovery Service</name>
     <description>Implementation of Apache Sling Discovery based on Jackrabbit Oak using its discovery-lite descriptor for in-cluster view detection and a TopologyView through HTTP POST heartbeats announcing sub-topologies to each other.</description>
 
     <properties>
-        <sling.java.version>8</sling.java.version>
-        <jackrabbit.version>2.14.3</jackrabbit.version>
-        <oak.version>1.4.4</oak.version>
-        <!-- by default Slow tests are excluded - use -PincludeSlowTests to include them -->
-        <sling.excluded.surefire.groups>org.apache.sling.commons.testing.junit.categories.Slow</sling.excluded.surefire.groups>
+      <jackrabbit.version>2.12.2</jackrabbit.version>
+      <oak.version>1.4.4</oak.version>
+      <!-- by default Slow tests are excluded - use -PincludeSlowTests to include them -->
+      <sling.excluded.surefire.groups>org.apache.sling.commons.testing.junit.categories.Slow</sling.excluded.surefire.groups>
+      <sling.java.version>8</sling.java.version>
     </properties>
 
     <scm>
         <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-discovery-oak.git</connection>
         <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-discovery-oak.git</developerConnection>
         <url>https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-discovery-oak.git</url>
-        <tag>HEAD</tag>
-    </scm>
+      <tag>HEAD</tag>
+  </scm>
 
     <build>
         <plugins>
@@ -83,6 +84,35 @@
                     <excludedGroups>${sling.excluded.surefire.groups}</excludedGroups>
                 </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>
+                    <Import-Package>
+                      <!-- WebConsole support is optional -->
+                      org.apache.felix.webconsole;resolution:=optional,
+                      org.apache.felix.hc.api;resolution:=optional,
+                      *
+                    </Import-Package>
+		            <Embed-Dependency>
+		              commons-net;inline=org/apache/commons/net/util/SubnetUtils*
+		            </Embed-Dependency>
+                <Export-Package>
+                  !org.apache.sling.discovery.oak
+                </Export-Package>
+                <!-- remove when upgrading to bnd Maven plugin -->
+                <Provide-Capability><![CDATA[
+                  osgi.service;objectClass:List<String>="org.apache.sling.discovery.oak.Config,org.apache.sling.discovery.base.connectors.BaseConfig,org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteConfig"
+                ]]></Provide-Capability>
+		          </instructions>
+		        </configuration>
+            </plugin>
             <plugin>
                 <artifactId>maven-antrun-plugin</artifactId>
                 <executions>
@@ -153,30 +183,28 @@
     </profiles>
     <dependencies>
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <scope>provided</scope>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-            <scope>provided</scope>
+            <groupId>biz.aQute</groupId>
+            <artifactId>bndlib</artifactId>
+            <version>1.50.0</version>
         </dependency>
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.service.metatype.annotations</artifactId>
-            <scope>provided</scope>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+	        <version>1.6.1</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.service.component.annotations</artifactId>
-            <scope>provided</scope>
+            <artifactId>org.osgi.core</artifactId>
+            <version>4.1.0</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.service.http</artifactId>
-            <version>1.2.1</version>
-            <scope>provided</scope>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>4.1.0</version>
         </dependency>
 		<dependency>
 			<groupId>org.apache.sling</groupId>
@@ -187,6 +215,7 @@
 		<dependency>
 			<groupId>javax.jcr</groupId>
 			<artifactId>jcr</artifactId>
+			<version>2.0</version>
 			<scope>provided</scope>
 		</dependency>
 		<dependency>
@@ -198,7 +227,7 @@
 		<dependency>
 			<groupId>org.apache.sling</groupId>
 			<artifactId>org.apache.sling.commons.osgi</artifactId>
-			<version>2.4.2</version>
+			<version>2.1.0</version>
 			<scope>provided</scope>
 		</dependency>
 		<dependency>
@@ -263,10 +292,16 @@
 			<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>javax.servlet-api</artifactId>
-            <scope>provided</scope>
+			<artifactId>servlet-api</artifactId>
+            <version>2.4</version>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.httpcomponents</groupId>
@@ -286,18 +321,10 @@
             <version>3.3</version>
             <scope>provided</scope>
         </dependency>
-
       <!-- Testing -->
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-servlet</artifactId>
-            <version>8.1.2.v20120308</version>
-            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>junit-addons</groupId>
@@ -305,10 +332,14 @@
             <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-core</artifactId>
-            <version>4.4.0</version>
+            <artifactId>mockito-all</artifactId>
+            <version>1.9.5</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -363,8 +394,8 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.testing.sling-mock.junit4</artifactId>
-            <version>3.2.2</version>
+            <artifactId>org.apache.sling.testing.sling-mock</artifactId>
+            <version>1.2.0</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -373,12 +404,6 @@
         	<version>${jackrabbit.version}</version>
         	<scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.jackrabbit</groupId>
-            <artifactId>jackrabbit-spi-commons</artifactId>
-            <version>${jackrabbit.version}</version>
-            <scope>provided</scope>
-        </dependency>
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>oak-core</artifactId>
diff --git a/src/main/java/org/apache/sling/discovery/oak/Config.java b/src/main/java/org/apache/sling/discovery/oak/Config.java
index fb1f0dd..90ba296 100644
--- a/src/main/java/org/apache/sling/discovery/oak/Config.java
+++ b/src/main/java/org/apache/sling/discovery/oak/Config.java
@@ -22,68 +22,192 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.discovery.base.connectors.BaseConfig;
 import org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteConfig;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.metatype.annotations.Designate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_BACKOFF_STABLE_FACTOR;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_BACKOFF_STANDBY_FACTOR;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_CLUSTER_SYNC_SERVICE_INTERVAL;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_DISCOVERY_LITE_CHECK_INTERVAL;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_DISCOVERY_RESOURCE_PATH;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_INVERT_LEADER_ELECTION_PREFIX_ORDER;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_JOINER_DELAY_SECONDS;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_LEADER_ELECTION_PREFIX;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_MIN_EVENT_DELAY;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_SOCKET_CONNECT_TIMEOUT;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_SO_TIMEOUT;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_SUPPRESSION_TIMEOUT_SECONDS;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_SUPPRESS_PARTIALLY_STARTED_INSTANCES;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_TOPOLOGY_CONNECTOR_INTERVAL;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_TOPOLOGY_CONNECTOR_TIMEOUT;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.DEFAULT_TOPOLOGY_CONNECTOR_WHITELIST;
-import static org.apache.sling.discovery.oak.DiscoveryServiceCentralConfig.JOINER_DELAY_ENABLED_SYSTEM_PROPERTY_NAME;
-
 /**
  * Configuration object used as a central config point for the discovery service
  * implementation
  * <p>
  * The properties are described below under.
  */
-@Component(service = {Config.class, BaseConfig.class, DiscoveryLiteConfig.class})
-@Designate(ocd = DiscoveryServiceCentralConfig.class)
+@Component(metatype = true, label="%config.name", description="%config.description")
+@Service(value = { Config.class, BaseConfig.class, DiscoveryLiteConfig.class })
 public class Config implements BaseConfig, DiscoveryLiteConfig {
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
-    /**
-     * resource used to keep instance information such as last heartbeat, properties, incoming announcements
-     **/
+    /** resource used to keep instance information such as last heartbeat, properties, incoming announcements **/
     private static final String CLUSTERINSTANCES_RESOURCE = "clusterInstances";
 
-    /**
-     * resource used to store the sync tokens as part of a topology change
-     **/
+    /** resource used to store the sync tokens as part of a topology change **/
     private static final String SYNC_TOKEN_RESOURCE = "syncTokens";
 
-    /**
-     * resource used to store the clusterNodeIds to slingIds map
-     **/
+    /** resource used to store the clusterNodeIds to slingIds map **/
     private static final String ID_MAP_RESOURCE = "idMap";
 
+    /** Configure the timeout (in seconds) after which an instance is considered dead/crashed. */
+    public static final long DEFAULT_TOPOLOGY_CONNECTOR_TIMEOUT = 120;
+    @Property(longValue=DEFAULT_TOPOLOGY_CONNECTOR_TIMEOUT)
+    public static final String TOPOLOGY_CONNECTOR_TIMEOUT_KEY = "connectorPingTimeout";
+    protected long connectorPingTimeout = DEFAULT_TOPOLOGY_CONNECTOR_TIMEOUT;
+
+    /** Configure the interval (in seconds) according to which the heartbeats are exchanged in the topology. */
+    public static final long DEFAULT_TOPOLOGY_CONNECTOR_INTERVAL = 30;
+    @Property(longValue=DEFAULT_TOPOLOGY_CONNECTOR_INTERVAL)
+    public static final String TOPOLOGY_CONNECTOR_INTERVAL_KEY = "connectorPingInterval";
+    protected long connectorPingInterval = DEFAULT_TOPOLOGY_CONNECTOR_INTERVAL;
+    
+    /** Configure the interval (in seconds) according to which the heartbeats are exchanged in the topology. */
+    public static final long DEFAULT_DISCOVERY_LITE_CHECK_INTERVAL = 2;
+    @Property(longValue=DEFAULT_DISCOVERY_LITE_CHECK_INTERVAL)
+    public static final String DISCOVERY_LITE_CHECK_INTERVAL_KEY = "discoveryLiteCheckInterval";
+    protected long discoveryLiteCheckInterval = DEFAULT_DISCOVERY_LITE_CHECK_INTERVAL;
+    
+    public static final long DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT = 120;
+    @Property(longValue=DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT)
+    public static final String CLUSTER_SYNC_SERVICE_TIMEOUT_KEY = "clusterSyncServiceTimeout";
+    protected long clusterSyncServiceTimeout = DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT;
+
+    public static final long DEFAULT_CLUSTER_SYNC_SERVICE_INTERVAL = 2;
+    @Property(longValue=DEFAULT_CLUSTER_SYNC_SERVICE_INTERVAL)
+    public static final String CLUSTER_SYNC_SERVICE_INTERVAL_KEY = "clusterSyncServiceInterval";
+    protected long clusterSyncServiceInterval = DEFAULT_CLUSTER_SYNC_SERVICE_INTERVAL;
+
     /**
-     * True when auto-stop of a local-loop is enabled. Default is false.
-     **/
-    private boolean autoStopLocalLoopEnabled;
+     * If set to true a syncToken will be used on top of waiting for
+     * deactivating instances to be fully processed.
+     * If set to false, only deactivating instances will be waited for
+     * to be fully processed.
+     */
+    @Property(boolValue=true)
+    private static final String SYNC_TOKEN_ENABLED = "enableSyncToken";
+
+    /** Configure the time (in seconds) which must be passed at minimum between sending TOPOLOGY_CHANGING/_CHANGED (avoid flooding). */
+    public static final int DEFAULT_MIN_EVENT_DELAY = 3;
+    @Property(intValue=DEFAULT_MIN_EVENT_DELAY)
+    public static final String MIN_EVENT_DELAY_KEY = "minEventDelay";
+    protected int minEventDelay = DEFAULT_MIN_EVENT_DELAY;
+
+    /** Configure the socket connect timeout for topology connectors. */
+    public static final int DEFAULT_SOCKET_CONNECT_TIMEOUT = 10;
+    @Property(intValue=DEFAULT_SOCKET_CONNECT_TIMEOUT)
+    public static final String SOCKET_CONNECT_TIMEOUT_KEY = "socketConnectTimeout";
+    private int socketConnectTimeout = DEFAULT_SOCKET_CONNECT_TIMEOUT;
+
+    /** Configure the socket read timeout (SO_TIMEOUT) for topology connectors. */
+    public static final int DEFAULT_SO_TIMEOUT = 10;
+    @Property(intValue=DEFAULT_SO_TIMEOUT)
+    public static final String SO_TIMEOUT_KEY = "soTimeout";
+    private int soTimeout = DEFAULT_SO_TIMEOUT;
+
+    /** URLs where to join a topology, eg http://localhost:4502/libs/sling/topology/connector */
+    @Property(cardinality=1024)
+    public static final String TOPOLOGY_CONNECTOR_URLS_KEY = "topologyConnectorUrls";
+    private URL[] topologyConnectorUrls = {null};
+
+    /** list of ips and/or hostnames which are allowed to connect to /libs/sling/topology/connector */
+    private static final String[] DEFAULT_TOPOLOGY_CONNECTOR_WHITELIST = {"localhost","127.0.0.1"};
+    @Property(value={"localhost","127.0.0.1"})
+    public static final String TOPOLOGY_CONNECTOR_WHITELIST_KEY = "topologyConnectorWhitelist";
+    protected String[] topologyConnectorWhitelist = DEFAULT_TOPOLOGY_CONNECTOR_WHITELIST;
+
+    /** Path of resource where to keep discovery information, e.g /var/discovery/oak/ */
+    private static final String DEFAULT_DISCOVERY_RESOURCE_PATH = "/var/discovery/oak/";
+    @Property(value=DEFAULT_DISCOVERY_RESOURCE_PATH, propertyPrivate=true)
+    public static final String DISCOVERY_RESOURCE_PATH_KEY = "discoveryResourcePath";
+    protected String discoveryResourcePath = DEFAULT_DISCOVERY_RESOURCE_PATH;
+
+    /**
+     * If set to true, local-loops of topology connectors are automatically stopped when detected so.
+     */
+    @Property(boolValue=false)
+    private static final String AUTO_STOP_LOCAL_LOOP_ENABLED = "autoStopLocalLoopEnabled";
+
+    /**
+     * If set to true, request body will be gzipped - only works if counter-part accepts gzip-requests!
+     */
+    @Property(boolValue=false)
+    private static final String GZIP_CONNECTOR_REQUESTS_ENABLED = "gzipConnectorRequestsEnabled";
+
+    /**
+     * If set to true, hmac is enabled and the white list is disabled.
+     */
+    @Property(boolValue=false)
+    private static final String HMAC_ENABLED = "hmacEnabled";
+
+    /**
+     * If set to true, and the whitelist is disabled, messages will be encrypted.
+     */
+    @Property(boolValue=false)
+    private static final String ENCRYPTION_ENABLED = "enableEncryption";
+
+    /**
+     * The value fo the shared key, shared amongst all instances in the same cluster.
+     */
+    @Property
+    private static final String SHARED_KEY = "sharedKey";
+
+    /**
+     * The default lifetime of a HMAC shared key in ms. (4h)
+     */
+    private static final long DEFAULT_SHARED_KEY_INTERVAL = 3600*1000*4;
 
+    @Property(longValue=DEFAULT_SHARED_KEY_INTERVAL)
+    private static final String SHARED_KEY_INTERVAL = "hmacSharedKeyTTL";
+    
+    /**
+     * The property for defining the backoff factor for standby (loop) connectors
+     */
+    @Property
+    private static final String BACKOFF_STANDBY_FACTOR = "backoffStandbyFactor";
+    private static final int DEFAULT_BACKOFF_STANDBY_FACTOR = 5;
+    
+    /**
+     * The property for defining the maximum backoff factor for stable connectors
+     */
+    @Property
+    private static final String BACKOFF_STABLE_FACTOR = "backoffStableFactor";
+    private static final int DEFAULT_BACKOFF_STABLE_FACTOR = 5;
+
+    private static final long DEFAULT_LEADER_ELECTION_PREFIX = 1;
+    @Property(longValue=DEFAULT_LEADER_ELECTION_PREFIX)
+    private static final String LEADER_ELECTION_PREFIX = "leaderElectionPrefix";
+    protected long leaderElectionPrefix = DEFAULT_LEADER_ELECTION_PREFIX;
+
+    private static final boolean DEFAULT_INVERT_LEADER_ELECTION_PREFIX_ORDER = false;
+    @Property(boolValue=DEFAULT_INVERT_LEADER_ELECTION_PREFIX_ORDER)
+    private static final String INVERT_LEADER_ELECTION_PREFIX_ORDER = "invertLeaderElectionPrefixOrder";
+    protected boolean invertLeaderElectionPrefixOrder = DEFAULT_INVERT_LEADER_ELECTION_PREFIX_ORDER;
+    
+    private static final boolean DEFAULT_SUPPRESS_PARTIALLY_STARTED_INSTANCES = false;
+    @Property(boolValue=DEFAULT_SUPPRESS_PARTIALLY_STARTED_INSTANCES)
+    private static final String SUPPRESS_PARTIALLY_STARTED_INSTANCES = "suppressPartiallyStartedInstance";
+    protected boolean suppressPartiallyStartedInstance = DEFAULT_SUPPRESS_PARTIALLY_STARTED_INSTANCES;
+    private static final String JOINER_DELAY_ENABLED_SYSTEM_PROPERTY_NAME = "org.apache.sling.discovery.oak.joinerdelay.enabled";
+
+    private static final long DEFAULT_SUPPRESSION_TIMEOUT_SECONDS = -1;
+    @Property(longValue=DEFAULT_SUPPRESSION_TIMEOUT_SECONDS)
+    private static final String SUPPRESSION_TIMEOUT_SECONDS = "suppressionTimeoutSeconds";
+    protected long suppressionTimeoutSeconds = DEFAULT_SUPPRESSION_TIMEOUT_SECONDS;
+
+    private static final long DEFAULT_JOINER_DELAY_SECONDS = 0;
+    @Property(longValue=DEFAULT_JOINER_DELAY_SECONDS)
+    private static final String JOINER_DELAY_SECONDS = "joinerDelaySeconds";
+    protected long joinerDelaySeconds = DEFAULT_JOINER_DELAY_SECONDS;
+
+    /** True when auto-stop of a local-loop is enabled. Default is false. **/
+    private boolean autoStopLocalLoopEnabled;
+    
     /**
      * True when the hmac is enabled and signing is disabled.
      */
@@ -103,105 +227,105 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
      * true when encryption is enabled.
      */
     private boolean encryptionEnabled;
-
+    
     /**
      * true when topology connector requests should be gzipped
      */
     private boolean gzipConnectorRequestsEnabled;
 
-    /**
-     * the backoff factor to be used for standby (loop) connectors
-     **/
+    /** the backoff factor to be used for standby (loop) connectors **/
     private int backoffStandbyFactor = DEFAULT_BACKOFF_STANDBY_FACTOR;
-
-    /**
-     * the maximum backoff factor to be used for stable connectors
-     **/
+    
+    /** the maximum backoff factor to be used for stable connectors **/
     private int backoffStableFactor = DEFAULT_BACKOFF_STABLE_FACTOR;
-
+    
     /**
      * Whether, on top of waiting for deactivating instances,
      * a syncToken should also be used
      */
     private boolean syncTokenEnabled;
 
-    /**
-     * only check system property JOINER_DELAY_ENABLED_SYSTEM_PROPERTY_NAME every 5 minutes, here's to the next check
-     */
+    /** only check system property JOINER_DELAY_ENABLED_SYSTEM_PROPERTY_NAME every 5 minutes, here's to the next check */
     private long joinerDelayOverwriteNextCheck;
 
-    /**
-     * cache of last read of system property JOINER_DELAY_ENABLED_SYSTEM_PROPERTY_NAME
-     **/
+    /** cache of last read of system property JOINER_DELAY_ENABLED_SYSTEM_PROPERTY_NAME **/
     private boolean joinerDelayOverwrite;
 
-    protected long connectorPingTimeout = DEFAULT_TOPOLOGY_CONNECTOR_TIMEOUT;
-    protected long connectorPingInterval = DEFAULT_TOPOLOGY_CONNECTOR_INTERVAL;
-    protected long discoveryLiteCheckInterval = DEFAULT_DISCOVERY_LITE_CHECK_INTERVAL;
-    protected long clusterSyncServiceTimeout = DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT;
-    protected long clusterSyncServiceInterval = DEFAULT_CLUSTER_SYNC_SERVICE_INTERVAL;
-    protected int minEventDelay = DEFAULT_MIN_EVENT_DELAY;
-    private int socketConnectTimeout = DEFAULT_SOCKET_CONNECT_TIMEOUT;
-    private int soTimeout = DEFAULT_SO_TIMEOUT;
-    private URL[] topologyConnectorUrls = {null};
-    protected String[] topologyConnectorWhitelist = DEFAULT_TOPOLOGY_CONNECTOR_WHITELIST;
-    protected String discoveryResourcePath = DEFAULT_DISCOVERY_RESOURCE_PATH;
-
-    protected long leaderElectionPrefix = DEFAULT_LEADER_ELECTION_PREFIX;
-    protected boolean invertLeaderElectionPrefixOrder = DEFAULT_INVERT_LEADER_ELECTION_PREFIX_ORDER;
-    protected boolean suppressPartiallyStartedInstance = DEFAULT_SUPPRESS_PARTIALLY_STARTED_INSTANCES;
-    protected long suppressionTimeoutSeconds = DEFAULT_SUPPRESSION_TIMEOUT_SECONDS;
-    protected long joinerDelaySeconds = DEFAULT_JOINER_DELAY_SECONDS;
-
     @Activate
-    protected void activate(BundleContext context, DiscoveryServiceCentralConfig config) {
-        logger.debug("activate: config activated.");
-        configure(config);
-    }
-
-    protected void configure(final DiscoveryServiceCentralConfig config) {
-        this.connectorPingTimeout = config.connectorPingTimeout();
-        logger.debug("configure: connectorPingTimeout='{}'", this.connectorPingTimeout);
-
-        this.connectorPingInterval = config.connectorPingInterval();
-        logger.debug("configure: connectorPingInterval='{}'", this.connectorPingInterval);
-
-        this.discoveryLiteCheckInterval = config.discoveryLiteCheckInterval();
-        logger.debug("configure: discoveryLiteCheckInterval='{}'", this.discoveryLiteCheckInterval);
-
-        this.clusterSyncServiceTimeout = config.clusterSyncServiceTimeout();
-        logger.debug("configure: clusterSyncServiceTimeout='{}'", this.clusterSyncServiceTimeout);
-
-        this.clusterSyncServiceInterval = config.clusterSyncServiceInterval();
-        logger.debug("configure: clusterSyncServiceInterval='{}'", this.clusterSyncServiceInterval);
-
-        this.minEventDelay = config.minEventDelay();
-        logger.debug("configure: minEventDelay='{}'", this.minEventDelay);
-
-        this.socketConnectTimeout = config.socketConnectTimeout();
-        logger.debug("configure: socketConnectTimeout='{}'", this.socketConnectTimeout);
-
-        this.soTimeout = config.soTimeout();
-        logger.debug("configure: soTimeout='{}'", this.soTimeout);
-
-        String[] topologyConnectorUrlsStr = config.topologyConnectorUrls();
-        if (topologyConnectorUrlsStr != null && topologyConnectorUrlsStr.length > 0) {
-            List<URL> urls = new LinkedList<>();
+    protected void activate(final Map<String, Object> properties) {
+		logger.debug("activate: config activated.");
+        configure(properties);
+    }
+
+    protected void configure(final Map<String, Object> properties) {
+        this.connectorPingTimeout = PropertiesUtil.toLong(
+                properties.get(TOPOLOGY_CONNECTOR_TIMEOUT_KEY),
+                DEFAULT_TOPOLOGY_CONNECTOR_TIMEOUT);
+        logger.debug("configure: connectorPingTimeout='{}'", 
+                this.connectorPingTimeout);
+
+        this.connectorPingInterval = PropertiesUtil.toLong(
+                properties.get(TOPOLOGY_CONNECTOR_INTERVAL_KEY),
+                DEFAULT_TOPOLOGY_CONNECTOR_INTERVAL);
+        logger.debug("configure: connectorPingInterval='{}'",
+                this.connectorPingInterval);
+        
+        this.discoveryLiteCheckInterval = PropertiesUtil.toLong(
+                properties.get(DISCOVERY_LITE_CHECK_INTERVAL_KEY),
+                DEFAULT_DISCOVERY_LITE_CHECK_INTERVAL);
+        logger.debug("configure: discoveryLiteCheckInterval='{}'",
+                this.discoveryLiteCheckInterval);
+                
+        this.clusterSyncServiceTimeout = PropertiesUtil.toLong(
+                properties.get(CLUSTER_SYNC_SERVICE_TIMEOUT_KEY),
+                DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT);
+        logger.debug("configure: clusterSyncServiceTimeout='{}'",
+                this.clusterSyncServiceTimeout);
+
+        this.clusterSyncServiceInterval = PropertiesUtil.toLong(
+                properties.get(CLUSTER_SYNC_SERVICE_INTERVAL_KEY),
+                DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT);
+        logger.debug("configure: clusterSyncServiceInterval='{}'",
+                this.clusterSyncServiceInterval);
+
+        this.minEventDelay = PropertiesUtil.toInteger(
+                properties.get(MIN_EVENT_DELAY_KEY),
+                DEFAULT_MIN_EVENT_DELAY);
+        logger.debug("configure: minEventDelay='{}'",
+                this.minEventDelay);
+        
+        this.socketConnectTimeout = PropertiesUtil.toInteger(
+                properties.get(SOCKET_CONNECT_TIMEOUT_KEY),
+                DEFAULT_SOCKET_CONNECT_TIMEOUT);
+        logger.debug("configure: socketConnectTimeout='{}'",
+                this.socketConnectTimeout);
+        
+        this.soTimeout = PropertiesUtil.toInteger(
+                properties.get(SO_TIMEOUT_KEY),
+                DEFAULT_SO_TIMEOUT);
+        logger.debug("configure: soTimeout='{}'",
+                this.soTimeout);
+        
+        
+        String[] topologyConnectorUrlsStr = PropertiesUtil.toStringArray(
+                properties.get(TOPOLOGY_CONNECTOR_URLS_KEY), null);
+        if (topologyConnectorUrlsStr!=null && topologyConnectorUrlsStr.length > 0) {
+            List<URL> urls = new LinkedList<URL>();
             for (int i = 0; i < topologyConnectorUrlsStr.length; i++) {
                 String anUrlStr = topologyConnectorUrlsStr[i];
                 try {
-                    if (anUrlStr != null && anUrlStr.length() > 0) {
-                        URL url = new URL(anUrlStr);
-                        logger.debug("configure: a topologyConnectorbUrl='{}'",
-                                url);
-                        urls.add(url);
-                    }
+                	if (anUrlStr!=null && anUrlStr.length()>0) {
+	                    URL url = new URL(anUrlStr);
+	                    logger.debug("configure: a topologyConnectorbUrl='{}'",
+	                            url);
+	                    urls.add(url);
+                	}
                 } catch (MalformedURLException e) {
                     logger.error("configure: could not set a topologyConnectorUrl: " + e,
                             e);
                 }
             }
-            if (urls.size() > 0) {
+            if (urls.size()>0) {
                 this.topologyConnectorUrls = urls.toArray(new URL[urls.size()]);
                 logger.debug("configure: number of topologyConnectorUrls='{}''",
                         urls.size());
@@ -213,50 +337,73 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
             this.topologyConnectorUrls = null;
             logger.debug("configure: no (valid) topologyConnectorUrls configured");
         }
-        this.topologyConnectorWhitelist = config.topologyConnectorWhitelist();
-        logger.debug("configure: topologyConnectorWhitelist='{}'", this.topologyConnectorWhitelist);
-
-        this.discoveryResourcePath = config.discoveryResourcePath();
-        while (this.discoveryResourcePath.endsWith("/")) {
-            this.discoveryResourcePath = this.discoveryResourcePath.substring(0, this.discoveryResourcePath.length() - 1);
+        this.topologyConnectorWhitelist = PropertiesUtil.toStringArray(
+                properties.get(TOPOLOGY_CONNECTOR_WHITELIST_KEY),
+                DEFAULT_TOPOLOGY_CONNECTOR_WHITELIST);
+        logger.debug("configure: topologyConnectorWhitelist='{}'",
+                this.topologyConnectorWhitelist);
+
+        this.discoveryResourcePath = PropertiesUtil.toString(
+                properties.get(DISCOVERY_RESOURCE_PATH_KEY),
+                "");
+        while(this.discoveryResourcePath.endsWith("/")) {
+            this.discoveryResourcePath = this.discoveryResourcePath.substring(0,
+                    this.discoveryResourcePath.length()-1);
         }
         this.discoveryResourcePath = this.discoveryResourcePath + "/";
-        if (this.discoveryResourcePath == null || this.discoveryResourcePath.length() <= 1) {
+        if (this.discoveryResourcePath==null || this.discoveryResourcePath.length()<=1) {
             // if the path is empty, or /, then use the default
             this.discoveryResourcePath = DEFAULT_DISCOVERY_RESOURCE_PATH;
         }
-        logger.debug("configure: discoveryResourcePath='{}'", this.discoveryResourcePath);
-
-        autoStopLocalLoopEnabled = config.autoStopLocalLoopEnabled();
-        gzipConnectorRequestsEnabled = config.gzipConnectorRequestsEnabled();
-        hmacEnabled = config.hmacEnabled();
-        encryptionEnabled = config.enableEncryption();
-        syncTokenEnabled = config.enableSyncToken();
-        sharedKey = config.sharedKey();
-        keyInterval = config.hmacSharedKeyTTL();
-
-        backoffStandbyFactor = config.backoffStandbyFactor();
-        backoffStableFactor = config.backoffStableFactor();
-
-        this.invertLeaderElectionPrefixOrder = config.invertLeaderElectionPrefixOrder();
-        logger.debug("configure: invertLeaderElectionPrefixOrder='{}'", this.invertLeaderElectionPrefixOrder);
-
-        this.leaderElectionPrefix = config.leaderElectionPrefix();
-        logger.debug("configure: leaderElectionPrefix='{}'",  this.leaderElectionPrefix);
-
-        this.suppressPartiallyStartedInstance = config.suppressPartiallyStartedInstance();
-        logger.debug("configure: suppressPartiallyStartedInstance='{}'", this.suppressPartiallyStartedInstance);
-
-        this.suppressionTimeoutSeconds = config.suppressionTimeoutSeconds();
-        logger.debug("configure: suppressionTimeoutSeconds='{}'", this.suppressionTimeoutSeconds);
-
-        this.joinerDelaySeconds = config.joinerDelaySeconds();
-        logger.debug("configure: joinerDelaySeconds='{}'", this.joinerDelaySeconds);
+        logger.debug("configure: discoveryResourcePath='{}'",
+                this.discoveryResourcePath);
+
+        autoStopLocalLoopEnabled = PropertiesUtil.toBoolean(properties.get(AUTO_STOP_LOCAL_LOOP_ENABLED), false);
+        gzipConnectorRequestsEnabled = PropertiesUtil.toBoolean(properties.get(GZIP_CONNECTOR_REQUESTS_ENABLED), false);
+        
+        hmacEnabled = PropertiesUtil.toBoolean(properties.get(HMAC_ENABLED), true);
+        encryptionEnabled = PropertiesUtil.toBoolean(properties.get(ENCRYPTION_ENABLED), false);
+        syncTokenEnabled = PropertiesUtil.toBoolean(properties.get(SYNC_TOKEN_ENABLED), true);
+        sharedKey = PropertiesUtil.toString(properties.get(SHARED_KEY), null);
+        keyInterval = PropertiesUtil.toLong(SHARED_KEY_INTERVAL, DEFAULT_SHARED_KEY_INTERVAL);
+        
+        backoffStandbyFactor = PropertiesUtil.toInteger(properties.get(BACKOFF_STANDBY_FACTOR), 
+                DEFAULT_BACKOFF_STANDBY_FACTOR);
+        backoffStableFactor = PropertiesUtil.toInteger(properties.get(BACKOFF_STABLE_FACTOR), 
+                DEFAULT_BACKOFF_STABLE_FACTOR);
+
+        this.invertLeaderElectionPrefixOrder = PropertiesUtil.toBoolean(
+                properties.get(INVERT_LEADER_ELECTION_PREFIX_ORDER),
+                DEFAULT_INVERT_LEADER_ELECTION_PREFIX_ORDER);
+        logger.debug("configure: invertLeaderElectionPrefixOrder='{}'",
+                this.invertLeaderElectionPrefixOrder);
+        this.leaderElectionPrefix = PropertiesUtil.toLong(
+                properties.get(LEADER_ELECTION_PREFIX),
+                DEFAULT_LEADER_ELECTION_PREFIX);
+        logger.debug("configure: leaderElectionPrefix='{}'",
+                this.leaderElectionPrefix);
+
+        this.suppressPartiallyStartedInstance = PropertiesUtil.toBoolean(
+                properties.get(SUPPRESS_PARTIALLY_STARTED_INSTANCES),
+                DEFAULT_SUPPRESS_PARTIALLY_STARTED_INSTANCES);
+        logger.debug("configure: suppressPartiallyStartedInstance='{}'",
+                this.suppressPartiallyStartedInstance);
+
+        this.suppressionTimeoutSeconds = PropertiesUtil.toLong(
+                properties.get(SUPPRESSION_TIMEOUT_SECONDS),
+                DEFAULT_SUPPRESSION_TIMEOUT_SECONDS);
+        logger.debug("configure: suppressionTimeoutSeconds='{}'",
+                this.suppressionTimeoutSeconds);
+
+        this.joinerDelaySeconds = PropertiesUtil.toLong(
+                properties.get(JOINER_DELAY_SECONDS),
+                DEFAULT_JOINER_DELAY_SECONDS);
+        logger.debug("configure: joinerDelaySeconds='{}'",
+                this.joinerDelaySeconds);
     }
 
     /**
      * 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 getSocketConnectTimeout() {
@@ -265,16 +412,14 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
 
     /**
      * 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() {
         return soTimeout;
     }
-
+    
     /**
      * Returns the minimum time (in seconds) between sending TOPOLOGY_CHANGING/_CHANGED events - to avoid flooding
-     *
      * @return the minimum time (in seconds) between sending TOPOLOGY_CHANGING/_CHANGED events - to avoid flooding
      */
     public int getMinEventDelay() {
@@ -284,7 +429,6 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
     /**
      * 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
      */
@@ -295,21 +439,19 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
     /**
      * 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() {
         return topologyConnectorWhitelist;
     }
-
+    
     protected String getDiscoveryResourcePath() {
         return discoveryResourcePath;
     }
 
     /**
      * Returns the resource path where cluster instance informations are stored.
-     *
      * @return the resource path where cluster instance informations are stored
      */
     public String getClusterInstancesPath() {
@@ -353,7 +495,7 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
     public boolean isEncryptionEnabled() {
         return encryptionEnabled;
     }
-
+    
     /**
      * @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+)
@@ -361,7 +503,7 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
     public boolean isGzipConnectorRequestsEnabled() {
         return gzipConnectorRequestsEnabled;
     }
-
+    
     /**
      * @return true if the auto-stopping of local-loop topology connectors is enabled.
      */
@@ -371,7 +513,6 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
 
     /**
      * 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() {
@@ -380,7 +521,6 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
 
     /**
      * 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() {
@@ -389,12 +529,11 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
 
     /**
      * Returns the backoff interval for standby (loop) connectors in seconds
-     *
      * @return the backoff interval for standby (loop) connectors in seconds
      */
     public long getBackoffStandbyInterval() {
         final int factor = getBackoffStandbyFactor();
-        if (factor <= 1) {
+        if (factor<=1) {
             return -1;
         } else {
             return factor * getConnectorPingInterval();
@@ -405,16 +544,16 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
     public long getConnectorPingInterval() {
         return connectorPingInterval;
     }
-
+    
     @Override
     public long getConnectorPingTimeout() {
         return connectorPingTimeout;
     }
-
+    
     public long getDiscoveryLiteCheckInterval() {
         return discoveryLiteCheckInterval;
     }
-
+    
     @Override
     public long getClusterSyncServiceTimeoutMillis() {
         return clusterSyncServiceTimeout * 1000;
@@ -424,7 +563,7 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
     public long getClusterSyncServiceIntervalMillis() {
         return clusterSyncServiceInterval * 1000;
     }
-
+    
     public boolean getSyncTokenEnabled() {
         return syncTokenEnabled;
     }
@@ -440,7 +579,6 @@ public class Config implements BaseConfig, DiscoveryLiteConfig {
     /**
      * Checks if the system property JOIN_DELAY_SYSTEM_PROPERTY_NAME is set
      * and uses that value. Otherwise uses the provided default.
-     *
      * @param configValue the provided default to be used unless the system property is set
      * @return the overwritten value to be used as the actual config value
      */
diff --git a/src/main/java/org/apache/sling/discovery/oak/DiscoveryServiceCentralConfig.java b/src/main/java/org/apache/sling/discovery/oak/DiscoveryServiceCentralConfig.java
deleted file mode 100644
index 5e27a9f..0000000
--- a/src/main/java/org/apache/sling/discovery/oak/DiscoveryServiceCentralConfig.java
+++ /dev/null
@@ -1,175 +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.sling.discovery.oak;
-
-import org.osgi.service.metatype.annotations.ObjectClassDefinition;
-import org.osgi.service.metatype.annotations.AttributeDefinition;
-
-@SuppressWarnings("java:S100")
-@ObjectClassDefinition(name = "%config.name", description = "%config.description")
-public @interface DiscoveryServiceCentralConfig {
-
-    long DEFAULT_TOPOLOGY_CONNECTOR_TIMEOUT = 120;
-    long DEFAULT_TOPOLOGY_CONNECTOR_INTERVAL = 30;
-    long DEFAULT_DISCOVERY_LITE_CHECK_INTERVAL = 2;
-    long DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT = 120;
-    long DEFAULT_CLUSTER_SYNC_SERVICE_INTERVAL = 2;
-    int DEFAULT_MIN_EVENT_DELAY = 3;
-    int DEFAULT_SOCKET_CONNECT_TIMEOUT = 10;
-    int DEFAULT_SO_TIMEOUT = 10;
-    int DEFAULT_BACKOFF_STANDBY_FACTOR = 5;
-    int DEFAULT_BACKOFF_STABLE_FACTOR = 5;
-    long DEFAULT_LEADER_ELECTION_PREFIX = 1;
-    String[] DEFAULT_TOPOLOGY_CONNECTOR_WHITELIST = {"localhost", "127.0.0.1"};
-    String DEFAULT_DISCOVERY_RESOURCE_PATH = "/var/discovery/oak/";
-
-    boolean DEFAULT_INVERT_LEADER_ELECTION_PREFIX_ORDER = false;
-    boolean DEFAULT_SUPPRESS_PARTIALLY_STARTED_INSTANCES = false;
-    String JOINER_DELAY_ENABLED_SYSTEM_PROPERTY_NAME = "org.apache.sling.discovery.oak.joinerdelay.enabled";
-    long DEFAULT_SUPPRESSION_TIMEOUT_SECONDS = -1;
-    long DEFAULT_JOINER_DELAY_SECONDS = 0;
-    /**
-     * The default lifetime of a HMAC shared key in ms. (4h)
-     */
-    long DEFAULT_SHARED_KEY_INTERVAL = 3600 * 1000 * 4;
-
-    /**
-     * Configure the timeout (in seconds) after which an instance is considered dead/crashed.
-     */
-    @AttributeDefinition
-    long connectorPingTimeout() default DEFAULT_TOPOLOGY_CONNECTOR_TIMEOUT;
-
-    /**
-     * Configure the interval (in seconds) according to which the heartbeats are exchanged in the topology.
-     */
-    @AttributeDefinition
-    long connectorPingInterval() default DEFAULT_TOPOLOGY_CONNECTOR_INTERVAL;
-
-    @AttributeDefinition
-    long discoveryLiteCheckInterval() default DEFAULT_DISCOVERY_LITE_CHECK_INTERVAL;
-
-    @AttributeDefinition
-    long clusterSyncServiceTimeout() default DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT;
-
-    @AttributeDefinition
-    long clusterSyncServiceInterval() default DEFAULT_CLUSTER_SYNC_SERVICE_INTERVAL;
-
-    /**
-     * If set to true a syncToken will be used on top of waiting for deactivating instances to be fully processed.
-     * If set to false, only deactivating instances will be waited for to be fully processed.
-     */
-    @AttributeDefinition
-    boolean enableSyncToken() default true;
-
-    /**
-     * Configure the time (in seconds) which must be passed at minimum between sending TOPOLOGY_CHANGING/_CHANGED (avoid flooding).
-     */
-    @AttributeDefinition
-    int minEventDelay() default DEFAULT_MIN_EVENT_DELAY;
-
-    /**
-     * Configure the socket connect timeout for topology connectors.
-     */
-    @AttributeDefinition
-    int socketConnectTimeout() default DEFAULT_SOCKET_CONNECT_TIMEOUT;
-
-    /**
-     * Configure the socket read timeout (SO_TIMEOUT) for topology connectors.
-     */
-    @AttributeDefinition
-    int soTimeout() default DEFAULT_SO_TIMEOUT;
-
-    /**
-     * URLs where to join a topology, eg http://localhost:4502/libs/sling/topology/connector
-     */
-    @AttributeDefinition (cardinality = 1024)
-    String[] topologyConnectorUrls() default {};
-
-    /**
-     * list of ips and/or hostnames which are allowed to connect to /libs/sling/topology/connector
-     */
-    @AttributeDefinition (cardinality = 1024)
-    String[] topologyConnectorWhitelist() default {"localhost", "127.0.0.1"};
-
-    /**
-     * Path of resource where to keep discovery information, e.g /var/discovery/oak/
-     */
-    @AttributeDefinition
-    String discoveryResourcePath() default DEFAULT_DISCOVERY_RESOURCE_PATH;
-
-    /**
-     * If set to true, local-loops of topology connectors are automatically stopped when detected so.
-     */
-    @AttributeDefinition
-    boolean autoStopLocalLoopEnabled() default false;
-
-    /**
-     * If set to true, request body will be gzipped - only works if counter-part accepts gzip-requests!
-     */
-    @AttributeDefinition
-    boolean gzipConnectorRequestsEnabled() default false;
-
-    /**
-     * If set to true, hmac is enabled and the white list is disabled.
-     */
-    @AttributeDefinition
-    boolean hmacEnabled() default false;
-
-    /**
-     * If set to true, and the whitelist is disabled, messages will be encrypted.
-     */
-    @AttributeDefinition
-    boolean enableEncryption() default false;
-
-    /**
-     * The value fo the shared key, shared amongst all instances in the same cluster.
-     */
-    @AttributeDefinition
-    String sharedKey() default "";
-
-    @AttributeDefinition
-    long hmacSharedKeyTTL() default DEFAULT_SHARED_KEY_INTERVAL;
-
-    /**
-     * The property for defining the backoff factor for standby (loop) connectors
-     */
-    @AttributeDefinition
-    int backoffStandbyFactor() default DEFAULT_BACKOFF_STANDBY_FACTOR;
-
-    /**
-     * The property for defining the maximum backoff factor for stable connectors
-     */
-    @AttributeDefinition
-    int backoffStableFactor() default DEFAULT_BACKOFF_STABLE_FACTOR;
-
-    @AttributeDefinition
-    long leaderElectionPrefix() default DEFAULT_LEADER_ELECTION_PREFIX;
-
-    @AttributeDefinition
-    boolean invertLeaderElectionPrefixOrder() default DEFAULT_INVERT_LEADER_ELECTION_PREFIX_ORDER;
-
-    @AttributeDefinition
-    boolean suppressPartiallyStartedInstance() default DEFAULT_SUPPRESS_PARTIALLY_STARTED_INSTANCES;
-
-    @AttributeDefinition
-    long suppressionTimeoutSeconds() default DEFAULT_SUPPRESSION_TIMEOUT_SECONDS;
-
-    @AttributeDefinition
-    long joinerDelaySeconds() default DEFAULT_JOINER_DELAY_SECONDS;
-}
diff --git a/src/main/java/org/apache/sling/discovery/oak/OakDiscoveryService.java b/src/main/java/org/apache/sling/discovery/oak/OakDiscoveryService.java
index d98e1b2..19f8ebb 100644
--- a/src/main/java/org/apache/sling/discovery/oak/OakDiscoveryService.java
+++ b/src/main/java/org/apache/sling/discovery/oak/OakDiscoveryService.java
@@ -32,6 +32,13 @@ import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.locks.ReentrantLock;
 
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.ModifiableValueMap;
 import org.apache.sling.api.resource.PersistenceException;
@@ -67,12 +74,6 @@ import org.apache.sling.settings.SlingSettingsService;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.osgi.service.component.annotations.ReferencePolicy;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -81,7 +82,8 @@ import org.slf4j.LoggerFactory;
  * implementation for detecting changes in a cluster and only supports one
  * cluster (of which this instance is part of).
  */
-@Component(immediate = true, service = {DiscoveryService.class, OakDiscoveryService.class})
+@Component(immediate = true)
+@Service(value = { DiscoveryService.class, OakDiscoveryService.class })
 public class OakDiscoveryService extends BaseDiscoveryService {
 
     private final static Logger logger = LoggerFactory.getLogger(OakDiscoveryService.class);
@@ -89,18 +91,20 @@ public class OakDiscoveryService extends BaseDiscoveryService {
     @Reference
     private SlingSettingsService settingsService;
 
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC, referenceInterface = TopologyEventListener.class)
+    private TopologyEventListener[] eventListeners = new TopologyEventListener[0];
+
     /**
      * All property providers.
      */
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, policy = ReferencePolicy.DYNAMIC, referenceInterface = PropertyProvider.class, updated = "updatedPropertyProvider")
     private List<ProviderInfo> providerInfos = new ArrayList<ProviderInfo>();
 
-    /**
-     * lock object used for syncing bind/unbind and topology event sending
-     **/
+    /** lock object used for synching bind/unbind and topology event sending **/
     private final Object lock = new Object();
 
     /**
-     * whether this service is activated - necessary to avoid sending
+     * whether or not this service is activated - necessary to avoid sending
      * events to discovery awares before activate is done
      **/
     private volatile boolean activated = false;
@@ -135,9 +139,7 @@ public class OakDiscoveryService extends BaseDiscoveryService {
     @Reference
     private SyncTokenService syncTokenService;
 
-    /**
-     * the slingId of the local instance
-     **/
+    /** the slingId of the local instance **/
     private String slingId;
 
     private ServiceRegistration mbeanRegistration;
@@ -162,16 +164,16 @@ public class OakDiscoveryService extends BaseDiscoveryService {
     };
 
     public static OakDiscoveryService testConstructor(SlingSettingsService settingsService,
-                                                      AnnouncementRegistry announcementRegistry,
-                                                      ConnectorRegistry connectorRegistry,
-                                                      ClusterViewService clusterViewService,
-                                                      Config config,
-                                                      OakViewChecker connectorPinger,
-                                                      Scheduler scheduler,
-                                                      IdMapService idMapService,
-                                                      OakBacklogClusterSyncService oakBacklogClusterSyncService,
-                                                      SyncTokenService syncTokenService,
-                                                      ResourceResolverFactory factory) {
+            AnnouncementRegistry announcementRegistry,
+            ConnectorRegistry connectorRegistry,
+            ClusterViewService clusterViewService,
+            Config config,
+            OakViewChecker connectorPinger,
+            Scheduler scheduler,
+            IdMapService idMapService,
+            OakBacklogClusterSyncService oakBacklogClusterSyncService,
+            SyncTokenService syncTokenService,
+            ResourceResolverFactory factory) {
         OakDiscoveryService discoService = new OakDiscoveryService();
         discoService.settingsService = settingsService;
         discoService.announcementRegistry = announcementRegistry;
@@ -189,7 +191,7 @@ public class OakDiscoveryService extends BaseDiscoveryService {
 
     @Override
     protected void handleIsolatedFromTopology() {
-        if (oakViewChecker != null) {
+        if (oakViewChecker!=null) {
             // SLING-5030 part 2: when we detect being isolated we should
             // step at the end of the leader-election queue and
             // that can be achieved by resetting the leaderElectionId
@@ -237,20 +239,22 @@ public class OakDiscoveryService extends BaseDiscoveryService {
         }
         viewStateManager = ViewStateManagerFactory.newViewStateManager(viewStateManagerLock, consistencyService);
 
-        if (config.getMinEventDelay() > 0) {
+        if (config.getMinEventDelay()>0) {
             viewStateManager.installMinEventDelayHandler(this, scheduler, config.getMinEventDelay());
         }
 
         final String isolatedClusterId = UUID.randomUUID().toString();
         {
-            // create a pre-voting/isolated topologyView which would be used until the first voting has finished.
+            // create a pre-voting/isolated topologyView which would be used
+            // until the first voting has finished.
             // this way for the single-instance case the clusterId can
-            // remain the same between a getTopology() that is invoked before the first TOPOLOGY_INIT and afterwards
+            // remain the same between a getTopology() that is invoked before
+            // the first TOPOLOGY_INIT and afterwards
             DefaultClusterView isolatedCluster = new DefaultClusterView(isolatedClusterId);
-            Map<String, String> emptyProperties = new HashMap<>();
+            Map<String, String> emptyProperties = new HashMap<String, String>();
             DefaultInstanceDescription isolatedInstance =
                     new DefaultInstanceDescription(isolatedCluster, true, true, slingId, emptyProperties);
-            Collection<InstanceDescription> col = new ArrayList<>();
+            Collection<InstanceDescription> col = new ArrayList<InstanceDescription>();
             col.add(isolatedInstance);
             final DefaultTopologyView topology = new DefaultTopologyView();
             topology.addInstances(col);
@@ -267,7 +271,7 @@ public class OakDiscoveryService extends BaseDiscoveryService {
         oakViewChecker.initialize(this);
 
         viewStateManagerLock.lock();
-        try {
+        try{
             viewStateManager.handleActivated();
 
             doUpdateProperties();
@@ -291,7 +295,7 @@ public class OakDiscoveryService extends BaseDiscoveryService {
 
             viewStateManager.bind(changePropagationListener);
         } finally {
-            if (viewStateManagerLock != null) {
+            if (viewStateManagerLock!=null) {
                 viewStateManagerLock.unlock();
             }
         }
@@ -300,13 +304,13 @@ public class OakDiscoveryService extends BaseDiscoveryService {
         if (topologyConnectorURLs != null) {
             for (int i = 0; i < topologyConnectorURLs.length; i++) {
                 final URL aURL = topologyConnectorURLs[i];
-                if (aURL != null) {
-                    try {
-                        logger.info("activate: registering outgoing topology connector to " + aURL);
-                        connectorRegistry.registerOutgoingConnector(clusterViewService, aURL);
-                    } catch (final Exception e) {
-                        logger.info("activate: could not register url: " + aURL + " due to: " + e, e);
-                    }
+                if (aURL!=null) {
+                	try{
+                		logger.info("activate: registering outgoing topology connector to "+aURL);
+                		connectorRegistry.registerOutgoingConnector(clusterViewService, aURL);
+                	} catch (final Exception e) {
+                		logger.info("activate: could not register url: "+aURL+" due to: "+e, e);
+                	}
                 }
             }
         }
@@ -321,45 +325,40 @@ public class OakDiscoveryService extends BaseDiscoveryService {
     protected void deactivate() {
         logger.debug("OakDiscoveryService deactivated.");
         viewStateManagerLock.lock();
-        try {
+        try{
             viewStateManager.unbind(changePropagationListener);
 
             viewStateManager.handleDeactivated();
 
             activated = false;
         } finally {
-            if (viewStateManagerLock != null) {
+            if (viewStateManagerLock!=null) {
                 viewStateManagerLock.unlock();
             }
         }
-        try {
-            if (this.mbeanRegistration != null) {
+        try{
+            if ( this.mbeanRegistration != null ) {
                 this.mbeanRegistration.unregister();
                 this.mbeanRegistration = null;
             }
-        } catch (Exception e) {
-            logger.error("deactivate: Error on unregister: " + e, e);
+        } catch(Exception e) {
+            logger.error("deactivate: Error on unregister: "+e, e);
         }
     }
 
     /**
      * bind a topology event listener
      */
-    @Reference(name = "eventListeners",
-            service = TopologyEventListener.class,
-            cardinality = ReferenceCardinality.MULTIPLE,
-            policy = ReferencePolicy.DYNAMIC,
-            bind = "bindTopologyEventListener", unbind = "bindTopologyEventListener")
     protected void bindTopologyEventListener(final TopologyEventListener eventListener) {
         viewStateManagerLock.lock();
-        try {
+        try{
             if (!activated) {
                 pendingListeners.add(eventListener);
             } else {
                 viewStateManager.bind(eventListener);
             }
         } finally {
-            if (viewStateManagerLock != null) {
+            if (viewStateManagerLock!=null) {
                 viewStateManagerLock.unlock();
             }
         }
@@ -370,14 +369,14 @@ public class OakDiscoveryService extends BaseDiscoveryService {
      */
     protected void unbindTopologyEventListener(final TopologyEventListener eventListener) {
         viewStateManagerLock.lock();
-        try {
+        try{
             if (!activated) {
                 pendingListeners.remove(eventListener);
             } else {
                 viewStateManager.unbind(eventListener);
             }
         } finally {
-            if (viewStateManagerLock != null) {
+            if (viewStateManagerLock!=null) {
                 viewStateManagerLock.unlock();
             }
         }
@@ -386,13 +385,10 @@ public class OakDiscoveryService extends BaseDiscoveryService {
     /**
      * Bind a new property provider.
      */
-    @Reference(name = "providerInfos",
-            service = PropertyProvider.class,
-            cardinality = ReferenceCardinality.MULTIPLE,
-            policy = ReferencePolicy.DYNAMIC,
-            bind = "bindPropertyProvider", unbind = "unbindPropertyProvider", updated = "updatedPropertyProvider")
-    protected void bindPropertyProvider(final PropertyProvider propertyProvider, final Map<String, Object> props) {
-        logger.debug("bindPropertyProvider: Binding PropertyProvider {}", propertyProvider);
+    protected void bindPropertyProvider(final PropertyProvider propertyProvider,
+                                        final Map<String, Object> props) {
+        logger.debug("bindPropertyProvider: Binding PropertyProvider {}",
+                propertyProvider);
 
         synchronized (lock) {
             try {
@@ -408,7 +404,8 @@ public class OakDiscoveryService extends BaseDiscoveryService {
     /**
      * Bind a new property provider.
      */
-    private void bindPropertyProviderInteral(final PropertyProvider propertyProvider, final Map<String, Object> props) {
+    private void bindPropertyProviderInteral(final PropertyProvider propertyProvider,
+            final Map<String, Object> props) {
         final ProviderInfo info = new ProviderInfo(propertyProvider, props);
         this.providerInfos.add(info);
         Collections.sort(this.providerInfos);
@@ -421,8 +418,10 @@ public class OakDiscoveryService extends BaseDiscoveryService {
     /**
      * Update a property provider.
      */
-    protected void updatedPropertyProvider(final PropertyProvider propertyProvider, final Map<String, Object> props) {
-        logger.debug("bindPropertyProvider: Updating PropertyProvider {}", propertyProvider);
+    protected void updatedPropertyProvider(final PropertyProvider propertyProvider,
+                                           final Map<String, Object> props) {
+        logger.debug("bindPropertyProvider: Updating PropertyProvider {}",
+                propertyProvider);
 
         synchronized (lock) {
             try {
@@ -439,8 +438,10 @@ public class OakDiscoveryService extends BaseDiscoveryService {
     /**
      * Unbind a property provider
      */
-    protected void unbindPropertyProvider(final PropertyProvider propertyProvider, final Map<String, Object> props) {
-        logger.debug("unbindPropertyProvider: Releasing PropertyProvider {}", propertyProvider);
+    protected void unbindPropertyProvider(final PropertyProvider propertyProvider,
+                                          final Map<String, Object> props) {
+        logger.debug("unbindPropertyProvider: Releasing PropertyProvider {}",
+                propertyProvider);
         synchronized (lock) {
             try {
                 this.unbindPropertyProviderInternal(propertyProvider, props, true);
@@ -460,7 +461,7 @@ public class OakDiscoveryService extends BaseDiscoveryService {
             final Map<String, Object> props, final boolean update) {
 
         final ProviderInfo info = new ProviderInfo(propertyProvider, props);
-        if (this.providerInfos.remove(info) && update) {
+        if ( this.providerInfos.remove(info) && update ) {
             if (activated) {
                 this.doUpdateProperties();
             }
@@ -475,7 +476,6 @@ public class OakDiscoveryService extends BaseDiscoveryService {
      * The properties are stored in the repository under Config.getClusterInstancesPath()
      * and announced in the topology.
      * <p>
-     *
      * @see Config#getClusterInstancesPath()
      */
     private void doUpdateProperties() {
@@ -490,14 +490,14 @@ public class OakDiscoveryService extends BaseDiscoveryService {
         if (rrf == null || c == null || sid == null) {
             // cannot update the properties then..
             logger.debug("doUpdateProperties: too early to update the properties. "
-                            + "resourceResolverFactory ({}), config ({}) or slingId ({}) not yet set.",
-                    new Object[]{rrf, c, sid});
+                    + "resourceResolverFactory ({}), config ({}) or slingId ({}) not yet set.",
+                    new Object[] {rrf, c, sid});
             return;
         } else {
             logger.debug("doUpdateProperties: updating properties now..");
         }
 
-        final Map<String, String> newProps = new HashMap<>();
+        final Map<String, String> newProps = new HashMap<String, String>();
         for (final ProviderInfo info : this.providerInfos) {
             info.refreshProperties();
             newProps.putAll(info.properties);
@@ -505,10 +505,14 @@ public class OakDiscoveryService extends BaseDiscoveryService {
 
         ResourceResolver resourceResolver = null;
         try {
-            resourceResolver = rrf.getServiceResourceResolver(null);
+            resourceResolver = rrf
+                    .getServiceResourceResolver(null);
 
             Resource myInstance = ResourceHelper
-                    .getOrCreateResource(resourceResolver, c.getClusterInstancesPath() + "/" + sid + "/properties");
+                    .getOrCreateResource(
+                            resourceResolver,
+                            c.getClusterInstancesPath()
+                                    + "/" + sid + "/properties");
             // SLING-2879 - revert/refresh resourceResolver here to work
             // around a potential issue with jackrabbit in a clustered environment
             resourceResolver.revert();
@@ -516,33 +520,33 @@ public class OakDiscoveryService extends BaseDiscoveryService {
 
             final ModifiableValueMap myInstanceMap = myInstance.adaptTo(ModifiableValueMap.class);
             final Set<String> keys = new HashSet<String>(myInstanceMap.keySet());
-            for (final String key : keys) {
+            for(final String key : keys) {
                 if (newProps.containsKey(key)) {
                     // perfect
                     continue;
-                } else if (key.indexOf(":") != -1) {
+                } else if (key.indexOf(":")!=-1) {
                     // ignore
                     continue;
                 } else {
                     // remove
-                    myInstanceMap.remove(key);
+                	myInstanceMap.remove(key);
                 }
             }
 
             boolean anyChanges = false;
-            for (final Entry<String, String> entry : newProps.entrySet()) {
-                Object existingValue = myInstanceMap.get(entry.getKey());
-                if (entry.getValue().equals(existingValue)) {
-                    // SLING-3389: dont rewrite the properties if nothing changed!
+            for(final Entry<String, String> entry : newProps.entrySet()) {
+            	Object existingValue = myInstanceMap.get(entry.getKey());
+            	if (entry.getValue().equals(existingValue)) {
+            	    // SLING-3389: dont rewrite the properties if nothing changed!
                     if (logger.isDebugEnabled()) {
                         logger.debug("doUpdateProperties: unchanged: {}={}", entry.getKey(), entry.getValue());
                     }
-                    continue;
-                }
-                if (logger.isDebugEnabled()) {
-                    logger.debug("doUpdateProperties: changed: {}={}", entry.getKey(), entry.getValue());
-                }
-                anyChanges = true;
+            	    continue;
+            	}
+            	if (logger.isDebugEnabled()) {
+            	    logger.debug("doUpdateProperties: changed: {}={}", entry.getKey(), entry.getValue());
+            	}
+            	anyChanges = true;
                 myInstanceMap.put(entry.getKey(), entry.getValue());
             }
 
@@ -550,11 +554,14 @@ public class OakDiscoveryService extends BaseDiscoveryService {
                 resourceResolver.commit();
             }
         } catch (LoginException e) {
-            logger.error("handleEvent: could not log in administratively: " + e, e);
-            throw new RuntimeException("Could not log in to repository (" + e + ")", e);
+            logger.error(
+                    "handleEvent: could not log in administratively: " + e, e);
+            throw new RuntimeException("Could not log in to repository (" + e
+                    + ")", e);
         } catch (PersistenceException e) {
             logger.error("handleEvent: got a PersistenceException: " + e, e);
-            throw new RuntimeException( "Exception while talking to repository (" + e + ")", e);
+            throw new RuntimeException(
+                    "Exception while talking to repository (" + e + ")", e);
         } finally {
             if (resourceResolver != null) {
                 resourceResolver.close();
@@ -593,7 +600,7 @@ public class OakDiscoveryService extends BaseDiscoveryService {
         public final Map<String, String> properties = new HashMap<String, String>();
 
         public ProviderInfo(final PropertyProvider provider,
-                            final Map<String, Object> serviceProps) {
+                final Map<String, Object> serviceProps) {
             this.provider = provider;
             this.propertyProperties = serviceProps.get(PropertyProvider.PROPERTY_PROPERTIES);
             final Object sr = serviceProps.get(Constants.SERVICE_RANKING);
@@ -611,7 +618,7 @@ public class OakDiscoveryService extends BaseDiscoveryService {
             if (this.propertyProperties instanceof String) {
                 final String val = provider.getProperty((String) this.propertyProperties);
                 if (val != null) {
-                    putPropertyIfValid((String) this.propertyProperties, val);
+                	putPropertyIfValid((String) this.propertyProperties, val);
                 }
             } else if (this.propertyProperties instanceof String[]) {
                 for (final String name : (String[]) this.propertyProperties) {
@@ -623,16 +630,14 @@ public class OakDiscoveryService extends BaseDiscoveryService {
             }
         }
 
-        /**
-         * SLING-2883 : put property only if valid
-         **/
-        private void putPropertyIfValid(final String name, final String val) {
-            if (PropertyNameHelper.isValidPropertyName(name)) {
-                this.properties.put(name, val);
-            }
-        }
+        /** SLING-2883 : put property only if valid **/
+		private void putPropertyIfValid(final String name, final String val) {
+			if (PropertyNameHelper.isValidPropertyName(name)) {
+				this.properties.put(name, val);
+			}
+		}
 
-        /**
+		/**
          * @see java.lang.Comparable#compareTo(java.lang.Object)
          */
         @Override
@@ -666,7 +671,7 @@ public class OakDiscoveryService extends BaseDiscoveryService {
      */
     public void checkForTopologyChange() {
         viewStateManagerLock.lock();
-        try {
+        try{
             if (!activated) {
                 logger.debug("checkForTopologyChange: not yet activated, ignoring");
                 return;
@@ -683,7 +688,7 @@ public class OakDiscoveryService extends BaseDiscoveryService {
                 viewStateManager.handleChanging();
             }
         } finally {
-            if (viewStateManagerLock != null) {
+            if (viewStateManagerLock!=null) {
                 viewStateManagerLock.unlock();
             }
         }
@@ -707,11 +712,8 @@ public class OakDiscoveryService extends BaseDiscoveryService {
         return announcementRegistry;
     }
 
-    /**
-     * for testing only
-     *
-     * @return
-     */
+    /** for testing only
+     * @return */
     public ViewStateManager getViewStateManager() {
         return viewStateManager;
     }
diff --git a/src/main/java/org/apache/sling/discovery/oak/SynchronizedClocksHealthCheck.java b/src/main/java/org/apache/sling/discovery/oak/SynchronizedClocksHealthCheck.java
index f6447bc..c5d60a2 100644
--- a/src/main/java/org/apache/sling/discovery/oak/SynchronizedClocksHealthCheck.java
+++ b/src/main/java/org/apache/sling/discovery/oak/SynchronizedClocksHealthCheck.java
@@ -25,14 +25,18 @@ import java.util.Set;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.discovery.base.connectors.announcement.Announcement;
 import org.apache.sling.discovery.base.connectors.announcement.AnnouncementRegistry;
 import org.apache.felix.hc.api.HealthCheck;
 import org.apache.felix.hc.api.Result;
 import org.apache.felix.hc.api.FormattingResultLog;
 import org.apache.sling.settings.SlingSettingsService;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -50,12 +54,12 @@ import org.slf4j.LoggerFactory;
  * info</li>
  * </ul>
  */
-@Component(immediate = true, service = HealthCheck.class,
-        property = {
-                HealthCheck.NAME + "=Synchronized Clocks",
-                HealthCheck.MBEAN_NAME + "=slingDiscoveryOakSynchronizedClocks"
-        })
-        //label = "Apache Sling Discovery Oak Synchronized Clocks Health Check")
+@Component(immediate = true, metatype = true, label = "Apache Sling Discovery Oak Synchronized Clocks Health Check")
+@Properties({
+        @Property(name = HealthCheck.NAME, value = "Synchronized Clocks", description = "Health Check name", label = "Name"),
+        @Property(name = HealthCheck.TAGS, unbounded = PropertyUnbounded.ARRAY, description = "Health Check tags", label = "Tags"),
+        @Property(name = HealthCheck.MBEAN_NAME, value = "slingDiscoveryOakSynchronizedClocks", description = "Health Check MBean name", label = "MBean name") })
+@Service(value = HealthCheck.class)
 public class SynchronizedClocksHealthCheck implements HealthCheck {
 
     protected final Logger logger = LoggerFactory.getLogger(getClass());
diff --git a/src/main/java/org/apache/sling/discovery/oak/TopologyWebConsolePlugin.java b/src/main/java/org/apache/sling/discovery/oak/TopologyWebConsolePlugin.java
index d6f3fa9..d671bd2 100644
--- a/src/main/java/org/apache/sling/discovery/oak/TopologyWebConsolePlugin.java
+++ b/src/main/java/org/apache/sling/discovery/oak/TopologyWebConsolePlugin.java
@@ -38,6 +38,13 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.felix.webconsole.AbstractWebConsolePlugin;
 import org.apache.felix.webconsole.WebConsoleConstants;
 import org.apache.sling.api.resource.LoginException;
@@ -60,11 +67,6 @@ import org.apache.sling.discovery.commons.InstancesDiff;
 import org.apache.sling.discovery.commons.providers.spi.base.DiscoveryLiteDescriptor;
 import org.apache.sling.discovery.commons.providers.spi.base.OakBacklogClusterSyncService;
 import org.osgi.framework.BundleContext;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.propertytypes.ServiceDescription;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -72,14 +74,16 @@ import org.slf4j.LoggerFactory;
  * Simple webconsole which gives an overview of the topology visible by the
  * discovery service
  */
-@Component(service = { TopologyEventListener.class, Servlet.class },
-        property = {
-                WebConsoleConstants.PLUGIN_LABEL+"="+TopologyWebConsolePlugin.LABEL,
-                WebConsoleConstants.PLUGIN_TITLE+"="+TopologyWebConsolePlugin.TITLE,
-                "felix.webconsole.category=Sling",
-                "felix.webconsole.configprinter.modes={zip}"
-        })
-@ServiceDescription("Apache Sling Web Console Plugin to display Background servlets and ExecutionEngine status")
+@Component
+@Service(value = { TopologyEventListener.class, Servlet.class })
+@Properties({
+    @Property(name=org.osgi.framework.Constants.SERVICE_DESCRIPTION,
+            value="Apache Sling Web Console Plugin to display Background servlets and ExecutionEngine status"),
+    @Property(name=WebConsoleConstants.PLUGIN_LABEL, value=TopologyWebConsolePlugin.LABEL),
+    @Property(name=WebConsoleConstants.PLUGIN_TITLE, value=TopologyWebConsolePlugin.TITLE),
+    @Property(name="felix.webconsole.category", value="Sling"),
+    @Property(name="felix.webconsole.configprinter.modes", value={"zip"})
+})
 @SuppressWarnings("serial")
 public class TopologyWebConsolePlugin extends AbstractWebConsolePlugin implements TopologyEventListener {
 
diff --git a/src/main/java/org/apache/sling/discovery/oak/cluster/OakClusterViewService.java b/src/main/java/org/apache/sling/discovery/oak/cluster/OakClusterViewService.java
index 7f67375..9602860 100644
--- a/src/main/java/org/apache/sling/discovery/oak/cluster/OakClusterViewService.java
+++ b/src/main/java/org/apache/sling/discovery/oak/cluster/OakClusterViewService.java
@@ -32,6 +32,10 @@ import java.util.Set;
 import java.util.UUID;
 import java.util.stream.Collectors;
 
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.ModifiableValueMap;
 import org.apache.sling.api.resource.PersistenceException;
@@ -51,16 +55,14 @@ import org.apache.sling.discovery.commons.providers.util.LogSilencer;
 import org.apache.sling.discovery.commons.providers.util.ResourceHelper;
 import org.apache.sling.discovery.oak.Config;
 import org.apache.sling.settings.SlingSettingsService;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * Oak-based implementation of the ClusterViewService interface.
  */
-@Component (service = ClusterViewService.class)
+@Component
+@Service(value = ClusterViewService.class)
 public class OakClusterViewService implements ClusterViewService {
     
     private static final String PROPERTY_CLUSTER_ID = "clusterId";
@@ -493,8 +495,10 @@ public class OakClusterViewService implements ClusterViewService {
     }
 
     private Map<String, String> readProperties(String slingId, ResourceResolver resourceResolver) {
-        Resource res = resourceResolver.getResource(config.getClusterInstancesPath() + "/" + slingId);
-        final Map<String, String> props = new HashMap<>();
+        Resource res = resourceResolver.getResource(
+                        config.getClusterInstancesPath() + "/"
+                                + slingId);
+        final Map<String, String> props = new HashMap<String, String>();
         if (res != null) {
             final Resource propertiesChild = res.getChild("properties");
             if (propertiesChild != null) {
diff --git a/src/main/java/org/apache/sling/discovery/oak/pinger/OakViewChecker.java b/src/main/java/org/apache/sling/discovery/oak/pinger/OakViewChecker.java
index f7bbe1c..3773166 100644
--- a/src/main/java/org/apache/sling/discovery/oak/pinger/OakViewChecker.java
+++ b/src/main/java/org/apache/sling/discovery/oak/pinger/OakViewChecker.java
@@ -21,6 +21,11 @@ package org.apache.sling.discovery.oak.pinger;
 import java.util.Calendar;
 import java.util.UUID;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.ModifiableValueMap;
 import org.apache.sling.api.resource.PersistenceException;
@@ -37,10 +42,6 @@ import org.apache.sling.discovery.commons.providers.util.ResourceHelper;
 import org.apache.sling.discovery.oak.Config;
 import org.apache.sling.discovery.oak.OakDiscoveryService;
 import org.apache.sling.settings.SlingSettingsService;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.osgi.service.component.annotations.ReferencePolicy;
 import org.osgi.service.http.HttpService;
 
 /**
@@ -53,13 +54,11 @@ import org.osgi.service.http.HttpService;
  * Remote heartbeats are POSTs to remote TopologyConnectorServlets using
  * discovery.base
  */
-@Component(service = OakViewChecker.class,
-        reference = {
-                @Reference(name = "HttpService",
-                        service = HttpService.class,
-                        cardinality = ReferenceCardinality.MULTIPLE,
-                        policy = ReferencePolicy.DYNAMIC)
-        })
+@Component
+@Service(value = OakViewChecker.class)
+@Reference(referenceInterface=HttpService.class,
+           cardinality=ReferenceCardinality.OPTIONAL_MULTIPLE,
+           policy=ReferencePolicy.DYNAMIC)
 public class OakViewChecker extends BaseViewChecker {
 
     @Reference
diff --git a/src/test/java/org/apache/sling/discovery/oak/OakDiscoveryServiceTest.java b/src/test/java/org/apache/sling/discovery/oak/OakDiscoveryServiceTest.java
index 08d1768..c2392cf 100644
--- a/src/test/java/org/apache/sling/discovery/oak/OakDiscoveryServiceTest.java
+++ b/src/test/java/org/apache/sling/discovery/oak/OakDiscoveryServiceTest.java
@@ -56,7 +56,6 @@ import org.apache.sling.discovery.oak.its.setup.OakTestConfig;
 import org.apache.sling.discovery.oak.its.setup.OakVirtualInstanceBuilder;
 import org.apache.sling.discovery.oak.its.setup.SimulatedLease;
 import org.apache.sling.discovery.oak.its.setup.SimulatedLeaseCollection;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;