aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-common/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common/src/main')
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/beans/avpnbondingbeans/AVPNServiceNames.java44
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java)4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBooleanInput.java)20
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java)20
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java)26
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaIntegerInput.java)21
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java107
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java50
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaRequest.java)6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java)86
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java)56
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/Track.java)2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java)162
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java)186
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java)25
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ErrorNumbers.java)6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/LSInputImpl.java)2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/PathResourceResolver.java)7
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java)42
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java)45
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java)51
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java221
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java)24
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java51
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java45
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java52
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Messages.java56
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java32
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/MsoException.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/package-info.java)9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java36
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java125
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java111
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java43
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java46
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java47
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java43
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java43
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java46
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/AlarmLoggerInfo.java84
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java111
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java96
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java194
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java48
43 files changed, 1887 insertions, 644 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/beans/avpnbondingbeans/AVPNServiceNames.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/beans/avpnbondingbeans/AVPNServiceNames.java
new file mode 100644
index 0000000000..ed4e8c9305
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/beans/avpnbondingbeans/AVPNServiceNames.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandler.beans.avpnbondingbeans;
+
+public enum AVPNServiceNames {
+ AVPN_BONDING_TO_COLLABORATE("AVPNBondingToCollaborate"),
+ AVPN_BONDING_TO_IP_FLEX_REACH("AVPNBondingToIPFlexReach"),
+ AVPN_BONDING_TO_IP_TOLL_FREE("AVPNBondingToIPTollFree");
+
+ private String serviceName;
+
+ AVPNServiceNames(String serviceName){
+ this.serviceName=serviceName;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ @Override
+ public String toString() {
+ return "AVPNServiceNames{" +
+ "serviceName='" + serviceName + '\'' +
+ '}';
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java
index e4db35bcca..bc2e5b1893 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/BpmnRequest.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.camundabeans;
+package org.onap.so.apihandler.camundabeans;
-import org.openecomp.mso.apihandler.common.CommonConstants;
+import org.onap.so.apihandler.common.CommonConstants;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBooleanInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java
index 07b72f0678..ea44375ff7 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBooleanInput.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBooleanInput.java
@@ -18,9 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.camundabeans;
+package org.onap.so.apihandler.camundabeans;
-import org.openecomp.mso.apihandler.common.CommonConstants;
+
+
+import org.onap.so.apihandler.common.CommonConstants;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -35,7 +37,7 @@ public class CamundaBooleanInput {
@JsonProperty(CommonConstants.CAMUNDA_VALUE)
private boolean value;
@JsonProperty(CommonConstants.CAMUNDA_TYPE)
- private final String type = "Boolean";
+ private String type = "Boolean";
public CamundaBooleanInput() {
@@ -51,7 +53,17 @@ public class CamundaBooleanInput {
this.value = value;
}
- @Override
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ public String getType() {
+ return type;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
public String toString() {
return "CamundaInput [value=" + value + ", type=" + type + "]";
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.java
index e93e6c1c15..25293c7807 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaBpmnRequestInput.java
@@ -18,9 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.camundabeans;
+package org.onap.so.apihandler.camundabeans;
-import org.openecomp.mso.apihandler.common.CommonConstants;
+
+
+import org.onap.so.apihandler.common.CommonConstants;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -33,7 +35,7 @@ public class CamundaBpmnRequestInput {
@JsonProperty(CommonConstants.CAMUNDA_VALUE)
private BpmnRequest value;
@JsonProperty(CommonConstants.CAMUNDA_TYPE)
- private final String type = "String";
+ private String type = "String";
public CamundaBpmnRequestInput() {
@@ -50,7 +52,17 @@ public class CamundaBpmnRequestInput {
this.value = value;
}
- @Override
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ public String getType() {
+ return type;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
public String toString() {
return "CamundaInput [value=" + value + ", type=" + type + "]";
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.java
index 07a3fa4a76..29e72e005a 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaInput.java
@@ -18,10 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.camundabeans;
+package org.onap.so.apihandler.camundabeans;
-import org.openecomp.mso.apihandler.common.CommonConstants;
+
+
+import org.onap.so.apihandler.common.CommonConstants;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -36,19 +38,27 @@ public class CamundaInput {
@JsonProperty(CommonConstants.CAMUNDA_VALUE)
private String value;
+
+
@JsonProperty(CommonConstants.CAMUNDA_TYPE)
- private final String type = "String";
-
-
- public CamundaInput() {
- /* Empty constructor */
- }
+ private String type = "String";
+
@JsonProperty(CommonConstants.CAMUNDA_VALUE)
public String getValue() {
return value;
}
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ public String getType() {
+ return type;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ public void setType(String type) {
+ this.type = type;
+ }
+
@JsonProperty(CommonConstants.CAMUNDA_VALUE)
public void setValue(String value) {
this.value = value;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaIntegerInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.java
index 9a1bbca77a..5bcfc6fb53 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaIntegerInput.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaIntegerInput.java
@@ -18,9 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.camundabeans;
+package org.onap.so.apihandler.camundabeans;
-import org.openecomp.mso.apihandler.common.CommonConstants;
+
+
+import org.onap.so.apihandler.common.CommonConstants;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -32,8 +34,9 @@ public class CamundaIntegerInput {
@JsonProperty(CommonConstants.CAMUNDA_VALUE)
private int value;
+
@JsonProperty(CommonConstants.CAMUNDA_TYPE)
- private final String type = "Integer";
+ private String type = "Integer";
public CamundaIntegerInput() {
@@ -48,8 +51,18 @@ public class CamundaIntegerInput {
public void setValue(int value) {
this.value = value;
}
+
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ public String getType() {
+ return type;
+ }
+
+ @JsonProperty(CommonConstants.CAMUNDA_TYPE)
+ public void setType(String type) {
+ this.type = type;
+ }
- @Override
+ @Override
public String toString() {
return "CamundaInput [value=" + Integer.toString(value) + ", type=" + type + "]";
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java
new file mode 100644
index 0000000000..c57c0965b9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequest.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandler.camundabeans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import org.onap.so.apihandler.common.CommonConstants;
+
+/**
+ * POJO which encapsulates the fields required to create a JSON request to invoke generic macro BPEL.
+ */
+@JsonPropertyOrder({CommonConstants.G_REQUEST_ID, CommonConstants.G_ACTION})
+@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT)
+public class CamundaMacroRequest {
+
+ @JsonProperty(CommonConstants.G_REQUEST_ID)
+ private CamundaInput requestId;
+
+ @JsonProperty(CommonConstants.G_ACTION)
+ private CamundaInput action;
+
+ @JsonProperty(CommonConstants.G_SERVICEINSTANCEID)
+ private CamundaInput serviceInstanceId;
+
+
+ /**
+ * Sets new requestId.
+ *
+ * @param requestId New value of requestId.
+ */
+ public void setRequestId(CamundaInput requestId) {
+ this.requestId = requestId;
+ }
+
+ /**
+ * Gets action.
+ *
+ * @return Value of action.
+ */
+ public CamundaInput getAction() {
+ return action;
+ }
+
+ /**
+ * Sets new action.
+ *
+ * @param action New value of action.
+ */
+ public void setAction(CamundaInput action) {
+ this.action = action;
+ }
+
+ /**
+ * Gets requestId.
+ *
+ * @return Value of requestId.
+ */
+ public CamundaInput getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets new serviceInstanceId.
+ *
+ * @param serviceInstanceId New value of serviceInstanceId.
+ */
+ public void setServiceInstanceId(CamundaInput serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ /**
+ * Gets serviceInstanceId.
+ *
+ * @return Value of serviceInstanceId.
+ */
+ public CamundaInput getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ @Override
+ public String toString() {
+ return "CamundaMacroRequest{" +
+ "requestId=" + requestId +
+ ", action=" + action +
+ ", serviceInstanceId=" + serviceInstanceId +
+ '}';
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java
new file mode 100644
index 0000000000..81adb40498
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaMacroRequestSerializer.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandler.camundabeans;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+/**
+ * Class used to create data object and serialize it to JSON which the BPEL macro flow understands.
+ */
+public class CamundaMacroRequestSerializer {
+
+ private CamundaMacroRequestSerializer(){}
+
+ public static String getJsonRequest(String requestId, String action, String serviceInstanceId)throws JsonProcessingException{
+ CamundaMacroRequest macroRequest = new CamundaMacroRequest();
+ macroRequest.setAction(getCamundaInput(action));
+ macroRequest.setRequestId(getCamundaInput(requestId));
+ macroRequest.setServiceInstanceId(getCamundaInput(serviceInstanceId));
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ return mapper.writeValueAsString(macroRequest);
+ }
+
+ private static CamundaInput getCamundaInput(String value){
+ CamundaInput input = new CamundaInput();
+ input.setType("String");
+ input.setValue(value);
+ return input;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java
index 60a9efe9b6..48eeede7b3 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaRequest.java
@@ -18,11 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.camundabeans;
+package org.onap.so.apihandler.camundabeans;
-import org.openecomp.mso.apihandler.common.CommonConstants;
+
+
+import org.onap.so.apihandler.common.CommonConstants;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java
index 64b7d86b59..92f4542b82 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java
@@ -18,85 +18,79 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.camundabeans;
-
-import java.util.Map;
+package org.onap.so.apihandler.camundabeans;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonRootName;
-
-// This class must be 100% JSON-compatible with the BPMN WorkflowResponse class.
-// TODO: BPMN and the API-H should use a common class.
/**
- * A synchronous response from a workflow.
+ * JavaBean JSON class for a "variables" which contains the xml payload that
+ * will be passed to the Camunda process
+ *
*/
-@JsonRootName(value = "WorkflowResponse")
-public class CamundaResponse {
-
- @JsonProperty("processInstanceId")
- private String processInstanceId;
+public class CamundaResponse {
+
+ @JsonProperty("response")
+ private String response;
@JsonProperty("messageCode")
private int messageCode;
-
@JsonProperty("message")
private String message;
-
+ @JsonProperty("processInstanceID")
+ private String processInstanceID;
@JsonProperty("variables")
- private Map<String,String> variables;
+ private String variables;
- @JsonProperty("content")
- private String content;
+ public String getProcessInstanceID() {
+ return processInstanceID;
+ }
- public String getProcessInstanceId() {
- return processInstanceId;
+ public void setProcessInstanceID(String processInstanceID) {
+ this.processInstanceID = processInstanceID;
}
- public void setProcessInstanceId(String processInstanceId) {
- this.processInstanceId = processInstanceId;
+ public String getVariables() {
+ return variables;
}
- public int getMessageCode() {
- return messageCode;
+ public void setVariables(String variables) {
+ this.variables = variables;
}
- public void setMessageCode(int messageCode) {
- this.messageCode = messageCode;
+ public CamundaResponse() {
}
- public String getMessage() {
- return message;
+ public String getResponse() {
+ return response;
}
- public void setMessage(String message) {
- this.message = message;
+ public void setResponse(String response) {
+ this.response = response;
}
- public Map<String,String> getVariables() {
- return variables;
+ public int getMessageCode() {
+ return messageCode;
}
- public void setVariables(Map<String,String> variables) {
- this.variables = variables;
+ public void setMessageCode(int messageCode) {
+ this.messageCode = messageCode;
}
- public String getContent() {
- return content;
+ public String getMessage() {
+ return message;
}
- public void setContent(String content) {
- this.content = content;
+ public void setMessage(String message) {
+ this.message = message;
}
@Override
public String toString() {
- return getClass().getSimpleName() + "["
- + "processInstanceId=" + processInstanceId
- + ",messageCode=" + messageCode
- + ",message=" + message
- + ",variables=" + variables
- + ",content=" + content
- + "]";
+ return "CamundaResponse [response=" + response + ", messageCode="
+ + messageCode + ", message=" + message + "]";
}
-} \ No newline at end of file
+
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
index 9f30e67897..9099b48f11 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,9 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.camundabeans;
+package org.onap.so.apihandler.camundabeans;
-import org.openecomp.mso.apihandler.common.CommonConstants;
+
+import org.onap.so.apihandler.common.CommonConstants;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -38,8 +39,8 @@ import com.fasterxml.jackson.annotation.JsonRootName;
CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE,
CommonConstants.CONFIGURATION_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE,
CommonConstants.VNF_TYPE_VARIABLE, CommonConstants.VF_MODULE_TYPE_VARIABLE,
- CommonConstants.NETWORK_TYPE_VARIABLE, CommonConstants.CAMUNDA_SERVICE_INPUT,
- CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.RECIPE_PARAMS})
+ CommonConstants.NETWORK_TYPE_VARIABLE, CommonConstants.CAMUNDA_SERVICE_INPUT, CommonConstants.RECIPE_PARAMS})
+
@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT)
public class CamundaVIDRequest {
@@ -96,10 +97,19 @@ public class CamundaVIDRequest {
@JsonProperty(CommonConstants.NETWORK_TYPE_VARIABLE)
private CamundaInput networkType;
-
+
@JsonProperty(CommonConstants.RECIPE_PARAMS)
private CamundaInput recipeParams;
+ @JsonProperty(CommonConstants.API_VERSION)
+ private CamundaInput apiVersion;
+
+ @JsonProperty(CommonConstants.ALACARTE)
+ private CamundaBooleanInput aLaCarte;
+
+ @JsonProperty(CommonConstants.REQUEST_URI)
+ private CamundaInput requestUri;
+
@JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
public CamundaInput getServiceInput() {
return serviceInput;
@@ -278,13 +288,41 @@ public class CamundaVIDRequest {
public void setNetworkType(CamundaInput networkType) {
this.networkType = networkType;
}
+
+ @JsonProperty(CommonConstants.API_VERSION)
+ public CamundaInput getApiVersion() {
+ return apiVersion;
+ }
+
+ @JsonProperty(CommonConstants.API_VERSION)
+ public void setApiVersion(CamundaInput apiVersion) {
+ this.apiVersion = apiVersion;
+ }
+
+ @JsonProperty(CommonConstants.ALACARTE)
+ public CamundaBooleanInput getaLaCarte() {
+ return aLaCarte;
+ }
+
+ @JsonProperty(CommonConstants.ALACARTE)
+ public void setaLaCarte(CamundaBooleanInput aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_URI)
+ public CamundaInput getRequestUri() {
+ return requestUri;
+ }
+
+ @JsonProperty(CommonConstants.REQUEST_URI)
+ public void setRequestUri(CamundaInput requestUri) {
+ this.requestUri = requestUri;
+ }
- @JsonProperty(CommonConstants.RECIPE_PARAMS)
public CamundaInput getRecipeParams() {
return recipeParams;
}
- @JsonProperty(CommonConstants.RECIPE_PARAMS)
public void setRecipeParams(CamundaInput recipeParams) {
this.recipeParams = recipeParams;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/Track.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java
index e1928ebc76..3d4dc85089 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/Track.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/Track.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.camundabeans;
+package org.onap.so.apihandler.camundabeans;
public class Track {
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
index c0cfdf9bec..7feb1ae758 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,7 +18,8 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.common;
+package org.onap.so.apihandler.common;
+
import java.io.IOException;
@@ -26,21 +27,22 @@ import javax.xml.bind.DatatypeConverter;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
-import org.openecomp.mso.apihandler.camundabeans.CamundaBooleanInput;
-import org.openecomp.mso.apihandler.camundabeans.CamundaInput;
-import org.openecomp.mso.apihandler.camundabeans.CamundaIntegerInput;
-import org.openecomp.mso.apihandler.camundabeans.CamundaRequest;
-import org.openecomp.mso.apihandler.camundabeans.CamundaVIDRequest;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
+import org.onap.so.apihandler.camundabeans.CamundaBooleanInput;
+import org.onap.so.apihandler.camundabeans.CamundaInput;
+import org.onap.so.apihandler.camundabeans.CamundaIntegerInput;
+import org.onap.so.apihandler.camundabeans.CamundaRequest;
+import org.onap.so.apihandler.camundabeans.CamundaVIDRequest;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
public class CamundaClient extends RequestClient{
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClient.class);
private static final String CAMUNDA_URL_MESAGE = "Camunda url is: ";
public CamundaClient() {
@@ -50,94 +52,98 @@ public class CamundaClient extends RequestClient{
@Override
public HttpResponse post(String camundaReqXML, String requestId,
- String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException {
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
+ throws ClientProtocolException, IOException{
HttpPost post = new HttpPost(url);
msoLogger.debug(CAMUNDA_URL_MESAGE + url);
String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion);
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
-
- String encryptedCredentials;
+ msoLogger.info("Camunda Request Content: " + jsonReq);
+ String encryptedCredentials = null;
if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + DatatypeConverter
- .printBase64Binary(userCredentials.getBytes()));
+ post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
}
}
}
post.setEntity(input);
- return client.execute(post);
+ HttpResponse response = client.execute(post);
+ msoLogger.debug("Response is: " + response);
+
+ return response;
}
@Override
- public HttpResponse post(String jsonReq) throws IOException {
+ public HttpResponse post(String jsonReq)
+ throws ClientProtocolException, IOException{
HttpPost post = new HttpPost(url);
msoLogger.debug(CAMUNDA_URL_MESAGE + url);
+ //String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion);
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
- String encryptedCredentials;
+ String encryptedCredentials = null;
if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + DatatypeConverter
- .printBase64Binary(userCredentials.getBytes()));
+ post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
}
}
}
post.setEntity(input);
+ HttpResponse response = client.execute(post);
+ msoLogger.debug("Response is: " + response);
- return client.execute(post);
+ return response;
}
- @Override
- public HttpResponse post(RequestClientParamater params) throws IOException {
+ public HttpResponse post(RequestClientParameter parameterObject)
+ throws ClientProtocolException, IOException{
HttpPost post = new HttpPost(url);
- msoLogger.debug(CAMUNDA_URL_MESAGE + url);
- String jsonReq = wrapVIDRequest(params);
+ msoLogger.debug("Camunda url is: "+ url);
+ String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(), parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(),
+ parameterObject.getServiceInstanceId(), parameterObject.getCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(),
+ parameterObject.getServiceType(), parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd());
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
- String encryptedCredentials;
+
+ String encryptedCredentials = null;
if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + DatatypeConverter
- .printBase64Binary(userCredentials.getBytes()));
+ post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
}
}
}
+
post.setEntity(input);
- return client.execute(post);
- }
+ HttpResponse response = client.execute(post);
+ msoLogger.debug("Response is: " + response);
+ return response;
+ }
+
@Override
public HttpResponse get() {
return null;
}
- private String wrapRequest(String reqXML, String requestId, String serviceInstanceId, String requestTimeout, String schemaVersion){
+ protected String wrapRequest(String reqXML, String requestId, String serviceInstanceId, String requestTimeout, String schemaVersion){
String jsonReq = null;
- if(reqXML == null){
- reqXML ="";
- }
- if(requestTimeout == null){
- requestTimeout ="";
- }
- if(schemaVersion == null){
- schemaVersion = "";
- }
+
try{
CamundaRequest camundaRequest = new CamundaRequest();
CamundaInput camundaInput = new CamundaInput();
@@ -146,12 +152,12 @@ public class CamundaClient extends RequestClient{
CamundaInput reqid = new CamundaInput();
CamundaInput svcid = new CamundaInput();
CamundaInput timeout = new CamundaInput();
- camundaInput.setValue(reqXML);
+ camundaInput.setValue(StringUtils.defaultString(reqXML));
host.setValue(parseURL());
- schema.setValue(schemaVersion);
+ schema.setValue(StringUtils.defaultString(schemaVersion));
reqid.setValue(requestId);
svcid.setValue(serviceInstanceId);
- timeout.setValue(requestTimeout);
+ timeout.setValue(StringUtils.defaultString(requestTimeout));
camundaRequest.setServiceInput(camundaInput);
camundaRequest.setHost(host);
camundaRequest.setReqid(reqid);
@@ -159,18 +165,25 @@ public class CamundaClient extends RequestClient{
camundaRequest.setSchema(schema);
camundaRequest.setTimeout(timeout);
ObjectMapper mapper = new ObjectMapper();
+
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
jsonReq = mapper.writeValueAsString(camundaRequest);
- msoLogger.debug("request body is " + jsonReq);
+ msoLogger.trace("request body is " + jsonReq);
}catch(Exception e){
msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e);
}
return jsonReq;
}
+
- private String wrapVIDRequest(RequestClientParamater requestClientParamater) {
+ protected String wrapVIDRequest(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId, String correlationId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String apiVersion, boolean aLaCarte, String requestUri, String paramXsd){
String jsonReq = null;
+
try{
CamundaVIDRequest camundaRequest = new CamundaVIDRequest();
CamundaInput serviceInput = new CamundaInput();
@@ -190,25 +203,33 @@ public class CamundaClient extends RequestClient{
CamundaInput vnfTypeInput = new CamundaInput();
CamundaInput vfModuleTypeInput = new CamundaInput();
CamundaInput networkTypeInput = new CamundaInput();
+ CamundaBooleanInput aLaCarteInput = new CamundaBooleanInput();
+ CamundaInput apiVersionInput = new CamundaInput();
+ CamundaInput requestUriInput = new CamundaInput();
CamundaInput recipeParamsInput = new CamundaInput();
- host.setValue(parseURL());
- requestIdInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestId()));
- isBaseVfModuleInput.setValue(requestClientParamater.isBaseVfModule());
- recipeTimeoutInput.setValue(requestClientParamater.getRecipeTimeout());
- requestActionInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestAction()));
- serviceInstanceIdInput.setValue(StringUtils.defaultString(requestClientParamater.getServiceInstanceId()));
- correlationIdInput.setValue(StringUtils.defaultString(requestClientParamater.getCorrelationId()));
- vnfIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVnfId()));
- vfModuleIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVfModuleId()));
- volumeGroupIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVolumeGroupId()));
- networkIdInput.setValue(StringUtils.defaultString(requestClientParamater.getNetworkId()));
- configurationIdInput.setValue(StringUtils.defaultString(requestClientParamater.getConfigurationId()));
- serviceTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getServiceType()));
- vnfTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getVnfType()));
- vfModuleTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getVfModuleType()));
- networkTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getNetworkType()));
- recipeParamsInput.setValue(requestClientParamater.getRecipeParamXsd());
- serviceInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestDetails()));
+
+ //host.setValue(parseURL());
+ requestIdInput.setValue(StringUtils.defaultString(requestId));
+ isBaseVfModuleInput.setValue(isBaseVfModule);
+ recipeTimeoutInput.setValue(recipeTimeout);
+ requestActionInput.setValue(StringUtils.defaultString(requestAction));
+ serviceInstanceIdInput.setValue(StringUtils.defaultString(serviceInstanceId));
+ correlationIdInput.setValue(StringUtils.defaultString(correlationId));
+ vnfIdInput.setValue(StringUtils.defaultString(vnfId));
+ vfModuleIdInput.setValue(StringUtils.defaultString(vfModuleId));
+ volumeGroupIdInput.setValue(StringUtils.defaultString(volumeGroupId));
+ networkIdInput.setValue(StringUtils.defaultString(networkId));
+ configurationIdInput.setValue(StringUtils.defaultString(configurationId));
+ serviceTypeInput.setValue(StringUtils.defaultString(serviceType));
+ vnfTypeInput.setValue(StringUtils.defaultString(vnfType));
+ vfModuleTypeInput.setValue(StringUtils.defaultString(vfModuleType));
+ networkTypeInput.setValue(StringUtils.defaultString(networkType));
+ aLaCarteInput.setValue(aLaCarte);
+ apiVersionInput.setValue(StringUtils.defaultString(apiVersion));
+ requestUriInput.setValue(StringUtils.defaultString(requestUri));
+ recipeParamsInput.setValue(paramXsd);
+
+ serviceInput.setValue(requestDetails);
camundaRequest.setServiceInput(serviceInput);
camundaRequest.setHost(host);
camundaRequest.setRequestId(requestIdInput);
@@ -227,12 +248,16 @@ public class CamundaClient extends RequestClient{
camundaRequest.setVnfType(vnfTypeInput);
camundaRequest.setVfModuleType(vfModuleTypeInput);
camundaRequest.setNetworkType(networkTypeInput);
+ camundaRequest.setaLaCarte(aLaCarteInput);
+ camundaRequest.setApiVersion(apiVersionInput);
+ camundaRequest.setRequestUri(requestUriInput);
camundaRequest.setRecipeParams(recipeParamsInput);
+
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
jsonReq = mapper.writeValueAsString(camundaRequest);
- msoLogger.debug("request body is " + jsonReq);
+ msoLogger.trace("request body is " + jsonReq);
}catch(Exception e){
msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e);
}
@@ -250,5 +275,4 @@ public class CamundaClient extends RequestClient{
}
return host;
}
-
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
index cbbbff3dff..166a5c4d10 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
@@ -1,93 +1,93 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandler.common;
-
-import java.io.IOException;
-
-import javax.xml.bind.DatatypeConverter;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class CamundaTaskClient extends RequestClient{
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
-
- public CamundaTaskClient() {
- super(CommonConstants.CAMUNDATASK);
- }
-
- @Override
- public HttpResponse post(String jsonReq) throws IOException{
- HttpPost post = new HttpPost(url);
- msoLogger.debug("Camunda Task url is: "+ url);
-
- StringEntity input = new StringEntity(jsonReq);
- input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
-
- String encryptedCredentials;
- if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
- if(encryptedCredentials != null){
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
- if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + DatatypeConverter
- .printBase64Binary(userCredentials.getBytes()));
- }
- }
- }
-
- post.setEntity(input);
- return client.execute(post);
- }
-
- @Override
- public HttpResponse post(String camundaReqXML, String requestId,
- String requestTimeout, String schemaVersion, String serviceInstanceId, String action) {
- throw new UnsupportedOperationException("Method not supported.");
- }
-
- @Override
- public HttpResponse post(RequestClientParamater params) {
- throw new UnsupportedOperationException("Method not supported.");
- }
-
- @Override
- public HttpResponse get() throws IOException {
- HttpGet get = new HttpGet(url);
- msoLogger.debug("Camunda Task url is: "+ url);
- String encryptedCredentials;
- if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
- if(encryptedCredentials != null){
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
- if(userCredentials != null){
- get.addHeader("Authorization", "Basic " + new String(DatatypeConverter
- .printBase64Binary(userCredentials.getBytes())));
- }
- }
- }
- return client.execute(get);
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandler.common;
+
+import java.io.IOException;
+
+import javax.xml.bind.DatatypeConverter;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.onap.so.logger.MsoLogger;
+
+public class CamundaTaskClient extends RequestClient{
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaTaskClient.class);
+
+ public CamundaTaskClient() {
+ super(CommonConstants.CAMUNDATASK);
+ }
+
+ @Override
+ public HttpResponse post(String jsonReq) throws IOException{
+ HttpPost post = new HttpPost(url);
+ msoLogger.debug("Camunda Task url is: "+ url);
+
+ StringEntity input = new StringEntity(jsonReq);
+ input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
+
+ String encryptedCredentials;
+ if(props!=null){
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
+ if(encryptedCredentials != null){
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
+ if(userCredentials != null){
+ post.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
+ }
+ }
+ }
+
+ post.setEntity(input);
+ return client.execute(post);
+ }
+
+ @Override
+ public HttpResponse post(String camundaReqXML, String requestId,
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action) {
+ throw new UnsupportedOperationException("Method not supported.");
+ }
+
+ @Override
+ public HttpResponse post(RequestClientParameter params) {
+ throw new UnsupportedOperationException("Method not supported.");
+ }
+
+ @Override
+ public HttpResponse get() throws IOException {
+ HttpGet get = new HttpGet(url);
+ msoLogger.debug("Camunda Task url is: "+ url);
+ String encryptedCredentials;
+ if(props!=null){
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
+ if(encryptedCredentials != null){
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
+ if(userCredentials != null){
+ get.addHeader("Authorization", "Basic " + new String(DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+ return client.execute(get);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
index daa411a963..d5540ddbaa 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
@@ -18,25 +18,31 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.common;
+package org.onap.so.apihandler.common;
public final class CommonConstants {
public static final String DEFAULT_BPEL_AUTH = "admin:admin";
public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
+
public static final String REQUEST_ID_HEADER = "mso-request-id";
public static final String REQUEST_TIMEOUT_HEADER = "mso-service-request-timeout";
public static final String SCHEMA_VERSION_HEADER = "mso-schema-version";
public static final String SERVICE_INSTANCE_ID_HEADER = "mso-service-instance-id";
public static final String ACTION_HEADER = "mso-action";
- public static final String CAMUNDA_SERVICE_INPUT = "bpmnRequest";
+
+ public static final String G_REQUEST_ID = "mso-request-id";
+ public static final String G_SERVICEINSTANCEID = "serviceInstanceId";
+ public static final String G_ACTION = "gAction";
+
+ public static final String CAMUNDA_SERVICE_INPUT = "bpmnRequest";
public static final String CAMUNDA_ROOT_INPUT = "variables";
public static final String CONTENT_TYPE_JSON= "application/json";
public static final String CAMUNDA_TYPE = "type";
public static final String CAMUNDA_VALUE = "value";
- public static final String CAMUNDA_URL = "camundaURL";
- public static final String CAMUNDA_AUTH = "camundaAuth";
+ public static final String CAMUNDA_URL = "mso.camundaURL";
+ public static final String CAMUNDA_AUTH = "mso.camundaAuth";
public static final String BPEL_SEARCH_STR = "active-bpel";
public static final String TASK_SEARCH_STR = "task";
public static final String BPEL_URL = "bpelURL";
@@ -64,6 +70,17 @@ public final class CommonConstants {
public static final String ALACARTE_ORCHESTRATION = "mso.infra.default.alacarte.orchestrationUri";
public static final String ALACARTE_RECIPE_TIMEOUT = "mso.infra.default.alacarte.recipeTimeout";
public static final String RECIPE_PARAMS = "recipeParams";
+ public static final String ALACARTE_TEST_API = "mso.infra.default.alacarte.testApi";
+ public static final String MACRO_TEST_API = "mso.infra.service.macro.default.testApi";
+ public static final String ALACARTE = "aLaCarte";
+ public static final String API_VERSION = "apiVersion";
+ public static final String REQUEST_URI = "requestUri";
+ public static final String API_MINOR_VERSION = "mso.infra.default.versions.apiMinorVersion";
+ public static final String API_PATCH_VERSION = "mso.infra.default.versions.apiPatchVersion";
+ public static final String X_TRANSACTION_ID = "X-TransactionID";
+ public static final String X_MINOR_VERSION = "X-MinorVersion";
+ public static final String X_PATCH_VERSION = "X-PatchVersion";
+ public static final String X_LATEST_VERSION = "X-LatestVersion";
private CommonConstants () {
// prevent creating an instance of this class
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ErrorNumbers.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java
index 2cafef3253..5d755b9529 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ErrorNumbers.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.common;
+package org.onap.so.apihandler.common;
public final class ErrorNumbers {
@@ -28,6 +28,8 @@ public final class ErrorNumbers {
public static final String REQUEST_FAILED_SCHEMA_VALIDATION = "1000";
public static final String RECIPE_DOES_NOT_EXIST = "1010";
public static final String VFMODULE_TYPE_DOES_NOT_EXIST = "1011";
+ public static final String REQUEST_DOES_NOT_EXIST = "1012";
+ public static final String SERVICE_DOES_NOT_EXIST = "1013";
public static final String SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION = "1020";
public static final String LOCKED_SAME_SERVICE_TYPE_AND_REQUEST_ACTION = "1030";
public static final String LOCKED_CANCEL_ON_REQUEST_IN_PROGRESS = "1031";
@@ -40,8 +42,10 @@ public final class ErrorNumbers {
public static final String PREVIOUSLY_COMPLETED_WITH_DIFF_ORDER_VERSION = "1038";
public static final String LOCKED_DIFFERENT_REQUEST_ACTION = "1040";
public static final String LOCKED_DIFF_REQUEST_ACTION_SAME_SERVICE_INSTANCE_ID = "1041";
+ public static final String LOCKED_DIFFERENT_REQUEST_SAME_VPN_ID = "1042";
public static final String REQUEST_TIMED_OUT = "1050";
+
public static final String DISCONNECT_ALREADY_COMPLETE = "1100";
public static final String CANCEL_ALREADY_COMPLETE = "1110";
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/LSInputImpl.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java
index b39b5347ee..60473fb8c4 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/LSInputImpl.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/LSInputImpl.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.common;
+package org.onap.so.apihandler.common;
import java.io.InputStream;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/PathResourceResolver.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
index c8c1ef08c9..4e37561891 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/PathResourceResolver.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.common;
+package org.onap.so.apihandler.common;
import java.io.FileInputStream;
@@ -26,14 +26,13 @@ import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import org.onap.so.logger.MsoLogger;
import org.w3c.dom.ls.LSInput;
import org.w3c.dom.ls.LSResourceResolver;
-import org.openecomp.mso.logger.MsoLogger;
-
public class PathResourceResolver implements LSResourceResolver {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, PathResourceResolver.class);
private String path;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
index 66369a8b69..ca1ad7a277 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
@@ -18,20 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.common;
+package org.onap.so.apihandler.common;
import java.io.IOException;
import java.security.GeneralSecurityException;
import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.utils.CryptoUtils;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.CryptoUtils;
+import org.springframework.core.env.Environment;
public abstract class RequestClient {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
- protected MsoJavaProperties props;
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH,RequestClient.class);
+ protected Environment props;
protected String url;
protected HttpClient client;
private int type;
@@ -40,8 +41,8 @@ public abstract class RequestClient {
this.type = type;
}
- public void setProps(MsoJavaProperties props) {
- this.props = props;
+ public void setProps(Environment env) {
+ this.props = env;
}
public void setUrl(String url) {
@@ -66,19 +67,36 @@ public abstract class RequestClient {
public abstract HttpResponse post(String request, String requestId, String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException;
- public abstract HttpResponse post(String request) throws IOException;
+ public abstract HttpResponse post(String request) throws ClientProtocolException, IOException;
+
+ public abstract HttpResponse post(RequestClientParameter parameterObject) throws ClientProtocolException, IOException;
- public abstract HttpResponse post(RequestClientParamater params) throws IOException;
+ public abstract HttpResponse get()
+ throws IOException;
- public abstract HttpResponse get() throws IOException;
+ protected String decryptPropValue(String prop, String defaultValue, String encryptionKey) {
+ try {
+ String result = CryptoUtils.decrypt(prop, encryptionKey);
+ return result;
+ }
+ catch (GeneralSecurityException e) {
+ msoLogger.debug("Security exception", e);
+ }
+ return defaultValue;
+ }
protected String getEncryptedPropValue (String prop, String defaultValue, String encryptionKey) {
try {
- return CryptoUtils.decrypt(prop, encryptionKey);
+ String result = CryptoUtils.decrypt(prop, encryptionKey);
+ return result;
}
catch (GeneralSecurityException e) {
msoLogger.debug("Security exception", e);
}
return defaultValue;
}
+
+
+
+
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java
index 8f919861dc..e94f186c60 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java
@@ -18,43 +18,50 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.common;
+package org.onap.so.apihandler.common;
-import org.apache.http.impl.client.DefaultHttpClient;
-
-import org.openecomp.mso.properties.MsoJavaProperties;
-public class RequestClientFactory {
- private RequestClientFactory() {
- }
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+@Component
+public class RequestClientFactory {
+
+ @Autowired
+ private Environment env;
+
//based on URI, returns BPEL, CamundaTask or Camunda client
- public static RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ public RequestClient getRequestClient(String orchestrationURI) throws IllegalStateException{
RequestClient retClient;
- if(props ==null){
- throw new IllegalStateException("properties is null");
- }
+
String url;
- if(orchestrationURI.contains(CommonConstants.BPEL_SEARCH_STR)){
- url = props.getProperty(CommonConstants.BPEL_URL,null) + orchestrationURI;
- retClient= new BPELRestClient();
-
- }else if(orchestrationURI.contains(CommonConstants.TASK_SEARCH_STR)){
- url = props.getProperty(CommonConstants.CAMUNDA_URL,null) + orchestrationURI;
+ if(orchestrationURI.contains(CommonConstants.TASK_SEARCH_STR)){
+ url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI;
retClient = new CamundaTaskClient();
}
else{
- url = props.getProperty(CommonConstants.CAMUNDA_URL,null) + orchestrationURI;
+ url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI;
retClient = new CamundaClient();
}
retClient.setClient(new DefaultHttpClient());
- retClient.setProps(props);
+ retClient.setProps(env);
retClient.setUrl(url);
return retClient;
}
+
+ public Environment getEnv() {
+ return env;
+ }
+
+ public void setEnv(Environment env) {
+ this.env = env;
+ }
+
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
index 4db69199da..89db934985 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
@@ -19,9 +19,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.common;
+package org.onap.so.apihandler.common;
-public class RequestClientParamater {
+public class RequestClientParameter {
private String requestId;
private boolean isBaseVfModule;
@@ -39,9 +39,12 @@ public class RequestClientParamater {
private String vfModuleType;
private String networkType;
private String requestDetails;
+ private String apiVersion;
+ private boolean aLaCarte;
private String recipeParamXsd;
+ private String requestUri;
- private RequestClientParamater(Builder builder) {
+ private RequestClientParameter(Builder builder) {
requestId = builder.requestId;
isBaseVfModule = builder.isBaseVfModule;
recipeTimeout = builder.recipeTimeout;
@@ -59,6 +62,10 @@ public class RequestClientParamater {
networkType = builder.networkType;
requestDetails = builder.requestDetails;
recipeParamXsd = builder.recipeParamXsd;
+ apiVersion = builder.apiVersion;
+ aLaCarte = builder.aLaCarte;
+ requestUri = builder.requestUri;
+
}
public String getRequestId() {
@@ -129,9 +136,21 @@ public class RequestClientParamater {
return recipeParamXsd;
}
- public static class Builder {
+ public String getApiVersion() {
+ return apiVersion;
+ }
+
+ public boolean isaLaCarte() {
+ return aLaCarte;
+ }
+
+ public String getRequestUri() {
+ return requestUri;
+ }
+
+ public static class Builder {
private String requestId;
- private boolean isBaseVfModule;
+ private boolean isBaseVfModule = false;
private int recipeTimeout;
private String requestAction;
private String serviceInstanceId;
@@ -146,7 +165,10 @@ public class RequestClientParamater {
private String vfModuleType;
private String networkType;
private String requestDetails;
+ private String apiVersion;
+ private boolean aLaCarte = false;
private String recipeParamXsd;
+ private String requestUri;
public Builder setRequestId(String requestId) {
this.requestId = requestId;
@@ -232,9 +254,24 @@ public class RequestClientParamater {
this.recipeParamXsd = recipeParamXsd;
return this;
}
+
+ public Builder setApiVersion(String apiVersion) {
+ this.apiVersion = apiVersion;
+ return this;
+ }
+
+ public Builder setALaCarte(boolean aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ return this;
+ }
+
+ public Builder setRequestUri(String requestUri) {
+ this.requestUri = requestUri;
+ return this;
+ }
- public RequestClientParamater build(){
- return new RequestClientParamater(this);
+ public RequestClientParameter build(){
+ return new RequestClientParameter(this);
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
new file mode 100644
index 0000000000..fc6da3fa7d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
@@ -0,0 +1,221 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandler.common;
+
+
+import java.io.IOException;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.util.EntityUtils;
+import org.onap.so.apihandler.camundabeans.CamundaResponse;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ResponseHandler {
+
+ private CamundaResponse response;
+ private int status;
+ private String responseBody="";
+ private HttpResponse httpResponse;
+ private int type;
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ResponseHandler.class);
+
+ public ResponseHandler(HttpResponse httpResponse, int type) throws ApiException{
+ this.httpResponse = httpResponse;
+ this.type=type;
+ parseResponse();
+ }
+
+
+ private void parseResponse() throws ApiException{
+ int statusCode = httpResponse.getStatusLine().getStatusCode();
+ status = setStatus(statusCode);
+ if(type==CommonConstants.CAMUNDA){
+ parseCamunda();
+ }else if(type==CommonConstants.CAMUNDATASK){
+ parseCamundaTask();
+ }else {
+ parseBpel();
+ }
+
+ }
+
+
+
+ private void parseCamunda() throws ApiException{
+ try{
+ HttpEntity entity = httpResponse.getEntity();
+ responseBody = EntityUtils.toString(entity);
+ } catch (IOException e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("IOException getting Camunda response body", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ response = mapper.readValue(responseBody, CamundaResponse.class);
+ } catch (IOException e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("JSON Object Mapping Request", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+ if(response!=null){
+ responseBody = response.getResponse();
+ }else{
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError)
+ .targetEntity("Camunda").targetServiceName("parseCamunda").build();
+ BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
+ .errorInfo(errorLoggerInfo).build();
+ }
+ }
+
+ private void parseBpel() throws ApiException{
+
+ HttpEntity bpelEntity = httpResponse.getEntity();
+
+ try {
+ if (bpelEntity != null) {
+ responseBody = EntityUtils.toString(bpelEntity);
+
+ }
+ }catch(IOException e){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ValidateException validateException = new ValidateException.Builder("Could not convert BPEL response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+ if(status!=HttpStatus.SC_ACCEPTED){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError)
+ .targetEntity("BPEL").targetServiceName("parseBpel").build();
+
+
+ BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
+ .errorInfo(errorLoggerInfo).build();
+
+ throw bpmnFailureException;
+ }
+
+ }
+
+ private void parseCamundaTask() throws ApiException{
+
+ HttpEntity camundataskEntity = httpResponse.getEntity();
+
+ try {
+ if (camundataskEntity != null) {
+ responseBody = EntityUtils.toString(camundataskEntity);
+ }
+ }catch(IOException e) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+
+
+ ValidateException validateException = new ValidateException.Builder("Could not convert CamundaTask response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ throw validateException;
+ }
+ if(status!=HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED){
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError)
+ .targetEntity("CAMUNDATASK").targetServiceName("parseCamundaTask").build();
+
+
+ BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
+ .errorInfo(errorLoggerInfo).build();
+
+ throw bpmnFailureException;
+ }
+
+ }
+
+ private int setStatus(int statusCode){
+ int httpStatus;
+ switch(statusCode) {
+ case HttpStatus.SC_ACCEPTED:
+ case HttpStatus.SC_OK:
+ httpStatus = HttpStatus.SC_ACCEPTED;
+ break;
+ case HttpStatus.SC_BAD_REQUEST:
+ httpStatus = HttpStatus.SC_BAD_REQUEST;
+ break;
+ case HttpStatus.SC_UNAUTHORIZED:
+ case HttpStatus.SC_FORBIDDEN:
+ httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR;
+ break;
+ case HttpStatus.SC_NOT_FOUND:
+ httpStatus = HttpStatus.SC_NOT_IMPLEMENTED;
+ break;
+ case HttpStatus.SC_INTERNAL_SERVER_ERROR:
+ httpStatus = HttpStatus.SC_BAD_GATEWAY;
+ break;
+ case HttpStatus.SC_SERVICE_UNAVAILABLE:
+ httpStatus = HttpStatus.SC_SERVICE_UNAVAILABLE;
+ break;
+ case HttpStatus.SC_NO_CONTENT:
+ httpStatus = HttpStatus.SC_NO_CONTENT;
+ break;
+ default:
+ httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR;
+ break;
+ }
+ return httpStatus;
+ }
+
+
+ public CamundaResponse getResponse() {
+ return response;
+ }
+
+
+ public void setResponse(CamundaResponse response) {
+ this.response = response;
+ }
+
+
+ public String getResponseBody() {
+ return responseBody;
+ }
+
+
+ public void setResponseBody(String responseBody) {
+ this.responseBody = responseBody;
+ }
+
+
+ public int getStatus() {
+ return status;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
index ebb1dd28cf..3c72e479c7 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.apihandler.common;
+package org.onap.so.apihandler.common;
import java.io.FileInputStream;
@@ -32,22 +32,21 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.apache.commons.io.IOUtils;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
import org.xml.sax.SAXException;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
-
public class XMLValidator {
- private static String xsdsPath;
+ private static String XSDS_PATH;
static {
String prefixMsoPropertiesPath = System.getProperty ("mso.config.path");
if (prefixMsoPropertiesPath == null) {
prefixMsoPropertiesPath = "";
}
- xsdsPath = prefixMsoPropertiesPath + "xsds/";
+ XSDS_PATH = prefixMsoPropertiesPath + "xsds/";
}
private String stringXsd;
@@ -55,17 +54,17 @@ public class XMLValidator {
private SchemaFactory factory;
private Schema schema;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, XMLValidator.class);
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
- public XMLValidator (String xsdFile) {
+ public XMLValidator (String xsdFile){
- try (FileInputStream xsdStream = new FileInputStream (xsdsPath + xsdFile)) {
+ try (FileInputStream xsdStream = new FileInputStream (XSDS_PATH + xsdFile)) {
stringXsd = IOUtils.toString (xsdStream);
factory = SchemaFactory.newInstance (XMLConstants.W3C_XML_SCHEMA_NS_URI);
- factory.setResourceResolver (new PathResourceResolver (xsdsPath));
+ factory.setResourceResolver (new PathResourceResolver (XSDS_PATH));
factory.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true);
String quotedXsd = stringXsd.replaceAll ("&#34;", "\"");
@@ -73,7 +72,8 @@ public class XMLValidator {
schema = factory.newSchema (src);
} catch (IOException | SAXException e) {
- msoLogger.debug ("Cannot open file " + xsdsPath + xsdFile, e);
+
+ msoLogger.debug ("Cannot open file " + XSDS_PATH + xsdFile, e);
errorMsg = "ErrorDetails: xsd file " + xsdFile + "could not be opened - " + e.getMessage ();
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
new file mode 100644
index 0000000000..d801a94c9b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandler.recipe;
+
+import java.io.IOException;
+
+import org.onap.so.logger.MsoLogger;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.client.ClientHttpResponse;
+import org.springframework.web.client.ResponseErrorHandler;
+
+
+
+public class CamundaClientErrorHandler implements ResponseErrorHandler{
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClientErrorHandler.class);
+
+ @Override
+ public void handleError(ClientHttpResponse response) throws IOException {
+
+ msoLogger.debug(response.getBody().toString());
+ //msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR,
+ // MsoLogger.ResponseCode.CommunicationError, e.getMessage(), "BPMN", fullURL, null);
+ }
+
+ @Override
+ public boolean hasError(ClientHttpResponse response) throws IOException {
+ HttpStatus.Series series = response.getStatusCode().series();
+ return (HttpStatus.Series.CLIENT_ERROR.equals(series)
+ || HttpStatus.Series.SERVER_ERROR.equals(series));
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
new file mode 100644
index 0000000000..e920db2fd2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+/*
+ * Enum for Status values returned by API Handler to Tail-F
+*/
+public enum Action {
+ createInstance,
+ updateInstance,
+ deleteInstance,
+ configureInstance,
+ replaceInstance,
+ activateInstance,
+ deactivateInstance,
+ enablePort,
+ disablePort,
+ addRelationships,
+ removeRelationships,
+ inPlaceSoftwareUpdate,
+ applyUpdatedConfig,
+ completeTask,
+ assignInstance,
+ unassignInstance,
+ compareModel,
+ scaleInstance
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
new file mode 100644
index 0000000000..fe105a7637
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+
+public class Constants {
+
+ private Constants() {
+ }
+
+ public static final String REQUEST_ID_PATH = "/{request-id}";
+
+ public static final String STATUS_SUCCESS = "SUCCESS";
+
+ public static final String MODIFIED_BY_APIHANDLER = "APIH";
+
+ public static final long PROGRESS_REQUEST_COMPLETED = 100L;
+ public static final long PROGRESS_REQUEST_RECEIVED = 0L;
+ public static final long PROGRESS_REQUEST_IN_PROGRESS = 20L;
+
+ public static final String VNF_TYPE_WILDCARD = "*";
+
+ public static final String VOLUME_GROUP_COMPONENT_TYPE = "VOLUME_GROUP";
+
+ public static final String VALID_INSTANCE_NAME_FORMAT = "^[a-zA-Z][a-zA-Z0-9._-]*$";
+
+ public static final String A_LA_CARTE = "aLaCarte";
+
+ public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ public final static String VNF_REQUEST_SCOPE = "vnf";
+ public final static String SERVICE_INSTANCE_PATH = "/serviceInstances";
+ public final static String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation";
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Messages.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Messages.java
new file mode 100644
index 0000000000..555c536efb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Messages.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.so.apihandler.common.ErrorNumbers;
+
+public class Messages {
+
+ protected static final Map<String,String> errors = new HashMap<>();
+ static {
+ errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_service", "Service request FAILED schema validation. %s");
+ errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_feature", "Feature request FAILED schema validation. %s");
+ errors.put(ErrorNumbers.RECIPE_DOES_NOT_EXIST, "Recipe for %s-type and action specified does not exist in catalog %s");
+ errors.put(ErrorNumbers.SERVICE_PARAMETERS_FAILED_SCHEMA_VALIDATION, "Service specific parameters passed in request FAILED schema validation. %s");
+
+ errors.put(ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS, "%s-name (%s) is locked (status = %s) because already working on a CREATE request with same %s-name.");
+ errors.put(ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID, "%s-id (%s) is locked (status = %s) because already working on a request with same action (%s) for this %s-id.");
+ errors.put(ErrorNumbers.REQUEST_TIMED_OUT, "Service request timed out before completing");
+ errors.put(ErrorNumbers.ERROR_FROM_BPEL, "BPEL returned an error: %s");
+ errors.put(ErrorNumbers.NO_COMMUNICATION_TO_BPEL, "Could not communicate with BPEL %s");
+ errors.put(ErrorNumbers.NO_RESPONSE_FROM_BPEL, "No response from BPEL %s");
+ errors.put(ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, "Could not insert or update record in MSO_REQUESTS DB %s");
+ errors.put(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, "Could not communicate with MSO_REQUESTS DB %s");
+ errors.put(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, "Could not communicate with MSO_CATALOG DB %s");
+ errors.put(ErrorNumbers.ERROR_FROM_CATALOG_DB, "Received error from MSO_CATALOG DB %s");
+ }
+
+ private Messages(){
+ }
+
+ public static Map<String,String> getErrors() {
+ return errors;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java
new file mode 100644
index 0000000000..7b3ea3a181
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+/*
+ * Enum for Status values returned by API Handler to Tail-F
+*/
+public enum ModelType {
+ service,
+ vnf,
+ vfModule,
+ volumeGroup,
+ network
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/package-info.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/MsoException.java
index 7859412ead..defc904b05 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/package-info.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/MsoException.java
@@ -18,8 +18,9 @@
* ============LICENSE_END=========================================================
*/
-/**
- * Common classes for API Handlers.
- */
-package org.openecomp.mso.apihandler.common;
+package org.onap.so.apihandlerinfra;
+public enum MsoException {
+ ServiceException,
+ PolicyException,
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java
new file mode 100644
index 0000000000..fe9764a2f2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+
+/*
+ * Enum for Status values returned by API Handler to Tail-F
+*/
+public enum Status {
+ PENDING,
+ IN_PROGRESS,
+ COMPLETE,
+ COMPLETED,
+ FAILED,
+ TIMEOUT,
+ UNLOCKED,
+ PENDING_MANUAL_TASK
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java
new file mode 100644
index 0000000000..dc52bfcc6b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.exceptions;
+
+
+import java.util.List;
+
+import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+
+public abstract class ApiException extends Exception{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 683162058616691134L;
+ private int httpResponseCode;
+ private String messageID;
+ private ErrorLoggerInfo errorLoggerInfo;
+ private AlarmLoggerInfo alarmLoggerInfo;
+ private List<String> variables;
+
+ public ApiException(Builder builder){
+ super(builder.message, builder.cause);
+
+ this.httpResponseCode = builder.httpResponseCode;
+ this.messageID = builder.messageID;
+ this.variables = builder.variables;
+ this.errorLoggerInfo = builder.errorLoggerInfo;
+ this.alarmLoggerInfo = builder.alarmLoggerInfo;
+ this.variables = builder.variables;
+ }
+
+ public ApiException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public String getMessageID() {
+ return messageID;
+ }
+
+ public int getHttpResponseCode() {
+ return httpResponseCode;
+ }
+
+ public ErrorLoggerInfo getErrorLoggerInfo() {
+ return errorLoggerInfo;
+ }
+
+ public AlarmLoggerInfo getAlarmLoggerInfo() {
+ return alarmLoggerInfo;
+ }
+
+ public List<String> getVariables() {
+ return variables;
+ }
+
+ public static class Builder<T extends Builder<T>> {
+ private String message;
+ private Throwable cause = null;
+ private int httpResponseCode;
+ private String messageID;
+ private ErrorLoggerInfo errorLoggerInfo = null;
+ private AlarmLoggerInfo alarmLoggerInfo = null;
+ private List<String> variables = null;
+
+ public Builder(String message, int httpResponseCode, String messageID) {
+ this.message = message;
+ this.httpResponseCode = httpResponseCode;
+ this.messageID = messageID;
+ }
+
+ public T message(String message) {
+ this.message = message;
+ return (T) this;
+ }
+
+ public T cause(Throwable cause) {
+ this.cause = cause;
+ return (T) this;
+ }
+
+ public T httpResponseCode(int httpResponseCode) {
+ this.httpResponseCode = httpResponseCode;
+ return (T) this;
+ }
+
+ public T messageID(String messageID) {
+ this.messageID = messageID;
+ return (T) this;
+ }
+
+ public T errorInfo(ErrorLoggerInfo errorLoggerInfo){
+ this.errorLoggerInfo = errorLoggerInfo;
+ return (T) this;
+ }
+
+ public T alarmInfo(AlarmLoggerInfo alarmLoggerInfo){
+ this.alarmLoggerInfo = alarmLoggerInfo;
+ return (T) this;
+ }
+
+ public T variables(List<String> variables) {
+ this.variables = variables;
+ return (T) this;
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
new file mode 100644
index 0000000000..e0bcc71736
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.exceptions;
+
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+@Provider
+public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
+
+ private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ApiExceptionMapper.class);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+ @Override
+ public Response toResponse(ApiException exception) {
+
+ return Response.status(exception.getHttpResponseCode()).entity(buildErrorString(exception)).build();
+ }
+
+ protected String buildErrorString(ApiException exception) {
+ String errorText = exception.getMessage();
+ String messageId = exception.getMessageID();
+ List<String> variables = exception.getVariables();
+ ErrorLoggerInfo errorLoggerInfo = exception.getErrorLoggerInfo();
+ AlarmLoggerInfo alarmLoggerInfo = exception.getAlarmLoggerInfo();
+
+
+ if (errorText.length() > 1999) {
+ errorText = errorText.substring(0, 1999);
+ }
+
+ writeErrorLog(errorText, errorLoggerInfo, alarmLoggerInfo);
+
+ return buildServiceErrorResponse(errorText,messageId,variables);
+
+ }
+
+ protected String buildServiceErrorResponse(String errorText, String messageId, List<String> variables){
+ RequestError re = new RequestError();
+ ServiceException se = new ServiceException();
+ se.setMessageId(messageId);
+ se.setText(errorText);
+ if (variables != null) {
+ for (String variable : variables) {
+ se.getVariables().add(variable);
+ }
+ }
+ re.setServiceException(se);
+ String requestErrorStr;
+
+ ObjectMapper mapper = createObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
+ try {
+ requestErrorStr = mapper.writeValueAsString(re);
+ } catch (JsonProcessingException e) {
+ String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage();
+ logger.error(MessageEnum.GENERAL_EXCEPTION, "BuildServiceErrorResponse", "", "", MsoLogger.ErrorCode.DataError, errorMsg, e);
+ return errorMsg;
+ }
+
+ return requestErrorStr;
+ }
+
+ protected void writeErrorLog(String errorText, ErrorLoggerInfo errorLogInfo, AlarmLoggerInfo alarmLogInfo) {
+
+ if(errorLogInfo != null)
+ logger.error(errorLogInfo.getLoggerMessageType().toString(), errorLogInfo.getErrorSource(), errorLogInfo.getTargetEntity(), errorLogInfo.getTargetServiceName(), errorLogInfo.getErrorCode(), errorText);
+ if(alarmLogInfo != null){
+ alarmLogger.sendAlarm(alarmLogInfo.getAlarm(),alarmLogInfo.getState(),alarmLogInfo.getDetail());
+ }
+ }
+
+ public ObjectMapper createObjectMapper(){
+ return new ObjectMapper();
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java
new file mode 100644
index 0000000000..8c215de213
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/BPMNFailureException.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.exceptions;
+
+public class BPMNFailureException extends ApiException {
+
+ private static final String bpmnFailMessage = "Request Failed due to BPEL error with HTTP Status = $HTTPSTATUS";
+
+ private BPMNFailureException(Builder builder) {
+ super(builder);
+ }
+
+ public static class Builder extends ApiException.Builder<Builder>{
+
+
+ public Builder(String message, int httpResponseCode, String messageID) {
+ super(bpmnFailMessage.replaceAll ("\\$HTTPSTATUS", message),httpResponseCode,messageID);
+ }
+
+ public BPMNFailureException build() {
+ return new BPMNFailureException(this);
+ }
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java
new file mode 100644
index 0000000000..cf4c9168ea
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ClientConnectionException.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.exceptions;
+
+public class ClientConnectionException extends ApiException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private static final String clientFailMessage = "Client from $URL failed to connect";
+
+ private ClientConnectionException(Builder builder) {
+ super(builder);
+ }
+
+ public static class Builder extends ApiException.Builder<Builder>{
+
+ public Builder(String message, int httpResponseCode, String messageID) {
+ super(clientFailMessage.replaceAll ("\\$URL", message),httpResponseCode,messageID);
+ }
+
+ public ClientConnectionException build() {
+ return new ClientConnectionException(this);
+ }
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java
new file mode 100644
index 0000000000..718dc6421d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.exceptions;
+
+public class DuplicateRequestException extends ApiException {
+
+ private static final String duplicateFailMessage = "Error: Locked instance - This %s (%s) " + "already has a request being worked with a status of %s (RequestId - %s). The existing request must finish or be cleaned up before proceeding.";
+
+ private DuplicateRequestException(Builder builder) {
+ super(builder);
+ }
+
+
+ public static class Builder extends ApiException.Builder<Builder>{
+
+
+ public Builder(String requestScope,String instance, String requestStatus, String requestID, int httpResponseCode, String messageID) {
+ super(String.format(duplicateFailMessage,requestScope,instance,requestStatus,requestID),httpResponseCode,messageID);
+
+ }
+
+
+ public DuplicateRequestException build() {
+
+ return new DuplicateRequestException(this);
+ }
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java
new file mode 100644
index 0000000000..620103be4e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.exceptions;
+
+
+public class RecipeNotFoundException extends ApiException {
+
+ private RecipeNotFoundException(Builder builder) {
+ super(builder);
+ }
+
+ public static class Builder extends ApiException.Builder<Builder> {
+
+
+ public Builder(String message, int httpResponseCode, String messageID) {
+ super(message, httpResponseCode, messageID);
+ }
+
+ public RecipeNotFoundException build() {
+
+ return new RecipeNotFoundException(this);
+ }
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java
new file mode 100644
index 0000000000..b0cf39e1a2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.exceptions;
+
+public class ValidateException extends ApiException {
+
+
+ private ValidateException(Builder builder) {
+ super(builder);
+ }
+
+
+ public static class Builder extends ApiException.Builder<Builder>{
+
+ public Builder(String message, int httpResponseCode, String messageID) {
+ super(message,httpResponseCode,messageID);
+ }
+
+ public ValidateException build() {
+
+ return new ValidateException(this);
+ }
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java
new file mode 100644
index 0000000000..d80f2f7b48
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/VfModuleNotFoundException.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.exceptions;
+
+public class VfModuleNotFoundException extends ApiException {
+
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private VfModuleNotFoundException(Builder builder) {
+ super(builder);
+ }
+
+ public static class Builder extends ApiException.Builder<Builder>{
+
+ public Builder(String message, int httpResponseCode, String messageID) {
+ super(message,httpResponseCode,messageID);
+ }
+ public VfModuleNotFoundException build() {
+
+ return new VfModuleNotFoundException(this);
+ }
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/AlarmLoggerInfo.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/AlarmLoggerInfo.java
new file mode 100644
index 0000000000..2746da4f2d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/AlarmLoggerInfo.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.logging;
+
+import java.io.Serializable;
+
+public class AlarmLoggerInfo implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6730979289437576112L;
+ private String alarm;
+ private int state;
+ private String detail;
+
+
+ private AlarmLoggerInfo(String alarm, int state, String detail){
+ this.alarm = alarm;
+ this.state = state;
+ this.detail = detail;
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public String getAlarm() {
+ return alarm;
+ }
+
+ public String getDetail() {
+ return detail;
+ }
+
+ public static class Builder{
+ private String alarm = "";
+ private int state;
+ private String detail = "";
+
+ public Builder(String alarm, int state, String detail){
+ this.alarm = alarm;
+ this.state = state;
+ this.detail = detail;
+ }
+
+ public Builder alarm(String alarm){
+ this.alarm = alarm;
+ return this;
+ }
+
+ public Builder state(int state){
+ this.state = state;
+ return this;
+ }
+
+ public Builder detail(String detail){
+ this.detail = detail;
+ return this;
+ }
+
+ public AlarmLoggerInfo build(){
+ return new AlarmLoggerInfo(alarm, state, detail);
+ }
+
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
new file mode 100644
index 0000000000..b0b154bc5c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.logging;
+
+import java.io.Serializable;
+
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger.ErrorCode;
+
+
+
+public class ErrorLoggerInfo implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2917784544098682110L;
+ private MessageEnum loggerMessageType;
+ private String errorSource;
+ private String targetEntity;
+ private String targetServiceName;
+ private ErrorCode errorCode;
+
+ private ErrorLoggerInfo(MessageEnum loggerMessageType, String errorSource, String targetEntity, String targetServiceName, ErrorCode errorCode){
+ this.loggerMessageType = loggerMessageType;
+ this.errorSource = errorSource;
+ this.targetEntity = targetEntity;
+ this.targetServiceName = targetServiceName;
+ this.errorCode = errorCode;
+ }
+
+ public MessageEnum getLoggerMessageType() {
+ return loggerMessageType;
+ }
+
+ public String getErrorSource() {
+ return errorSource;
+ }
+
+ public String getTargetEntity() {
+ return targetEntity;
+ }
+
+ public String getTargetServiceName() {
+ return targetServiceName;
+ }
+
+ public ErrorCode getErrorCode() {
+ return errorCode;
+ }
+
+ public static class Builder{
+ private MessageEnum loggerMessageType;
+ private String errorSource = "";
+ private String targetEntity = "";
+ private String targetServiceName = "";
+ private ErrorCode errorCode;
+
+ public Builder(MessageEnum loggerMessageType, ErrorCode errorCode){
+ this.loggerMessageType = loggerMessageType;
+ this.errorCode = errorCode;
+ }
+
+ public Builder loggerMessageType(MessageEnum loggerMessageType){
+ this.loggerMessageType = loggerMessageType;
+ return this;
+ }
+
+ public Builder errorSource(String errorSource){
+ this.errorSource = errorSource;
+ return this;
+ }
+
+ public Builder targetEntity(String targetEntity){
+ this.targetEntity = targetEntity;
+ return this;
+ }
+
+ public Builder targetServiceName(String targetServiceName){
+ this.targetServiceName = targetServiceName;
+ return this;
+ }
+
+ public Builder errorCode(ErrorCode errorCode){
+ this.errorCode = errorCode;
+ return this;
+ }
+
+ public ErrorLoggerInfo build(){
+ return new ErrorLoggerInfo(loggerMessageType, errorSource, targetEntity, targetServiceName, errorCode);
+ }
+
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java
deleted file mode 100644
index 85fe52f24c..0000000000
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandler.common;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.xml.bind.DatatypeConverter;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-
-import org.openecomp.mso.logger.MsoLogger;
-
-public class BPELRestClient extends RequestClient {
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
-
- public BPELRestClient () {
- super (CommonConstants.BPEL);
- }
-
- @Override
- public HttpResponse post (String bpelReqXML,
- String requestId,
- String requestTimeout,
- String schemaVersion,
- String serviceInstanceId,
- String action) throws ClientProtocolException, IOException {
- String encryptedCredentials;
- HttpPost post = new HttpPost (url);
- msoLogger.debug ("BPEL url is: " + url);
- StringEntity input = new StringEntity (bpelReqXML);
- input.setContentType (MediaType.TEXT_XML);
- if (props != null) {
- encryptedCredentials = props.getProperty (CommonConstants.BPEL_AUTH,null);
- if (encryptedCredentials != null) {
- String userCredentials = getEncryptedPropValue (encryptedCredentials,
- CommonConstants.DEFAULT_BPEL_AUTH,
- CommonConstants.ENCRYPTION_KEY);
- if (userCredentials != null) {
- post.addHeader ("Authorization",
- "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ()));
- }
- }
- }
- post.addHeader (CommonConstants.REQUEST_ID_HEADER, requestId);
- post.addHeader (CommonConstants.REQUEST_TIMEOUT_HEADER, requestTimeout);
- post.addHeader (CommonConstants.SCHEMA_VERSION_HEADER, schemaVersion);
- if (serviceInstanceId != null) {
- post.addHeader (CommonConstants.SERVICE_INSTANCE_ID_HEADER, serviceInstanceId);
- }
- if (action != null) {
- post.addHeader (CommonConstants.ACTION_HEADER, action);
- }
- post.setEntity (input);
- HttpResponse response = client.execute (post);
- msoLogger.debug ("bpel response " + response);
- return response;
- }
-
- @Override
- public HttpResponse post (String bpelReqXML) {
- return null;
- }
-
- @Override
- public HttpResponse post(RequestClientParamater params) {
- return null;
- }
-
- @Override
- public HttpResponse get() {
- return null;
- }
-}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java
deleted file mode 100644
index a8b8984343..0000000000
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandler.common;
-
-
-import java.io.IOException;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.util.EntityUtils;
-import org.openecomp.mso.apihandler.camundabeans.CamundaResponse;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.utils.RootIgnoringObjectMapper;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ResponseHandler {
-
- private CamundaResponse response;
- private int status;
- private String content = "";
- private HttpResponse httpResponse;
- private int type;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
- private static final String RESPONSE_CONTENT_MSG = "response content is: ";
-
- public ResponseHandler(HttpResponse httpResponse, int type) {
- this.httpResponse = httpResponse;
- this.type=type;
- parseResponse();
- }
-
-
- private void parseResponse() {
- int statusCode = httpResponse.getStatusLine().getStatusCode();
- msoLogger.debug("Returned status is: " + statusCode);
- status = setStatus(statusCode);
- msoLogger.debug("Parsed status is: " + status);
- if(type==CommonConstants.CAMUNDA){
- parseCamunda();
- }else if(type==CommonConstants.CAMUNDATASK){
- parseCamundaTask();
- }else {
- parseBpel();
- }
-
- }
-
-
-
- @SuppressWarnings("unchecked")
- private void parseCamunda(){
- try{
- HttpEntity entity = httpResponse.getEntity();
- content = EntityUtils.toString(entity);
- } catch (IOException e) {
- msoLogger.debug("IOException getting Camunda response content", e);
- }
-
- ObjectMapper mapper = new RootIgnoringObjectMapper<CamundaResponse>(CamundaResponse.class);
-
- try {
- response = mapper.readValue(content, CamundaResponse.class);
- } catch (IOException e) {
- msoLogger.debug("IOException getting Camunda response content", e);
- }
- msoLogger.debug("json response is: " + content);
- if(response!=null){
- content = response.getContent();
- }
- msoLogger.debug(RESPONSE_CONTENT_MSG + content);
-
-
- if(status!=HttpStatus.SC_ACCEPTED){
- msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "Camunda", String.valueOf(status), content, "Camunda", "parseCamunda", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda");
- }
- }
-
- private void parseBpel(){
-
- HttpEntity bpelEntity = httpResponse.getEntity();
-
- try {
- if (bpelEntity!=null) {
- content = EntityUtils.toString(bpelEntity);
- msoLogger.debug(RESPONSE_CONTENT_MSG + content);
-
- }
- if(status!=HttpStatus.SC_ACCEPTED){
- msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "BPEL", String.valueOf(status), content, "BPEL", "parseBpel", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from BPEL");
- }
- }
- catch (IOException e) {
- msoLogger.debug("IOException getting BPEL response content", e);
- }
- }
-
- private void parseCamundaTask(){
-
- HttpEntity camundataskEntity = httpResponse.getEntity();
-
- try {
- if (camundataskEntity!=null) {
- content = EntityUtils.toString(camundataskEntity);
- msoLogger.debug(RESPONSE_CONTENT_MSG + content);
-
- }
- if(status!=HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED){
- msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "CAMUNDATASK", String.valueOf(status), content, "CAMUNDATASK", "parseCamundaTask", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda Task");
- }
- }
- catch (IOException e) {
- msoLogger.debug("IOException getting Camunda Task response content", e);
- }
- }
-
- private int setStatus(int statusCode){
- int httpStatus;
- switch(statusCode) {
- case HttpStatus.SC_ACCEPTED:
- case HttpStatus.SC_OK:
- httpStatus = HttpStatus.SC_ACCEPTED;
- break;
- case HttpStatus.SC_BAD_REQUEST:
- httpStatus = HttpStatus.SC_BAD_REQUEST;
- break;
- case HttpStatus.SC_UNAUTHORIZED:
- case HttpStatus.SC_FORBIDDEN:
- httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR;
- break;
- case HttpStatus.SC_NOT_FOUND:
- httpStatus = HttpStatus.SC_NOT_IMPLEMENTED;
- break;
- case HttpStatus.SC_INTERNAL_SERVER_ERROR:
- httpStatus = HttpStatus.SC_BAD_GATEWAY;
- break;
- case HttpStatus.SC_SERVICE_UNAVAILABLE:
- httpStatus = HttpStatus.SC_SERVICE_UNAVAILABLE;
- break;
- case HttpStatus.SC_NO_CONTENT:
- httpStatus = HttpStatus.SC_NO_CONTENT;
- break;
- default:
- httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR;
- break;
- }
- return httpStatus;
- }
-
-
- public CamundaResponse getResponse() {
- return response;
- }
-
-
- public void setResponse(CamundaResponse response) {
- this.response = response;
- }
-
-
- public String getContent() {
- return content;
- }
-
-
- public void setContent(String content) {
- this.content = content;
- }
-
-
- public int getStatus() {
- return status;
- }
-}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java
deleted file mode 100644
index 73bf020c21..0000000000
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.apihandler.common;
-
-
-public class ValidationException extends Exception {
-
- /**
- * This class simply extends Exception (without addition additional functionality)
- * to provide an identifier for RequestsDB related exceptions on create, delete, query.
- *
- *
- **/
-
- private static final long serialVersionUID = 1L;
- private static final String VALIDATION_FAIL_MESSAGE = "No valid $ELEMENT is specified";
- private static final String INVALID_ELEMENT_MESSAGE = "$ELEMENT is not valid in the $VERSION version";
- private static final String ELEMENT_MESSAGE = "\\$ELEMENT";
-
- public ValidationException (String msg) {
- super (VALIDATION_FAIL_MESSAGE.replaceAll (ELEMENT_MESSAGE, msg));
- }
-
- public ValidationException (String msg, Exception cause) {
- super (VALIDATION_FAIL_MESSAGE.replaceAll (ELEMENT_MESSAGE, msg), cause);
- }
- public ValidationException(String msg, String version) {
- super(INVALID_ELEMENT_MESSAGE.replaceAll(ELEMENT_MESSAGE, msg).replaceAll("\\$VERSION", version));
- }
-}