From acc38f4bae96abcc14aa60a41a462c9e060367c4 Mon Sep 17 00:00:00 2001 From: huangjian Date: Mon, 31 Oct 2016 16:23:43 +0800 Subject: Add serviceIp property which is used to config wso2-ext microservice ipaddress Change-Id: I8353e3891f786bd44baba1d769442c8665fbfe53 Issue-id: OCS-141 Signed-off-by: huangjian --- .../src/main/assembly/wso2bps-ext/conf/wso2bpel.yml | 3 ++- .../java/org/openo/carbon/bpel/Wso2BpelConfiguration.java | 13 +++++++++++++ .../java/org/openo/carbon/bpel/common/ServiceRegistrer.java | 2 +- .../bpel/externalservice/entity/ServiceRegisterEntity.java | 6 +++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/conf/wso2bpel.yml b/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/conf/wso2bpel.yml index 3ec522a..e312d10 100644 --- a/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/conf/wso2bpel.yml +++ b/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/conf/wso2bpel.yml @@ -17,7 +17,8 @@ template: Hello, %s! # defaultName: ${DW_DEFAULT_NAME:-Stranger} - +# the micro service ip +serviceIp: msbServerAddr: http://127.0.0.1:80 wso2Host: localhost diff --git a/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelConfiguration.java b/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelConfiguration.java index 10ef924..9c0967e 100644 --- a/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelConfiguration.java +++ b/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelConfiguration.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.dropwizard.db.DataSourceFactory; import org.hibernate.validator.constraints.NotEmpty; +import javax.validation.Valid; import javax.validation.constraints.NotNull; public class Wso2BpelConfiguration extends Configuration { @@ -57,6 +58,9 @@ public class Wso2BpelConfiguration extends Configuration { @NotEmpty private String wso2SslJksPassword; + @Valid + private String serviceIp; + @JsonProperty public String getTemplate() { return template; @@ -172,4 +176,13 @@ public class Wso2BpelConfiguration extends Configuration { this.wso2SslJksPassword = wso2SslJksPassword; } + @JsonProperty + public String getServiceIp() { + return serviceIp; + } + + @JsonProperty + public void setServiceIp(String serviceIp) { + this.serviceIp = serviceIp; + } } diff --git a/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/ServiceRegistrer.java b/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/ServiceRegistrer.java index 5408c74..03d88aa 100644 --- a/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/ServiceRegistrer.java +++ b/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/ServiceRegistrer.java @@ -63,7 +63,7 @@ public class ServiceRegistrer implements Runnable { wso2bpelEntity.setProtocol("REST"); wso2bpelEntity.setVersion("v1"); wso2bpelEntity.setUrl("/openoapi/wso2bpel/v1"); - wso2bpelEntity.setSingleNode(null, "8101", 0); + wso2bpelEntity.setSingleNode(Config.getConfigration().getServiceIp(), "8101", 0); wso2bpelEntity.setVisualRange("1"); } diff --git a/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceRegisterEntity.java b/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceRegisterEntity.java index a2cfc2d..3dd336d 100644 --- a/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceRegisterEntity.java +++ b/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceRegisterEntity.java @@ -44,7 +44,11 @@ public class ServiceRegisterEntity { */ public void setSingleNode(String ip, String port, int ttl) { ServiceNode node = new ServiceNode(); - node.setIp(ip); + if (ip != null && ip.length() > 0) { + node.setIp(ip); + } else { + node.setIp(null); + } node.setPort(port); node.setTtl(ttl); nodes.add(node); -- cgit 1.2.3-korg