AngLi2 commented on a change in pull request #2358:
URL:
https://github.com/apache/servicecomb-java-chassis/pull/2358#discussion_r619736299
##########
File path:
deployment/src/test/java/org/apache/servicecomb/deployment/CustomDeploymentProvider.java
##########
@@ -17,23 +17,32 @@
package org.apache.servicecomb.deployment;
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.servicecomb.config.ConfigUtil;
+
import java.util.Arrays;
public class CustomDeploymentProvider implements DeploymentProvider {
+ private static AbstractConfiguration configuration =
ConfigUtil.createLocalConfig();
+
@Override
public int getOrder() {
return 0;
}
@Override
public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
- switch (systemKey) {
- case DeploymentProvider.SYSTEM_KEY_CONFIG_CENTER:
- SystemBootstrapInfo cc = new SystemBootstrapInfo();
- cc.setAccessURL(Arrays.asList("http://lcalhost/custom"));
- return cc;
- default:
- return null;
+ if (systemKey.contentEquals("TestCenter")) {
+ SystemBootstrapInfo cc = new SystemBootstrapInfo();
+ cc.setAccessURL(Arrays.asList("http://lcalhost/custom"));
Review comment:
typo
##########
File path:
deployment/src/test/java/org/apache/servicecomb/deployment/TestDeployment.java
##########
@@ -31,45 +31,9 @@ public void tearDown() {
@Test
public void testConfiguration() {
- DefaultDeploymentProvider.setConfiguration(ConfigUtil.createLocalConfig());
- SystemBootstrapInfo info =
Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_SERVICE_CENTER);
- Assert.assertEquals(info.getAccessURL().get(0), "http://127.0.0.1:30100");
- info =
Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_CONFIG_CENTER);
+ CustomDeploymentProvider.setConfiguration(ConfigUtil.createLocalConfig());
+ SystemBootstrapInfo info = Deployment.getSystemBootStrapInfo("TestCenter");
Assert.assertEquals(info.getAccessURL().get(0), "http://lcalhost/custom");
Review comment:
typo "lcalhost"
##########
File path:
service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/collect/ServiceCenterDefaultDeploymentProvider.java
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.servicecomb.serviceregistry.collect;
+
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.servicecomb.config.ConfigUtil;
+import org.apache.servicecomb.deployment.DeploymentProvider;
+import org.apache.servicecomb.deployment.SystemBootstrapInfo;
+
+import java.util.Arrays;
+
+public class ServiceCenterDefaultDeploymentProvider implements
DeploymentProvider {
+ public static final String SYSTEM_KEY_SERVICE_CENTER = "ServiceCenter";
+
+ private static AbstractConfiguration configuration =
ConfigUtil.createLocalConfig();
+
+ @Override
+ public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
+ if (systemKey.contentEquals(SYSTEM_KEY_SERVICE_CENTER)) {
+ SystemBootstrapInfo sc = new SystemBootstrapInfo();
+ String[] urls =
configuration.getStringArray("servicecomb.service.registry.address");
+ if (urls == null || urls.length == 0) {
Review comment:
use ArrayUtils.isEmpty(urls)
##########
File path:
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/collect/ConfigCenterDefaultDeploymentProvider.java
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.servicecomb.config.collect;
+
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.servicecomb.config.ConfigUtil;
+import org.apache.servicecomb.deployment.DeploymentProvider;
+import org.apache.servicecomb.deployment.SystemBootstrapInfo;
+
+import java.util.Arrays;
+
+public class ConfigCenterDefaultDeploymentProvider implements
DeploymentProvider {
+ public static final String SYSTEM_KEY_CONFIG_CENTER = "ConfigCenter";
+
+ private static AbstractConfiguration configuration =
ConfigUtil.createLocalConfig();
+
+ @Override
+ public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
+ if (systemKey.contentEquals(SYSTEM_KEY_CONFIG_CENTER)) {
+ String[] ccAddresses =
configuration.getStringArray("servicecomb.config.client.serverUri");
+ if (ccAddresses == null || ccAddresses.length == 0) {
Review comment:
use ArrayUtils.isEmpty(ccAddresses)
##########
File path:
dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/collect/KieCenterDefaultDeploymentProvider.java
##########
@@ -15,44 +15,37 @@
* limitations under the License.
*/
-package org.apache.servicecomb.deployment;
-
-import java.util.Arrays;
+package org.apache.servicecomb.config.kie.collect;
+import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.configuration.AbstractConfiguration;
import org.apache.servicecomb.config.ConfigUtil;
+import org.apache.servicecomb.deployment.DeploymentProvider;
+import org.apache.servicecomb.deployment.SystemBootstrapInfo;
-import com.google.common.annotations.VisibleForTesting;
+import java.util.Arrays;
+
+public class KieCenterDefaultDeploymentProvider implements DeploymentProvider {
+ public static final String SYSTEM_KEY_KIE_CENTER = "KieCenter";
-public class DefaultDeploymentProvider implements DeploymentProvider {
private static AbstractConfiguration configuration =
ConfigUtil.createLocalConfig();
@Override
public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
- switch (systemKey) {
- case SYSTEM_KEY_SERVICE_CENTER:
- SystemBootstrapInfo sc = new SystemBootstrapInfo();
- String[] urls =
configuration.getStringArray("servicecomb.service.registry.address");
- if (urls == null || urls.length == 0) {
- urls = new String[] {"http://127.0.0.1:30100"};
- }
- sc.setAccessURL(Arrays.asList(urls));
- return sc;
- case SYSTEM_KEY_CONFIG_CENTER:
- String[] ccAddresses =
configuration.getStringArray("servicecomb.config.client.serverUri");
- if (ccAddresses == null || ccAddresses.length == 0) {
+ if (systemKey.contentEquals(SYSTEM_KEY_KIE_CENTER)) {
+ String[] kieAddresses =
configuration.getStringArray("servicecomb.kie.serverUri");
+ if (kieAddresses == null || kieAddresses.length == 0) {
Review comment:
use ArrayUtils.isEmpty(kieAddresses)
##########
File path:
huawei-cloud/dashboard/src/main/java/org/apache/servicecomb/huaweicloud/dashboard/monitor/MonitorDefaultDeploymentProvider.java
##########
@@ -31,23 +31,21 @@
@Override
public int getOrder() {
- return 2;
+ return 3;
}
@Override
public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
- switch (systemKey) {
- case MonitorConstant.SYSTEM_KEY_DASHBOARD_SERVICE:
- String[] msAddresses =
configuration.getStringArray(MonitorConstant.MONITOR_URI);
- if (msAddresses == null || msAddresses.length == 0) {
- return null;
- }
- SystemBootstrapInfo ms = new SystemBootstrapInfo();
- ms.setAccessURL(Arrays.asList(msAddresses));
- return ms;
- default:
+ if (systemKey.contentEquals(MonitorConstant.SYSTEM_KEY_DASHBOARD_SERVICE))
{
+ String[] msAddresses =
configuration.getStringArray(MonitorConstant.MONITOR_URI);
+ if (msAddresses == null || msAddresses.length == 0) {
Review comment:
use ArrayUtils.isEmpty(msAddresses)
##########
File path:
deployment/src/test/java/org/apache/servicecomb/deployment/CustomDeploymentProvider.java
##########
@@ -17,23 +17,32 @@
package org.apache.servicecomb.deployment;
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.servicecomb.config.ConfigUtil;
+
import java.util.Arrays;
public class CustomDeploymentProvider implements DeploymentProvider {
+ private static AbstractConfiguration configuration =
ConfigUtil.createLocalConfig();
+
@Override
public int getOrder() {
return 0;
}
@Override
public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
- switch (systemKey) {
- case DeploymentProvider.SYSTEM_KEY_CONFIG_CENTER:
- SystemBootstrapInfo cc = new SystemBootstrapInfo();
- cc.setAccessURL(Arrays.asList("http://lcalhost/custom"));
- return cc;
- default:
- return null;
+ if (systemKey.contentEquals("TestCenter")) {
+ SystemBootstrapInfo cc = new SystemBootstrapInfo();
+ cc.setAccessURL(Arrays.asList("http://lcalhost/custom"));
+ return cc;
}
+ return null;
Review comment:
```java
if (!systemKey.contentEquals("TestCenter")) {
return null;
}
xxx
xxx
```
seems to be better
##########
File path:
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java
##########
@@ -65,7 +64,7 @@ public int getOrder() {
@Override
public boolean isValidSource(Configuration localConfiguration) {
- if
(Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_CONFIG_CENTER)
== null) {
+ if
(Deployment.getSystemBootStrapInfo(ConfigCenterDefaultDeploymentProvider.SYSTEM_KEY_CONFIG_CENTER)
== null) {
Review comment:
return
Deployment.getSystemBootStrapInfo(ConfigCenterDefaultDeploymentProvider.SYSTEM_KEY_CONFIG_CENTER)
!= null
##########
File path:
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/archaius/sources/ConfigCenterConfigurationSourceImpl.java
##########
@@ -65,7 +64,7 @@ public int getOrder() {
@Override
public boolean isValidSource(Configuration localConfiguration) {
- if
(Deployment.getSystemBootStrapInfo(DeploymentProvider.SYSTEM_KEY_CONFIG_CENTER)
== null) {
+ if
(Deployment.getSystemBootStrapInfo(ConfigCenterDefaultDeploymentProvider.SYSTEM_KEY_CONFIG_CENTER)
== null) {
Review comment:
```java
return
Deployment.getSystemBootStrapInfo(ConfigCenterDefaultDeploymentProvider.SYSTEM_KEY_CONFIG_CENTER)
!= null;
```
seems to be better
##########
File path:
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterConfig.java
##########
@@ -102,18 +102,18 @@ public String getToken() {
public String getApiVersion() {
return finalConfig.getString(URI_API_VERSION, "v3");
}
-
+
@SuppressWarnings("unchecked")
public List<String> getFileSources() {
- Object property = finalConfig.getProperty(FILE_SOURCE);
- if (property instanceof String) {
- List<String> result = new ArrayList<>();
- result.add((String) property);
- return result;
- } else if (property instanceof List) {
- return (List<String>) property;
- }
- return new ArrayList<>();
+ Object property = finalConfig.getProperty(FILE_SOURCE);
+ if (property instanceof String) {
+ List<String> result = new ArrayList<>();
+ result.add((String) property);
+ return result;
+ } else if (property instanceof List) {
Review comment:
"else" is redundant after "return"
##########
File path:
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterConfig.java
##########
@@ -102,18 +102,18 @@ public String getToken() {
public String getApiVersion() {
return finalConfig.getString(URI_API_VERSION, "v3");
}
-
+
@SuppressWarnings("unchecked")
public List<String> getFileSources() {
- Object property = finalConfig.getProperty(FILE_SOURCE);
- if (property instanceof String) {
- List<String> result = new ArrayList<>();
- result.add((String) property);
- return result;
- } else if (property instanceof List) {
- return (List<String>) property;
- }
- return new ArrayList<>();
+ Object property = finalConfig.getProperty(FILE_SOURCE);
+ if (property instanceof String) {
+ List<String> result = new ArrayList<>();
+ result.add((String) property);
+ return result;
+ } else if (property instanceof List) {
+ return (List<String>) property;
+ }
+ return new ArrayList<>();
Review comment:
`return Collections.EMPTY_LIST` is better
##########
File path:
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/collect/ConfigCenterDefaultDeploymentProvider.java
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.servicecomb.config.collect;
+
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.servicecomb.config.ConfigUtil;
+import org.apache.servicecomb.deployment.DeploymentProvider;
+import org.apache.servicecomb.deployment.SystemBootstrapInfo;
+
+import java.util.Arrays;
+
+public class ConfigCenterDefaultDeploymentProvider implements
DeploymentProvider {
+ public static final String SYSTEM_KEY_CONFIG_CENTER = "ConfigCenter";
+
+ private static AbstractConfiguration configuration =
ConfigUtil.createLocalConfig();
+
+ @Override
+ public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
+ if (systemKey.contentEquals(SYSTEM_KEY_CONFIG_CENTER)) {
+ String[] ccAddresses =
configuration.getStringArray("servicecomb.config.client.serverUri");
+ if (ccAddresses == null || ccAddresses.length == 0) {
+ return null;
+ }
+ SystemBootstrapInfo cc = new SystemBootstrapInfo();
+ cc.setAccessURL(Arrays.asList(ccAddresses));
+ return cc;
+ }
+ return null;
Review comment:
```java
if (aaa){
return null;
}
xxx;
xxx;
xxx;
```
seems to be better
##########
File path:
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/collect/ConfigCenterInformationCollector.java
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.servicecomb.config.collect;
+
+import org.apache.servicecomb.core.bootup.BootUpInformationCollector;
+import org.apache.servicecomb.deployment.Deployment;
+import org.apache.servicecomb.deployment.SystemBootstrapInfo;
+
+
+public class ConfigCenterInformationCollector implements
BootUpInformationCollector {
+ @Override
+ public String collect() {
+ return "Config Center: " +
getCenterInfo(Deployment.getSystemBootStrapInfo("ConfigCenter"));
+ }
+
+ @Override
+ public int getOrder() {
+ return 1;
+ }
+
+ private String getCenterInfo(SystemBootstrapInfo systemBootstrapInfo) {
+ if (systemBootstrapInfo == null) {
Review comment:
`return Objects.isNull(systemBootstrapInfo)?"not
exist":systemBootstrapInfo.getAccessURL().toString();`
##########
File path:
dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/collect/KieCenterDefaultDeploymentProvider.java
##########
@@ -15,44 +15,37 @@
* limitations under the License.
*/
-package org.apache.servicecomb.deployment;
-
-import java.util.Arrays;
+package org.apache.servicecomb.config.kie.collect;
+import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.configuration.AbstractConfiguration;
import org.apache.servicecomb.config.ConfigUtil;
+import org.apache.servicecomb.deployment.DeploymentProvider;
+import org.apache.servicecomb.deployment.SystemBootstrapInfo;
-import com.google.common.annotations.VisibleForTesting;
+import java.util.Arrays;
+
+public class KieCenterDefaultDeploymentProvider implements DeploymentProvider {
+ public static final String SYSTEM_KEY_KIE_CENTER = "KieCenter";
-public class DefaultDeploymentProvider implements DeploymentProvider {
private static AbstractConfiguration configuration =
ConfigUtil.createLocalConfig();
@Override
public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
- switch (systemKey) {
- case SYSTEM_KEY_SERVICE_CENTER:
- SystemBootstrapInfo sc = new SystemBootstrapInfo();
- String[] urls =
configuration.getStringArray("servicecomb.service.registry.address");
- if (urls == null || urls.length == 0) {
- urls = new String[] {"http://127.0.0.1:30100"};
- }
- sc.setAccessURL(Arrays.asList(urls));
- return sc;
- case SYSTEM_KEY_CONFIG_CENTER:
- String[] ccAddresses =
configuration.getStringArray("servicecomb.config.client.serverUri");
- if (ccAddresses == null || ccAddresses.length == 0) {
+ if (systemKey.contentEquals(SYSTEM_KEY_KIE_CENTER)) {
+ String[] kieAddresses =
configuration.getStringArray("servicecomb.kie.serverUri");
+ if (kieAddresses == null || kieAddresses.length == 0) {
return null;
- }
- SystemBootstrapInfo cc = new SystemBootstrapInfo();
- cc.setAccessURL(Arrays.asList(ccAddresses));
- return cc;
- default:
- return null;
+ }
+ SystemBootstrapInfo kie = new SystemBootstrapInfo();
+ kie.setAccessURL(Arrays.asList(kieAddresses));
+ return kie;
}
+ return null;
Review comment:
same as above
##########
File path:
dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/collect/KieClientInformationCollector.java
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.servicecomb.config.kie.collect;
+
+import org.apache.servicecomb.core.bootup.BootUpInformationCollector;
+import org.apache.servicecomb.deployment.Deployment;
+import org.apache.servicecomb.deployment.SystemBootstrapInfo;
+
+
+public class KieClientInformationCollector implements
BootUpInformationCollector {
+ @Override
+ public String collect() {
+ return "Kie Center: " +
getCenterInfo(Deployment.getSystemBootStrapInfo("KieCenter"));
+ }
+
+ @Override
+ public int getOrder() {
+ return 2;
+ }
+
+ private String getCenterInfo(SystemBootstrapInfo systemBootstrapInfo) {
+ if (systemBootstrapInfo == null) {
+ return ("not exist");
+ }
+ return systemBootstrapInfo.getAccessURL().toString();
Review comment:
same as above
use ternary operator
##########
File path:
huawei-cloud/dashboard/src/main/java/org/apache/servicecomb/huaweicloud/dashboard/monitor/MonitorDefaultDeploymentProvider.java
##########
@@ -31,23 +31,21 @@
@Override
public int getOrder() {
- return 2;
+ return 3;
}
@Override
public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
- switch (systemKey) {
- case MonitorConstant.SYSTEM_KEY_DASHBOARD_SERVICE:
- String[] msAddresses =
configuration.getStringArray(MonitorConstant.MONITOR_URI);
- if (msAddresses == null || msAddresses.length == 0) {
- return null;
- }
- SystemBootstrapInfo ms = new SystemBootstrapInfo();
- ms.setAccessURL(Arrays.asList(msAddresses));
- return ms;
- default:
+ if (systemKey.contentEquals(MonitorConstant.SYSTEM_KEY_DASHBOARD_SERVICE))
{
+ String[] msAddresses =
configuration.getStringArray(MonitorConstant.MONITOR_URI);
+ if (msAddresses == null || msAddresses.length == 0) {
return null;
+ }
+ SystemBootstrapInfo ms = new SystemBootstrapInfo();
+ ms.setAccessURL(Arrays.asList(msAddresses));
+ return ms;
}
+ return null;
Review comment:
same as above
##########
File path:
service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/collect/ServiceCenterDefaultDeploymentProvider.java
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.servicecomb.serviceregistry.collect;
+
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.servicecomb.config.ConfigUtil;
+import org.apache.servicecomb.deployment.DeploymentProvider;
+import org.apache.servicecomb.deployment.SystemBootstrapInfo;
+
+import java.util.Arrays;
+
+public class ServiceCenterDefaultDeploymentProvider implements
DeploymentProvider {
+ public static final String SYSTEM_KEY_SERVICE_CENTER = "ServiceCenter";
+
+ private static AbstractConfiguration configuration =
ConfigUtil.createLocalConfig();
+
+ @Override
+ public SystemBootstrapInfo getSystemBootStrapInfo(String systemKey) {
+ if (systemKey.contentEquals(SYSTEM_KEY_SERVICE_CENTER)) {
+ SystemBootstrapInfo sc = new SystemBootstrapInfo();
+ String[] urls =
configuration.getStringArray("servicecomb.service.registry.address");
+ if (urls == null || urls.length == 0) {
+ urls = new String[]{"http://127.0.0.1:30100"};
+ }
+ sc.setAccessURL(Arrays.asList(urls));
+ return sc;
+ }
+ return null;
Review comment:
same as above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]