From 781b1a6df324419c846c84ea983c18fc8362bfd3 Mon Sep 17 00:00:00 2001 From: Patrick Brady Date: Wed, 13 Dec 2017 11:19:06 -0800 Subject: Third part of onap rename This part of the commit changes the folder structure on all other folders of appc. Change-Id: I8acfa11cdfcdcd36be0e137245d1dd7324f1abd3 Signed-off-by: Patrick Brady Issue-ID: APPC-13 --- .../org/onap/appc/executor/CommandExecutor.java | 44 +++++++ .../onap/appc/executor/UnstableVNFException.java | 32 ++++++ .../org/onap/appc/executor/conv/Converter.java | 52 +++++++++ .../appc/executor/objects/CommandResponse.java | 42 +++++++ .../appc/executor/objects/LCMCommandStatus.java | 121 ++++++++++++++++++++ .../org/onap/appc/executor/objects/Params.java | 60 ++++++++++ .../executor/objects/UniqueRequestIdentifier.java | 126 +++++++++++++++++++++ .../openecomp/appc/executor/CommandExecutor.java | 44 ------- .../appc/executor/UnstableVNFException.java | 32 ------ .../openecomp/appc/executor/conv/Converter.java | 52 --------- .../appc/executor/objects/CommandResponse.java | 42 ------- .../appc/executor/objects/LCMCommandStatus.java | 121 -------------------- .../openecomp/appc/executor/objects/Params.java | 60 ---------- .../executor/objects/UniqueRequestIdentifier.java | 126 --------------------- 14 files changed, 477 insertions(+), 477 deletions(-) create mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/CommandExecutor.java create mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/UnstableVNFException.java create mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/conv/Converter.java create mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/CommandResponse.java create mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/LCMCommandStatus.java create mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/Params.java create mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/UniqueRequestIdentifier.java delete mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java delete mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/UnstableVNFException.java delete mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/conv/Converter.java delete mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandResponse.java delete mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java delete mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/Params.java delete mode 100644 appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/UniqueRequestIdentifier.java (limited to 'appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org') diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/CommandExecutor.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/CommandExecutor.java new file mode 100644 index 000000000..d6935b83a --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/CommandExecutor.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * 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. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +/** + * + */ +package org.onap.appc.executor; + + +import org.onap.appc.domainmodel.lcm.RuntimeContext; +import org.onap.appc.exceptions.APPCException; + + + +public interface CommandExecutor { + /** + * Execute given command + * Create command request and enqueue it for execution. + * @param commandHeaderInput Contains CommandHeader, command , target Id , payload and conf ID (optional) + * @throws APPCException in case of error. + */ + void executeCommand(RuntimeContext commandHeaderInput) throws APPCException; +} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/UnstableVNFException.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/UnstableVNFException.java new file mode 100644 index 000000000..634bd0f68 --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/UnstableVNFException.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * 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. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.onap.appc.executor; + + +public class UnstableVNFException extends Exception{ + public UnstableVNFException(String message){ + super(message); + } +} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/conv/Converter.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/conv/Converter.java new file mode 100644 index 000000000..3cfc7ece7 --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/conv/Converter.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * 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. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.onap.appc.executor.conv; + +import java.io.IOException; + +import org.onap.appc.executor.objects.Params; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + + +public class Converter { + + public static Params convJsonStringToParams(String inObj) throws IOException { + Params outObj = null; + if(inObj != null) { + outObj = new ObjectMapper().readValue(inObj, Params.class); + } + return outObj; + } + + public static String convParamsToJsonString(Params inObj) throws JsonProcessingException { + String outObj = null; + if(inObj != null) { + outObj = new ObjectMapper().writeValueAsString(inObj); + } + return outObj; + } +} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/CommandResponse.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/CommandResponse.java new file mode 100644 index 000000000..4e7b9b17f --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/CommandResponse.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * 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. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.onap.appc.executor.objects; + +import org.onap.appc.domainmodel.lcm.RuntimeContext; + + +public class CommandResponse { + + private final RuntimeContext runtimeContext; + + public CommandResponse(RuntimeContext runtimeContext) { + super(); + this.runtimeContext = runtimeContext; + } + + public RuntimeContext getRuntimeContext() { + return runtimeContext; + } +} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/LCMCommandStatus.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/LCMCommandStatus.java new file mode 100644 index 000000000..be13fd0ff --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/LCMCommandStatus.java @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * 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. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.onap.appc.executor.objects; + + +import org.apache.commons.lang3.StringUtils; +import org.onap.appc.domainmodel.lcm.Status; +import org.onap.appc.util.MessageFormatter; + +import java.util.Map; + +public enum LCMCommandStatus { + + ACCEPTED(100,"ACCEPTED - request accepted"), + + //ERROR(2xx) - request can't be handled due to some technical error + UNEXPECTED_ERROR(200,"UNEXPECTED ERROR - ${errorMsg}"), + + //REJECT(3xx) - request has been rejected due to some business reason (e.g. no such service-instance-id, command is not supported, etc) + REJECTED(300,"REJECTED - ${errorMsg}"), + INVALID_INPUT_PARAMETER(301,"INVALID INPUT PARAMETER - ${errorMsg}"),// TODO 77777777 to support "${paramName} with invalid value ${paramValue}" + MISSING_MANDATORY_PARAMETER(302,"MISSING MANDATORY PARAMETER - Parameter/s ${paramName} is/are missing" ), + REQUEST_PARSING_FAILED(303,"REQUEST PARSING FAILED - ${errorMsg}"), + NO_TRANSITION_DEFINE(304,"ACTION IS NOT ALLOWED - Action ${actionName} is not allowed for VNF in state ${currentState}"), + INVALID_VNF_STATE(305,"Request rejected because VNF status in A&AI is - ${currentState}" ), + VNF_NOT_FOUND(306,"VNF NOT FOUND - VNF with ID ${vnfId} was not found" ), + DG_WORKFLOW_NOT_FOUND(307,"DG WORKFLOW NOT FOUND - No DG workflow found for the combination of ${dgModule} module ${dgName} name and ${dgVersion} version"),//TODO need to support it + WORKFLOW_NOT_FOUND(308,"WORKFLOW NOT FOUND - No workflow found for VNF type ${vnfTypeVersion} and ${actionName} action"), + UNSTABLE_VNF(309,"UNSTABLE VNF - VNF ${vnfId} is not stable to accept the command"), + LOCKING_FAILURE(310,"LOCKING FAILURE - ${errorMsg}" ), + EXPIRED_REQUEST(311,"EXPIRED REQUEST"), + DUPLICATE_REQUEST(312,"DUPLICATE REQUEST"), + MISSING_VNF_DATA_IN_AAI(313,"MISSING VNF DATA IN A&AI - ${attributeName} not found for VNF ID = ${vnfId}"), + + SUCCESS(400,"SUCCESS - request has been processed successfully"), + + + // FAILURE(5xx) - request processing results with failure. The FAILURE response is always transmitted asynchronously, via DMaaP. + DG_FAILURE(401,"DG FAILURE - ${errorMsg}"), + NO_TRANSITION_DEFINE_FAILURE(402,"NO TRANSITION DEFINE - No Transition Defined for ${actionName} action and ${currentState} state"), + UPDATE_AAI_FAILURE(403,"UPDATE_AAI_FAILURE - failed to update AAI. ${errorMsg}"), + EXPIRED_REQUEST_FAILURE(404,"EXPIRED REQUEST FAILURE - failed after accepted because TTL expired"), + UNEXPECTED_FAILURE(405,"UNEXPECTED FAILURE - ${errorMsg}"), + UNSTABLE_VNF_FAILURE(406,"UNSTABLE VNF FAILURE - VNF ${vnfId} is not stable to accept the command"), + + ; + + + public static final String errorDgMessageParamName = "errorDgMessage"; + + private int responseCode; + private String responseMessage; + + + + + LCMCommandStatus(int responseCode, String responseMessage) { + this.responseCode = responseCode; + this.responseMessage = responseMessage; + } + + public String getResponseMessage() { + return responseMessage; + } + + public int getResponseCode() { + return responseCode; + } + + + /** + * + * @return messageTemplate + */ + + + public String getFormattedMessage(Params params){ + Map paramsMap = params != null ? params.getParams() : null; + return MessageFormatter.format(getResponseMessage(),paramsMap); + + } + + public String getFormattedMessageWithCode(Params params){ + return getResponseCode()+"-" + getFormattedMessage(params); + } + + @Override + public String toString() { + return "LCMCommandStatus{" + + "responseCode=" + responseCode + + ", responseMessage='" + responseMessage + '\'' + + '}'; + } + + public Status toStatus(Params params) { + return new Status(responseCode, getFormattedMessage(params)); + } +} + diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/Params.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/Params.java new file mode 100644 index 000000000..c3cae7bcd --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/Params.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * 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. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.onap.appc.executor.objects; + +import java.lang.Object; +import java.util.HashMap; +import java.util.Map; + + +public class Params { + public static final String paramDgNameSpace = "dg.status.message.param."; + public static final String errorDgMessageParamName = "errorDgMessage"; + private Map params; + + public Params() { + } + + public Map getParams() { + return params; + } + + public void setParams(Map params) { + this.params = params; + } + + public Params addParam(String paramName, java.lang.Object paramValue) { + params = params == null ? new HashMap() : params; + params.put(paramName, paramValue); + return this; + } + + @Override + public String toString() { + return "Params{" + + "params=" + params + + '}'; + } +} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/UniqueRequestIdentifier.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/UniqueRequestIdentifier.java new file mode 100644 index 000000000..b2f2a1d89 --- /dev/null +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/onap/appc/executor/objects/UniqueRequestIdentifier.java @@ -0,0 +1,126 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * 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. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.onap.appc.executor.objects; + + +import org.apache.commons.lang3.StringUtils; + + +public class UniqueRequestIdentifier { + private static final String IDENTIFIER_DELIMITER = "@"; + + private String originatorID; + private String requestID; + private String subRequestID; + + private UniqueRequestIdentifier(){ + + } + public UniqueRequestIdentifier(String originatorID, + String requestID, + String subRequestID) { + this(); + this.originatorID = originatorID; + this.requestID = requestID; + this.subRequestID = subRequestID; + } + + public String toIdentifierString(){ + StringBuilder stringBuilder = new StringBuilder(); + if(originatorID != null){ + stringBuilder.append(originatorID); + } + stringBuilder.append(IDENTIFIER_DELIMITER); + + if(requestID != null){ + stringBuilder.append(requestID); + } + stringBuilder.append(IDENTIFIER_DELIMITER); + + if(subRequestID != null){ + stringBuilder.append(subRequestID); + } + return stringBuilder.toString(); + } + + public static UniqueRequestIdentifier getUniqueRequestIdentifier(String identifierString){ + String[] splitIdentifier = identifierString.split(IDENTIFIER_DELIMITER); + if(splitIdentifier == null || splitIdentifier.length <2){ + throw new IllegalArgumentException("input identifierString is not valid "+identifierString); + } + String originatorID = splitIdentifier[0]; + String requestID = StringUtils.isEmpty(splitIdentifier[1])? null :splitIdentifier[1]; + String subRequestID = splitIdentifier.length>=3 ? splitIdentifier[2] : null; + return new UniqueRequestIdentifier(originatorID,requestID,subRequestID); + } + public String toString(){ + return "originatorID = " + originatorID + + " , requestID = " + requestID + + " , subRequestID = " + subRequestID; + } + @Override + public boolean equals(Object obj){ + if(obj ==null){ + return false; + } + if(!(obj instanceof UniqueRequestIdentifier)){ + return false; + } + UniqueRequestIdentifier identifier = (UniqueRequestIdentifier)obj; + if(this.originatorID == null){ + if(identifier.originatorID !=null) + return false; + } + else if(!this.originatorID.equals(identifier.originatorID)) + return false; + + if(this.requestID == null){ + if(identifier.requestID !=null) + return false; + } + else if(!this.requestID.equals(identifier.requestID)) + return false; + + if(this.subRequestID == null){ + if(identifier.subRequestID !=null) + return false; + } + else if(!this.subRequestID.equals(identifier.subRequestID)) + return false; + + return true; + } + @Override + public int hashCode(){ + final int prime = 31; + int result = 1; + result = result * prime + (this.originatorID == null ? 0 :this.originatorID.hashCode()); + result = result * prime + (this.requestID == null ? 0 :this.requestID.hashCode()); + result = result * prime + (this.subRequestID == null ? 0 :this.subRequestID.hashCode()); + return result; + } + + +} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java deleted file mode 100644 index d6935b83a..000000000 --- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -/** - * - */ -package org.onap.appc.executor; - - -import org.onap.appc.domainmodel.lcm.RuntimeContext; -import org.onap.appc.exceptions.APPCException; - - - -public interface CommandExecutor { - /** - * Execute given command - * Create command request and enqueue it for execution. - * @param commandHeaderInput Contains CommandHeader, command , target Id , payload and conf ID (optional) - * @throws APPCException in case of error. - */ - void executeCommand(RuntimeContext commandHeaderInput) throws APPCException; -} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/UnstableVNFException.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/UnstableVNFException.java deleted file mode 100644 index 634bd0f68..000000000 --- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/UnstableVNFException.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.executor; - - -public class UnstableVNFException extends Exception{ - public UnstableVNFException(String message){ - super(message); - } -} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/conv/Converter.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/conv/Converter.java deleted file mode 100644 index 3cfc7ece7..000000000 --- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/conv/Converter.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.executor.conv; - -import java.io.IOException; - -import org.onap.appc.executor.objects.Params; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - - -public class Converter { - - public static Params convJsonStringToParams(String inObj) throws IOException { - Params outObj = null; - if(inObj != null) { - outObj = new ObjectMapper().readValue(inObj, Params.class); - } - return outObj; - } - - public static String convParamsToJsonString(Params inObj) throws JsonProcessingException { - String outObj = null; - if(inObj != null) { - outObj = new ObjectMapper().writeValueAsString(inObj); - } - return outObj; - } -} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandResponse.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandResponse.java deleted file mode 100644 index 4e7b9b17f..000000000 --- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandResponse.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.executor.objects; - -import org.onap.appc.domainmodel.lcm.RuntimeContext; - - -public class CommandResponse { - - private final RuntimeContext runtimeContext; - - public CommandResponse(RuntimeContext runtimeContext) { - super(); - this.runtimeContext = runtimeContext; - } - - public RuntimeContext getRuntimeContext() { - return runtimeContext; - } -} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java deleted file mode 100644 index be13fd0ff..000000000 --- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java +++ /dev/null @@ -1,121 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.executor.objects; - - -import org.apache.commons.lang3.StringUtils; -import org.onap.appc.domainmodel.lcm.Status; -import org.onap.appc.util.MessageFormatter; - -import java.util.Map; - -public enum LCMCommandStatus { - - ACCEPTED(100,"ACCEPTED - request accepted"), - - //ERROR(2xx) - request can't be handled due to some technical error - UNEXPECTED_ERROR(200,"UNEXPECTED ERROR - ${errorMsg}"), - - //REJECT(3xx) - request has been rejected due to some business reason (e.g. no such service-instance-id, command is not supported, etc) - REJECTED(300,"REJECTED - ${errorMsg}"), - INVALID_INPUT_PARAMETER(301,"INVALID INPUT PARAMETER - ${errorMsg}"),// TODO 77777777 to support "${paramName} with invalid value ${paramValue}" - MISSING_MANDATORY_PARAMETER(302,"MISSING MANDATORY PARAMETER - Parameter/s ${paramName} is/are missing" ), - REQUEST_PARSING_FAILED(303,"REQUEST PARSING FAILED - ${errorMsg}"), - NO_TRANSITION_DEFINE(304,"ACTION IS NOT ALLOWED - Action ${actionName} is not allowed for VNF in state ${currentState}"), - INVALID_VNF_STATE(305,"Request rejected because VNF status in A&AI is - ${currentState}" ), - VNF_NOT_FOUND(306,"VNF NOT FOUND - VNF with ID ${vnfId} was not found" ), - DG_WORKFLOW_NOT_FOUND(307,"DG WORKFLOW NOT FOUND - No DG workflow found for the combination of ${dgModule} module ${dgName} name and ${dgVersion} version"),//TODO need to support it - WORKFLOW_NOT_FOUND(308,"WORKFLOW NOT FOUND - No workflow found for VNF type ${vnfTypeVersion} and ${actionName} action"), - UNSTABLE_VNF(309,"UNSTABLE VNF - VNF ${vnfId} is not stable to accept the command"), - LOCKING_FAILURE(310,"LOCKING FAILURE - ${errorMsg}" ), - EXPIRED_REQUEST(311,"EXPIRED REQUEST"), - DUPLICATE_REQUEST(312,"DUPLICATE REQUEST"), - MISSING_VNF_DATA_IN_AAI(313,"MISSING VNF DATA IN A&AI - ${attributeName} not found for VNF ID = ${vnfId}"), - - SUCCESS(400,"SUCCESS - request has been processed successfully"), - - - // FAILURE(5xx) - request processing results with failure. The FAILURE response is always transmitted asynchronously, via DMaaP. - DG_FAILURE(401,"DG FAILURE - ${errorMsg}"), - NO_TRANSITION_DEFINE_FAILURE(402,"NO TRANSITION DEFINE - No Transition Defined for ${actionName} action and ${currentState} state"), - UPDATE_AAI_FAILURE(403,"UPDATE_AAI_FAILURE - failed to update AAI. ${errorMsg}"), - EXPIRED_REQUEST_FAILURE(404,"EXPIRED REQUEST FAILURE - failed after accepted because TTL expired"), - UNEXPECTED_FAILURE(405,"UNEXPECTED FAILURE - ${errorMsg}"), - UNSTABLE_VNF_FAILURE(406,"UNSTABLE VNF FAILURE - VNF ${vnfId} is not stable to accept the command"), - - ; - - - public static final String errorDgMessageParamName = "errorDgMessage"; - - private int responseCode; - private String responseMessage; - - - - - LCMCommandStatus(int responseCode, String responseMessage) { - this.responseCode = responseCode; - this.responseMessage = responseMessage; - } - - public String getResponseMessage() { - return responseMessage; - } - - public int getResponseCode() { - return responseCode; - } - - - /** - * - * @return messageTemplate - */ - - - public String getFormattedMessage(Params params){ - Map paramsMap = params != null ? params.getParams() : null; - return MessageFormatter.format(getResponseMessage(),paramsMap); - - } - - public String getFormattedMessageWithCode(Params params){ - return getResponseCode()+"-" + getFormattedMessage(params); - } - - @Override - public String toString() { - return "LCMCommandStatus{" + - "responseCode=" + responseCode + - ", responseMessage='" + responseMessage + '\'' + - '}'; - } - - public Status toStatus(Params params) { - return new Status(responseCode, getFormattedMessage(params)); - } -} - diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/Params.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/Params.java deleted file mode 100644 index c3cae7bcd..000000000 --- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/Params.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.executor.objects; - -import java.lang.Object; -import java.util.HashMap; -import java.util.Map; - - -public class Params { - public static final String paramDgNameSpace = "dg.status.message.param."; - public static final String errorDgMessageParamName = "errorDgMessage"; - private Map params; - - public Params() { - } - - public Map getParams() { - return params; - } - - public void setParams(Map params) { - this.params = params; - } - - public Params addParam(String paramName, java.lang.Object paramValue) { - params = params == null ? new HashMap() : params; - params.put(paramName, paramValue); - return this; - } - - @Override - public String toString() { - return "Params{" + - "params=" + params + - '}'; - } -} diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/UniqueRequestIdentifier.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/UniqueRequestIdentifier.java deleted file mode 100644 index b2f2a1d89..000000000 --- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/UniqueRequestIdentifier.java +++ /dev/null @@ -1,126 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.executor.objects; - - -import org.apache.commons.lang3.StringUtils; - - -public class UniqueRequestIdentifier { - private static final String IDENTIFIER_DELIMITER = "@"; - - private String originatorID; - private String requestID; - private String subRequestID; - - private UniqueRequestIdentifier(){ - - } - public UniqueRequestIdentifier(String originatorID, - String requestID, - String subRequestID) { - this(); - this.originatorID = originatorID; - this.requestID = requestID; - this.subRequestID = subRequestID; - } - - public String toIdentifierString(){ - StringBuilder stringBuilder = new StringBuilder(); - if(originatorID != null){ - stringBuilder.append(originatorID); - } - stringBuilder.append(IDENTIFIER_DELIMITER); - - if(requestID != null){ - stringBuilder.append(requestID); - } - stringBuilder.append(IDENTIFIER_DELIMITER); - - if(subRequestID != null){ - stringBuilder.append(subRequestID); - } - return stringBuilder.toString(); - } - - public static UniqueRequestIdentifier getUniqueRequestIdentifier(String identifierString){ - String[] splitIdentifier = identifierString.split(IDENTIFIER_DELIMITER); - if(splitIdentifier == null || splitIdentifier.length <2){ - throw new IllegalArgumentException("input identifierString is not valid "+identifierString); - } - String originatorID = splitIdentifier[0]; - String requestID = StringUtils.isEmpty(splitIdentifier[1])? null :splitIdentifier[1]; - String subRequestID = splitIdentifier.length>=3 ? splitIdentifier[2] : null; - return new UniqueRequestIdentifier(originatorID,requestID,subRequestID); - } - public String toString(){ - return "originatorID = " + originatorID + - " , requestID = " + requestID + - " , subRequestID = " + subRequestID; - } - @Override - public boolean equals(Object obj){ - if(obj ==null){ - return false; - } - if(!(obj instanceof UniqueRequestIdentifier)){ - return false; - } - UniqueRequestIdentifier identifier = (UniqueRequestIdentifier)obj; - if(this.originatorID == null){ - if(identifier.originatorID !=null) - return false; - } - else if(!this.originatorID.equals(identifier.originatorID)) - return false; - - if(this.requestID == null){ - if(identifier.requestID !=null) - return false; - } - else if(!this.requestID.equals(identifier.requestID)) - return false; - - if(this.subRequestID == null){ - if(identifier.subRequestID !=null) - return false; - } - else if(!this.subRequestID.equals(identifier.subRequestID)) - return false; - - return true; - } - @Override - public int hashCode(){ - final int prime = 31; - int result = 1; - result = result * prime + (this.originatorID == null ? 0 :this.originatorID.hashCode()); - result = result * prime + (this.requestID == null ? 0 :this.requestID.hashCode()); - result = result * prime + (this.subRequestID == null ? 0 :this.subRequestID.hashCode()); - return result; - } - - -} -- cgit 1.2.3-korg