summaryrefslogtreecommitdiffstats
path: root/nokia
diff options
context:
space:
mode:
authorArindam Mondal <arind.mondal@samsung.com>2019-03-18 14:27:54 +0900
committerarind.mondal <arind.mondal@samsung.com>2019-03-18 14:28:23 +0900
commit1b73c649994cd01d936f0ee40c3cb6c8822cae35 (patch)
tree3eb5ef554f7c9b9f03f0c1d792398478f4cb7221 /nokia
parentb3a50f47c377b1cbd7ab03927a622f24ddb1c1d3 (diff)
Implement builder
https://sonar.onap.org/issues?projectUuids=AV7CYEb_WvyQfiQiM1ZX&resolved=false&rules=squid%3AS00107 Issue-ID: VFC-1277 Change-Id: Id7a5a777179e2b12c0fdfc058293003343b5a440 Signed-off-by: arind.mondal <arind.mondal@samsung.com>
Diffstat (limited to 'nokia')
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java101
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/impl/VnfContinueProcessorImpl.java6
2 files changed, 90 insertions, 17 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java
index 29524ccd..1311fb2b 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java
@@ -1,6 +1,7 @@
/**
* Copyright 2016-2017, Nokia Corporation.
- *
+ * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
+ *
* 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
@@ -76,22 +77,92 @@ public class InstantiateVnfContinueRunnable implements Runnable {
private Gson gson = new Gson();
- public InstantiateVnfContinueRunnable(String vnfmId, InstantiateVnfRequest driverRequest, String vnfInstanceId, String jobId,
- NslcmMgmrInf nslcmMgmr, CatalogMgmrInf catalogMgmr, CbamMgmrInf cbamMgmr, Driver2CbamRequestConverter requestConverter, VnfmJobExecutionMapper dbManager, VnfcResourceInfoMapper vnfcDbMgmr)
- {
- this.driverRequest = driverRequest;
- this.vnfInstanceId = vnfInstanceId;
- this.jobId = jobId;
- this.nslcmMgmr = nslcmMgmr;
- this.catalogMgmr = catalogMgmr;
- this.cbamMgmr = cbamMgmr;
- this.requestConverter = requestConverter;
- this.jobDbMgmr = dbManager;
- this.vnfmId = vnfmId;
- this.vnfcDbMgmr = vnfcDbMgmr;
+ // Builder class
+
+ public static class InstantiateVnfContinueRunnableBuilder {
+ private String vnfmId;
+ private InstantiateVnfRequest driverRequest;
+ private String vnfInstanceId;
+ private String jobId;
+ private NslcmMgmrInf nslcmMgmr;
+ private CatalogMgmrInf catalogMgmr;
+ private CbamMgmrInf cbamMgmr;
+ private Driver2CbamRequestConverter requestConverter;
+ private VnfmJobExecutionMapper dbManager;
+ private VnfcResourceInfoMapper vnfcDbMgmr;
+
+ public InstantiateVnfContinueRunnableBuilder setVnfmId(String vnfmId) {
+ this.vnfmId = vnfmId;
+ return this;
+ }
+
+ public InstantiateVnfContinueRunnableBuilder setDriverRequest(InstantiateVnfRequest driverRequest) {
+ this.driverRequest = driverRequest;
+ return this;
+ }
+
+ public InstantiateVnfContinueRunnableBuilder setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ return this;
+ }
+
+ public InstantiateVnfContinueRunnableBuilder setJobId(String jobId) {
+ this.jobId = jobId;
+ return this;
+ }
+
+ public InstantiateVnfContinueRunnableBuilder setNslcmMgmr(NslcmMgmrInf nslcmMgmr) {
+ this.nslcmMgmr = nslcmMgmr;
+ return this;
+ }
+
+ public InstantiateVnfContinueRunnableBuilder setCatalogMgmr(CatalogMgmrInf catalogMgmr) {
+ this.catalogMgmr = catalogMgmr;
+ return this;
+ }
+
+ public InstantiateVnfContinueRunnableBuilder setCbamMgmr(CbamMgmrInf cbamMgmr) {
+ this.cbamMgmr = cbamMgmr;
+ return this;
+ }
+
+ public InstantiateVnfContinueRunnableBuilder setRequestConverter(Driver2CbamRequestConverter requestConverter) {
+ this.requestConverter = requestConverter;
+ return this;
+ }
+
+ public InstantiateVnfContinueRunnableBuilder setDbManager(VnfmJobExecutionMapper dbManager) {
+ this.dbManager = dbManager;
+ return this;
+ }
+
+ public InstantiateVnfContinueRunnableBuilder setVnfcDbMgmr(VnfcResourceInfoMapper vnfcDbMgmr) {
+ this.vnfcDbMgmr = vnfcDbMgmr;
+ return this;
+ }
+
+ public InstantiateVnfContinueRunnable build() {
+ return new InstantiateVnfContinueRunnable(this);
+ }
}
- public void run() {
+
+ private InstantiateVnfContinueRunnable(InstantiateVnfContinueRunnableBuilder builder) {
+
+ this.driverRequest = builder.driverRequest;
+ this.vnfInstanceId = builder.vnfInstanceId;
+ this.jobId = builder.jobId;
+ this.nslcmMgmr = builder.nslcmMgmr;
+ this.catalogMgmr = builder.catalogMgmr;
+ this.cbamMgmr = builder.cbamMgmr;
+ this.requestConverter = builder.requestConverter;
+ this.jobDbMgmr = builder.dbManager;
+ this.vnfmId = builder.vnfmId;
+ this.vnfcDbMgmr = builder.vnfcDbMgmr;
+
+ }
+
+ public void run() {
//step 1 handle vnf package
handleVnfPackage();
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/impl/VnfContinueProcessorImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/impl/VnfContinueProcessorImpl.java
index 79df78da..07499209 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/impl/VnfContinueProcessorImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/impl/VnfContinueProcessorImpl.java
@@ -39,8 +39,10 @@ public class VnfContinueProcessorImpl implements VnfContinueProcessorInf{
String jobId, NslcmMgmrInf nslcmMgmr, CatalogMgmrInf catalogMgmr, CbamMgmrInf cbamMgmr,
Driver2CbamRequestConverter requestConverter, VnfmJobExecutionMapper jobDbManager,
VnfcResourceInfoMapper vnfcDbMgmr) {
- InstantiateVnfContinueRunnable task = new InstantiateVnfContinueRunnable(vnfmId, driverRequest, vnfInstanceId,
- jobId, nslcmMgmr, catalogMgmr, cbamMgmr, requestConverter, jobDbManager, vnfcDbMgmr);
+ InstantiateVnfContinueRunnable task = new InstantiateVnfContinueRunnable.InstantiateVnfContinueRunnableBuilder()
+ .setVnfmId(vnfmId).setDriverRequest(driverRequest).setVnfInstanceId(vnfInstanceId).setJobId(jobId)
+ .setNslcmMgmr(nslcmMgmr).setCatalogMgmr(catalogMgmr).setCbamMgmr(cbamMgmr)
+ .setRequestConverter(requestConverter).setDbManager(jobDbManager).setVnfcDbMgmr(vnfcDbMgmr).build();
Executors.newSingleThreadExecutor().submit(task);
}