Get msbServerAddr from config file. 85/36185/1
authorYuanHu <yuan.hu1@zte.com.cn>
Fri, 16 Mar 2018 08:19:09 +0000 (16:19 +0800)
committerYuanHu <yuan.hu1@zte.com.cn>
Fri, 16 Mar 2018 08:19:09 +0000 (16:19 +0800)
Get msbServerAddr from application config file.

Issue-ID: SDC-1128

Change-Id: Id260f8f94598ec3f3e4824b4c5e1a085d9a248fd
Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
distribution/src/main/assembly/conf/workflow-designer.yml
sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerApp.java
sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/WorkflowDesignerConfiguration.java
sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/AppConfig.java [new file with mode: 0644]

index 86f9687..2e8409a 100644 (file)
@@ -14,6 +14,8 @@ template: Hello, %s!
 
 defaultName: ${DW_DEFAULT_NAME:-Stranger}
 
+msbServerAddr: http://127.0.0.1:80
+
 # use the simple server factory if you only want to run on a single port
 server:
   type: simple
index 1e28905..e2ec271 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2017 ZTE Corporation.
+ * Copyright (c) 2017-2018 ZTE Corporation.
  * All rights reserved. This program and the accompanying materials
  * are made available under the Apache License, Version 2.0
  * and the Eclipse Public License v1.0 which both accompany this distribution,
@@ -13,6 +13,7 @@
 package org.onap.sdc.workflowdesigner;
 
 import org.glassfish.jersey.media.multipart.MultiPartFeature;
+import org.onap.sdc.workflowdesigner.config.AppConfig;
 import org.onap.sdc.workflowdesigner.resources.ExtendActivityResource;
 import org.onap.sdc.workflowdesigner.resources.WorkflowModelerResource;
 import org.slf4j.Logger;
@@ -52,6 +53,8 @@ public class WorkflowDesignerApp extends Application<WorkflowDesignerConfigurati
   @Override
   public void run(WorkflowDesignerConfiguration configuration, Environment environment) {
     LOGGER.info("Start to initialize Workflow Designer.");
+    
+    AppConfig.setMsbServerAddr(configuration.getMsbServerAddr());
 
     environment.jersey().register(new WorkflowModelerResource());
     environment.jersey().register(new ExtendActivityResource());
index 16f807e..b4ed3d1 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2017 ZTE Corporation.
+ * Copyright (c) 2017-2018 ZTE Corporation.
  * All rights reserved. This program and the accompanying materials
  * are made available under the Apache License, Version 2.0
  * and the Eclipse Public License v1.0 which both accompany this distribution,
@@ -24,6 +24,9 @@ public class WorkflowDesignerConfiguration extends Configuration {
 
   @NotEmpty
   private String defaultName = "Workflow Designer";
+  
+  @NotEmpty
+  private String msbServerAddr;
 
   @JsonProperty
   public String getTemplate() {
@@ -44,5 +47,15 @@ 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;
+  }
 
 }
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
new file mode 100644 (file)
index 0000000..a3cae9c
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * Licensed 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.onap.sdc.workflowdesigner.config;
+
+/**
+ * 
+ */
+public class AppConfig {
+  private static String msbServerAddr;
+
+  private AppConfig() {}
+
+
+  public static String getMsbServerAddr() {
+    return msbServerAddr;
+  }
+
+  public static void setMsbServerAddr(String msbServerAddr) {
+    AppConfig.msbServerAddr = msbServerAddr;
+  }
+}