WIP on further 4financeIT migration
This commit is contained in:
@@ -4,6 +4,7 @@ import org.apache.curator.framework.CuratorFramework;
|
||||
import org.apache.curator.x.discovery.details.InstanceSerializer;
|
||||
import org.apache.curator.x.discovery.details.JsonInstanceSerializer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.cloud.zookeeper.discovery.dependency.ZookeeperDependencies;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -28,6 +29,7 @@ public class ZookeeperDiscoveryClientConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ZookeeperServiceDiscovery zookeeperServiceDiscovery() {
|
||||
return new ZookeeperServiceDiscovery(curator, zookeeperDiscoveryProperties(),
|
||||
instanceSerializer());
|
||||
|
||||
@@ -75,6 +75,15 @@ public class ZookeeperDependencies {
|
||||
return !dependencies.isEmpty();
|
||||
}
|
||||
|
||||
public ZookeeperDependency getDependencyForAlias(final String alias) {
|
||||
for (Map.Entry<String, ZookeeperDependency> zookeeperDependencyEntry : dependencies.entrySet()) {
|
||||
if (zookeeperDependencyEntry.getKey().equals(alias)) {
|
||||
return zookeeperDependencyEntry.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getPathForAlias(final String alias) {
|
||||
for (Map.Entry<String, ZookeeperDependency> zookeeperDependencyEntry : dependencies.entrySet()) {
|
||||
if (zookeeperDependencyEntry.getKey().equals(alias)) {
|
||||
@@ -83,4 +92,13 @@ public class ZookeeperDependencies {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getAliasForPath(final String path) {
|
||||
for (Map.Entry<String, ZookeeperDependency> zookeeperDependencyEntry : dependencies.entrySet()) {
|
||||
if (zookeeperDependencyEntry.getValue().getPath().equals(path)) {
|
||||
return zookeeperDependencyEntry.getKey();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user