in src/main/java/org/apache/sling/discovery/impl/Config.java [235:343]
protected void configure(final Map<String, Object> properties) {
this.heartbeatTimeout = PropertiesUtil.toLong(
properties.get(HEARTBEAT_TIMEOUT_KEY),
DEFAULT_HEARTBEAT_TIMEOUT);
logger.debug("configure: heartbeatTimeout='{}'", this.heartbeatTimeout);
this.heartbeatInterval = PropertiesUtil.toLong(
properties.get(HEARTBEAT_INTERVAL_KEY),
DEFAULT_HEARTBEAT_INTERVAL);
logger.debug("configure: heartbeatInterval='{}'",
this.heartbeatInterval);
this.minEventDelay = PropertiesUtil.toInteger(
properties.get(MIN_EVENT_DELAY_KEY),
DEFAULT_MIN_EVENT_DELAY);
logger.debug("configure: minEventDelay='{}'",
this.minEventDelay);
this.connectionTimeout = PropertiesUtil.toInteger(
properties.get(CONNECTION_TIMEOUT_KEY),
DEFAULT_CONNECTION_TIMEOUT);
logger.debug("configure: connectionTimeout='{}'",
this.connectionTimeout);
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);
}
} catch (MalformedURLException e) {
logger.error("configure: could not set a topologyConnectorUrl: " + e,
e);
}
}
if (urls.size()>0) {
this.topologyConnectorUrls = urls.toArray(new URL[urls.size()]);
logger.debug("configure: number of topologyConnectorUrls='{}''",
urls.size());
} else {
this.topologyConnectorUrls = null;
logger.debug("configure: no (valid) topologyConnectorUrls configured");
}
} else {
this.topologyConnectorUrls = null;
logger.debug("configure: no (valid) topologyConnectorUrls configured");
}
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 the path is empty, or /, then use the default
this.discoveryResourcePath = DEFAULT_DISCOVERY_RESOURCE_PATH;
}
logger.debug("configure: discoveryResourcePath='{}'",
this.discoveryResourcePath);
this.leaderElectionRepositoryDescriptor = PropertiesUtil.toString(
properties.get(LEADER_ELECTION_REPOSITORY_DESCRIPTOR_NAME_KEY),
null);
logger.debug("configure: leaderElectionRepositoryDescriptor='{}'",
this.leaderElectionRepositoryDescriptor);
this.invertRepositoryDescriptor = PropertiesUtil.toBoolean(
properties.get(INVERT_REPOSITORY_DESCRIPTOR_NAME_KEY),
false /* default: false*/);
logger.debug("configure: invertRepositoryDescriptor='{}'",
this.invertRepositoryDescriptor);
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);
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);
useSyncTokenService = PropertiesUtil.toBoolean(properties.get(USE_SYNC_TOKEN_SERVICE_ENABLED), true);
}