diff options
author | YuanHu <yuan.hu1@zte.com.cn> | 2018-03-20 09:46:24 +0800 |
---|---|---|
committer | YuanHu <yuan.hu1@zte.com.cn> | 2018-03-20 09:46:24 +0800 |
commit | 541a92f8b1362169eac5091ad4de2c8114eddbaf (patch) | |
tree | eba80e914a05628a95366fa1927bbc598a5caf35 /sdc-workflow-designer-server/src | |
parent | 47f5e6707e9684076c855523c4c9f74dff58133b (diff) |
Code Optimization.
Change config item 'msbServerAddr' to 'serviceAddr'.
Issue-ID: SDC-1079
Change-Id: I18275728ade2bc7016ea661b70a55f5550546ee7
Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-server/src')
5 files changed, 32 insertions, 32 deletions
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/SDCServiceProxyInfo.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/SDCServiceProxyInfo.java index 5d8b8eaa..a4853f73 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/SDCServiceProxyInfo.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/SDCServiceProxyInfo.java @@ -15,11 +15,27 @@ package org.onap.sdc.workflowdesigner; *
*/
public class SDCServiceProxyInfo {
+ private String serviceAddr;
+
private String xEcompInstanceId;
private String authorization;
/**
+ * @return the serviceAddr
+ */
+ public String getServiceAddr() {
+ return serviceAddr;
+ }
+
+ /**
+ * @param serviceAddr the serviceAddr to set
+ */
+ public void setServiceAddr(String serviceAddr) {
+ this.serviceAddr = serviceAddr;
+ }
+
+ /**
* @return the xEcompInstanceId
*/
public String getxEcompInstanceId() {
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerApp.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerApp.java index ba0fcd72..8e8d9a1d 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerApp.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerApp.java @@ -53,7 +53,6 @@ public class WorkflowDesignerApp extends Application<WorkflowDesignerConfigurati public void run(WorkflowDesignerConfiguration configuration, Environment environment) { LOGGER.info("Start to initialize Workflow Designer."); - AppConfig.setMsbServerAddr(configuration.getMsbServerAddr()); AppConfig.setSdcServiceProxy(configuration.getSdcServiceProxy()); environment.jersey().register(new WorkflowModelerResource()); diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerConfiguration.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerConfiguration.java index dfdffcf9..6ce2a1e2 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerConfiguration.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerConfiguration.java @@ -26,9 +26,6 @@ public class WorkflowDesignerConfiguration extends Configuration { private String defaultName = "Workflow Designer"; @NotEmpty - private String msbServerAddr; - - @NotEmpty private SDCServiceProxyInfo sdcServiceProxy; @JsonProperty @@ -50,16 +47,6 @@ public class WorkflowDesignerConfiguration extends Configuration { public void setDefaultName(String name) { this.defaultName = name; } - - @JsonProperty - public String getMsbServerAddr() { - return msbServerAddr; - } - - @JsonProperty - public void setMsbServerAddr(String msbServerAddr) { - this.msbServerAddr = msbServerAddr; - } /** * @return the sdcServiceProxy diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/AppConfig.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/AppConfig.java index f9aa060c..c617c1f6 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/AppConfig.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/AppConfig.java @@ -21,23 +21,10 @@ import org.onap.sdc.workflowdesigner.SDCServiceProxyInfo; * */ public class AppConfig { - private static String msbServerAddr; private static SDCServiceProxyInfo sdcServiceProxy; private AppConfig() {} - public static String getMsbServerAddr() { - return msbServerAddr; - } - - public static void setMsbServerAddr(String msbServerAddr) { - AppConfig.msbServerAddr = msbServerAddr; - } - - public static String getSDCAddr() { - return msbServerAddr + "/api/sdc/v1"; - } - /** * @param sdcServiceProxy */ diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCServiceProxy.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCServiceProxy.java index c9c0f810..6319cbf6 100644 --- a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCServiceProxy.java +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/externalservice/sdc/SDCServiceProxy.java @@ -30,13 +30,24 @@ import com.eclipsesource.jaxrs.consumer.ConsumerFactory; public class SDCServiceProxy { private static final Logger LOGGER = LoggerFactory.getLogger(SDCService.class); + private static final String AUTHORIZATION = AppConfig.getSdcServiceProxy().getAuthorization(); + + private static final String X_ECOMP_INSTANCE_ID = AppConfig.getSdcServiceProxy().getxEcompInstanceId(); + /** */ + private static final String SDC_ROOT_PATH = "/sdc/v1"; + + + private static String getSDCRootPath() { + return AppConfig.getSdcServiceProxy().getServiceAddr() + SDC_ROOT_PATH; + } + /** * @return */ private SDCService getSDCServiceProxy() { ClientConfig config = new ClientConfig(); SDCService sdcServiceProxy = - ConsumerFactory.createConsumer(AppConfig.getSDCAddr(), config, SDCService.class); + ConsumerFactory.createConsumer(getSDCRootPath(), config, SDCService.class); return sdcServiceProxy; } @@ -53,8 +64,8 @@ public class SDCServiceProxy { SDCService sdcServiceProxy = getSDCServiceProxy(); try { sdcServiceProxy.saveWorkflowArtifact(uuid, operationId, workflowId, - AppConfig.getSdcServiceProxy().getxEcompInstanceId(), - AppConfig.getSdcServiceProxy().getAuthorization(), workflowArtifactInfo); + X_ECOMP_INSTANCE_ID, + AUTHORIZATION, workflowArtifactInfo); } catch (Exception e) { LOGGER.error("Save WorkflowArtifact Failed.", e); throw new WorkflowDesignerException("Save WorkflowArtifact Failed.", e); @@ -74,8 +85,8 @@ public class SDCServiceProxy { SDCService sdcServiceProxy = getSDCServiceProxy(); try { return sdcServiceProxy.getWorkflowArtifact(uuid, operationId, workflowId, - AppConfig.getSdcServiceProxy().getxEcompInstanceId(), - AppConfig.getSdcServiceProxy().getAuthorization()); + X_ECOMP_INSTANCE_ID, + AUTHORIZATION); } catch (Exception e) { LOGGER.error("Get WorkflowArtifact Failed.", e); throw new WorkflowDesignerException("Save WorkflowArtifact Failed.", e); |