-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017-2018 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.
- *
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.adapter.factory;
-
-import java.util.Collection;
-import java.util.Set;
-
-import org.onap.appc.adapter.message.Consumer;
-import org.onap.appc.adapter.message.MessageAdapterFactory;
-import org.onap.appc.adapter.message.Producer;
-import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapConsumerImpl;
-import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapProducerImpl;
-
-public class DmaapMessageAdapterFactoryImpl implements MessageAdapterFactory {
-
-
- @Override
- public Producer createProducer(Collection<String> pools, String writeTopic, String apiKey, String apiSecret) {
- return new HttpDmaapProducerImpl(pools, writeTopic);
- }
-
- @Override
- public Producer createProducer(Collection<String> pools, Set<String> writeTopics, String apiKey, String apiSecret) {
- String topic = "";
- for(String s : writeTopics){
- topic = s;
- }
- return new HttpDmaapProducerImpl(pools,topic);
- }
-
- @Override
- public Consumer createConsumer(Collection<String> pool, String readTopic,
- String clientName, String clientId, String filterJson, String apiKey, String apiSecret) {
- return new HttpDmaapConsumerImpl(pool, readTopic, clientName, clientId, apiKey, apiSecret, filterJson);
- }
-}
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP : APPC\r
+ * ================================================================================\r
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Copyright (C) 2017 Amdocs\r
+ * =============================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * \r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.onap.appc.adapter.factory;\r
+\r
+import java.util.Collection;\r
+import java.util.Set;\r
+\r
+import org.onap.appc.adapter.message.Consumer;\r
+import org.onap.appc.adapter.message.MessageAdapterFactory;\r
+import org.onap.appc.adapter.message.Producer;\r
+import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapConsumerImpl;\r
+import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapProducerImpl;\r
+\r
+public class DmaapMessageAdapterFactoryImpl implements MessageAdapterFactory {\r
+\r
+ \r
+ @Override\r
+ public Producer createProducer(Collection<String> pools, String writeTopic, String apiKey, String apiSecret) {\r
+ return new HttpDmaapProducerImpl(pools, writeTopic);\r
+ }\r
+\r
+ @Override\r
+ public Producer createProducer(Collection<String> pools, Set<String> writeTopics, String apiKey, String apiSecret) {\r
+ String topic = "";\r
+ for(String s : writeTopics){\r
+ topic = s;\r
+ }\r
+ return new HttpDmaapProducerImpl(pools,topic);\r
+ }\r
+\r
+ @Override\r
+ public Consumer createConsumer(Collection<String> pool, String readTopic, \r
+ String clientName, String clientId, String filterJson, String apiKey, String apiSecret) {\r
+ return new HttpDmaapConsumerImpl(pool, readTopic, clientName, clientId, apiKey, apiSecret, filterJson);\r
+ }\r
+}\r
import org.opendaylight.yangtools.yang.binding.DataContainer;
import org.onap.appc.domainmodel.lcm.ResponseContext;
import org.onap.appc.domainmodel.lcm.VNFOperation;
+import org.onap.appc.requesthandler.impl.AbstractRequestHandlerImpl;
import org.onap.appc.requesthandler.impl.DmaapOutgoingMessage;
import java.text.ParseException;
private static final String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
private final static String DMaaP_ROOT_VALUE = "output";
private static final SimpleDateFormat isoFormatter = new SimpleDateFormat(ISO_FORMAT);
+ private final static EELFLogger logger = EELFManager.getInstance().getLogger(Converter.class);
static {
isoFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
}
if(vnfOperation == null){
throw new IllegalArgumentException("empty asyncResponse.action");
}
+ logger.debug("Entered Converter.convAsyncResponseToBuilder()");
Action action = Action.valueOf(vnfOperation.name());
CommonHeader commonHeader = convAsyncResponseTorev160108CommonHeader(response);
Status status = convAsyncResponseTorev160108Status(response);
Payload payload = convAsyncResponseTorev160108Payload(response);
+ logger.debug("Extracted action, status, payload ");
switch (action){
case Rollback:
outObj = new RollbackOutputBuilder();
((HealthCheckOutputBuilder)outObj).setCommonHeader(commonHeader);
((HealthCheckOutputBuilder)outObj).setStatus(status);
((HealthCheckOutputBuilder)outObj).setPayload(payload);
+ logger.debug("In HealthCheck case- created outObj, returning");
return outObj;
case LiveUpgrade:
outObj = new LiveUpgradeOutputBuilder();
}
public static String convAsyncResponseToDmaapOutgoingMessageJsonString(VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse) throws JsonProcessingException {
- DmaapOutgoingMessage dmaapOutgoingMessage = convAsyncResponseToDmaapOutgoingMessage(vnfOperation, rpcName, asyncResponse);
+ logger.debug("Entered Converter.convAsyncResponseToDmaapOutgoingMessageJsonString()");
+ DmaapOutgoingMessage dmaapOutgoingMessage = convAsyncResponseToDmaapOutgoingMessage(vnfOperation, rpcName, asyncResponse);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.addMixInAnnotations(dmaapOutgoingMessage.getBody().getOutput().getClass(), MixInFlagsMessage.class);
objectMapper.addMixInAnnotations(CommonHeader.class, MixInCommonHeader.class);
// .configure(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY,true)
ObjectWriter writer = objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL).configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY,true).writer();
+ logger.debug("Exiting Converter.convAsyncResponseToDmaapOutgoingMessageJsonString()");
return writer.writeValueAsString(dmaapOutgoingMessage);
}
public static DmaapOutgoingMessage convAsyncResponseToDmaapOutgoingMessage(VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse) throws JsonProcessingException {
- DmaapOutgoingMessage outObj = new DmaapOutgoingMessage();
+ logger.debug("Entered Converter.convAsyncResponseToDmaapOutgoingMessage()");
+ DmaapOutgoingMessage outObj = new DmaapOutgoingMessage();
String correlationID = getCorrelationID(asyncResponse);
outObj.setCorrelationID(correlationID);
outObj.setType("response");
Object messageBody = builder.build();
DmaapOutgoingMessage.Body body = new DmaapOutgoingMessage.Body(messageBody);
outObj.setBody(body);
+ logger.debug("Exiting Converter.convAsyncResponseToDmaapOutgoingMessage():messageBody is :::"+body.toString());
return outObj;
}