From 0cb18b0baa2cf750e557262d821bbf2a03326bbe Mon Sep 17 00:00:00 2001 From: sunil unnava Date: Tue, 23 Oct 2018 10:31:46 -0400 Subject: update the package name Issue-ID: DMAAP-858 Change-Id: Ia69621ea6ad2ec2ec525800af2a7d3f73aef82ed Signed-off-by: sunil unnava --- .../client/DefaultLoggingFailoverFaultHandler.java | 52 -------- .../att/nsa/mr/dme/client/HeaderReplyHandler.java | 63 ---------- .../mr/dme/client/PreferredRouteReplyHandler.java | 72 ----------- .../dme/client/PreferredRouteRequestHandler.java | 54 --------- .../nsa/mr/dme/client/SimpleExampleConsumer.java | 88 -------------- .../nsa/mr/dme/client/SimpleExamplePublisher.java | 135 --------------------- 6 files changed, 464 deletions(-) delete mode 100644 src/main/java/com/att/nsa/mr/dme/client/DefaultLoggingFailoverFaultHandler.java delete mode 100644 src/main/java/com/att/nsa/mr/dme/client/HeaderReplyHandler.java delete mode 100644 src/main/java/com/att/nsa/mr/dme/client/PreferredRouteReplyHandler.java delete mode 100644 src/main/java/com/att/nsa/mr/dme/client/PreferredRouteRequestHandler.java delete mode 100644 src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java delete mode 100644 src/main/java/com/att/nsa/mr/dme/client/SimpleExamplePublisher.java (limited to 'src/main/java/com/att/nsa/mr/dme') diff --git a/src/main/java/com/att/nsa/mr/dme/client/DefaultLoggingFailoverFaultHandler.java b/src/main/java/com/att/nsa/mr/dme/client/DefaultLoggingFailoverFaultHandler.java deleted file mode 100644 index 4f04dec..0000000 --- a/src/main/java/com/att/nsa/mr/dme/client/DefaultLoggingFailoverFaultHandler.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * org.onap.dmaap - * ================================================================================ - * Copyright © 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========================================================= - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * - *******************************************************************************/ -package com.att.nsa.mr.dme.client; - - - -import java.util.logging.Level; -import java.util.logging.Logger; - - -//import com.att.aft.dme2.api.util.DME2Constants; -//import com.att.aft.dme2.api.util.DME2ExchangeFaultContext; -//import com.att.aft.dme2.api.util.LogMessage; -//import com.att.aft.dme2.api.util.LogUtil; -public class DefaultLoggingFailoverFaultHandler /*implements DME2FailoverFaultHandler*/ { - //TODO: This code may be enable in the future when we implement DME2FailoverFaultHandler interface - /** The logger. */ - - -// @Override - -// // LogUtil.INSTANCE.report(logger, Level.WARNING, LogMessage.SEP_FAILOVER, context.getService(),context.getRequestURL(),context.getRouteOffer(),context.getResponseCode(),context.getException()); -// } -// @Override -// /** -// * The DME2Exchange already has a log message when the route offer is failed over. We dont need to log it again here. -// */ - -// //noop -// - -} - diff --git a/src/main/java/com/att/nsa/mr/dme/client/HeaderReplyHandler.java b/src/main/java/com/att/nsa/mr/dme/client/HeaderReplyHandler.java deleted file mode 100644 index 4363902..0000000 --- a/src/main/java/com/att/nsa/mr/dme/client/HeaderReplyHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * org.onap.dmaap - * ================================================================================ - * Copyright © 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========================================================= - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * - *******************************************************************************/ -package com.att.nsa.mr.dme.client; - - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.att.aft.dme2.api.util.DME2ExchangeFaultContext; -import com.att.aft.dme2.api.util.DME2ExchangeReplyHandler; -import com.att.aft.dme2.api.util.DME2ExchangeResponseContext; -import com.att.nsa.mr.client.MRClientFactory; -import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher; - - - - - - public class HeaderReplyHandler implements DME2ExchangeReplyHandler { - - private Logger fLog = LoggerFactory.getLogger ( this.getClass().getName () ); - - - @Override public void handleFault(DME2ExchangeFaultContext responseData) { - // TODO Auto-generated method stub - - } - @Override public void handleEndpointFault(DME2ExchangeFaultContext responseData) { - // TODO Auto-generated method stub - - } -@Override public void handleReply(DME2ExchangeResponseContext responseData) { - - if(responseData != null) { - MRClientFactory.DME2HeadersMap=responseData.getResponseHeaders(); - if (responseData.getResponseHeaders().get("transactionId")!=null) - fLog.info("Transaction Id : " + responseData.getResponseHeaders().get("transactionId")); - - } -} - -} diff --git a/src/main/java/com/att/nsa/mr/dme/client/PreferredRouteReplyHandler.java b/src/main/java/com/att/nsa/mr/dme/client/PreferredRouteReplyHandler.java deleted file mode 100644 index 2da5ce9..0000000 --- a/src/main/java/com/att/nsa/mr/dme/client/PreferredRouteReplyHandler.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * org.onap.dmaap - * ================================================================================ - * Copyright © 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========================================================= - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * - *******************************************************************************/ -package com.att.nsa.mr.dme.client; -import java.io.File; -import java.io.FileWriter; -import java.io.InputStream; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.att.aft.dme2.api.util.DME2ExchangeFaultContext; -import com.att.aft.dme2.api.util.DME2ExchangeReplyHandler; -import com.att.aft.dme2.api.util.DME2ExchangeResponseContext; -import com.att.nsa.mr.client.MRClientFactory; -import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher; - -public class PreferredRouteReplyHandler implements DME2ExchangeReplyHandler { - private Logger fLog = LoggerFactory.getLogger ( this.getClass().getName () ); - @Override public void handleReply(DME2ExchangeResponseContext responseData) { - - if(responseData != null) { - MRClientFactory.DME2HeadersMap=responseData.getResponseHeaders(); - if (responseData.getResponseHeaders().get("transactionId")!=null) - - fLog.info("Transaction_Id : " + responseData.getResponseHeaders().get("transactionId")); - - if(responseData.getRouteOffer() != null ){ - routeWriter("preferredRouteKey",responseData.getRouteOffer()); - - } - } -} - - @Override public void handleFault(DME2ExchangeFaultContext responseData) { - // TODO Auto-generated method stub - //StaticCache.getInstance().setHandleFaultInvoked(true); - } - @Override public void handleEndpointFault(DME2ExchangeFaultContext responseData) { - // TODO Auto-generated method stub - - } - public void routeWriter(String routeKey, String routeValue){ - - try(FileWriter routeWriter=new FileWriter(new File (MRSimplerBatchPublisher.routerFilePath))){ - routeWriter.write(routeKey+"="+routeValue); - routeWriter.close(); - - }catch(Exception ex){ - fLog.error("Reply Router Error " + ex); - } - - } -} diff --git a/src/main/java/com/att/nsa/mr/dme/client/PreferredRouteRequestHandler.java b/src/main/java/com/att/nsa/mr/dme/client/PreferredRouteRequestHandler.java deleted file mode 100644 index fbc32a7..0000000 --- a/src/main/java/com/att/nsa/mr/dme/client/PreferredRouteRequestHandler.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * org.onap.dmaap - * ================================================================================ - * Copyright © 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========================================================= - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * - *******************************************************************************/ -package com.att.nsa.mr.dme.client; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.att.aft.dme2.api.util.DME2ExchangeRequestContext; -import com.att.aft.dme2.api.util.DME2ExchangeRequestHandler; -import com.att.nsa.mr.client.MRClientFactory; - -public class PreferredRouteRequestHandler implements DME2ExchangeRequestHandler { - private Logger logger = LoggerFactory.getLogger(this.getClass().getName()); - - @Override - public void handleRequest(DME2ExchangeRequestContext requestData) { - - if (requestData != null) { - - requestData.setPreferredRouteOffer(readRoute("preferredRouteKey")); - } - } - - public String readRoute(String routeKey) { - - try { - - MRClientFactory.prop.load(MRClientFactory.routeReader); - - } catch (Exception ex) { - logger.error("Request Router Error " + ex); - } - return MRClientFactory.prop.getProperty(routeKey); - } -} diff --git a/src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java b/src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java deleted file mode 100644 index ce0138c..0000000 --- a/src/main/java/com/att/nsa/mr/dme/client/SimpleExampleConsumer.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * org.onap.dmaap - * ================================================================================ - * Copyright © 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========================================================= - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * - *******************************************************************************/ - -package com.att.nsa.mr.dme.client; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.ws.rs.core.MultivaluedMap; - -import com.att.nsa.mr.client.MRClientFactory; -import com.att.nsa.mr.client.MRConsumer; - -import java.util.List; - -public class SimpleExampleConsumer { - - private static final Logger logger = LoggerFactory.getLogger(SimpleExampleConsumer.class); - - private SimpleExampleConsumer() { - } - - public static void main(String[] args) { - - long count = 0; - long nextReport = 5000; - String key; - - final long startMs = System.currentTimeMillis(); - - try { - - final MRConsumer cc = MRClientFactory.createConsumer("D:\\SG\\consumer.properties"); - while (true) { - for (String msg : cc.fetch()) { - logger.debug("Message Received: " + msg); - } - // Header for DME2 Call. - MultivaluedMap headersMap = MRClientFactory.HTTPHeadersMap; - for (MultivaluedMap.Entry> entry : headersMap.entrySet()) { - key = entry.getKey(); - logger.debug("Header Key " + key); - logger.debug("Header Value " + headersMap.get(key)); - } - // Header for HTTP Call. - - Map dme2headersMap = MRClientFactory.DME2HeadersMap; - for (Map.Entry entry : dme2headersMap.entrySet()) { - key = entry.getKey(); - logger.debug("Header Key " + key); - logger.debug("Header Value " + dme2headersMap.get(key)); - } - - if (count > nextReport) { - nextReport += 5000; - - final long endMs = System.currentTimeMillis(); - final long elapsedMs = endMs - startMs; - final double elapsedSec = elapsedMs / 1000.0; - final double eps = count / elapsedSec; - } - } - } catch (Exception x) { - logger.error(x.toString()); - } - } -} diff --git a/src/main/java/com/att/nsa/mr/dme/client/SimpleExamplePublisher.java b/src/main/java/com/att/nsa/mr/dme/client/SimpleExamplePublisher.java deleted file mode 100644 index f9e830c..0000000 --- a/src/main/java/com/att/nsa/mr/dme/client/SimpleExamplePublisher.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * org.onap.dmaap - * ================================================================================ - * Copyright © 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========================================================= - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * - *******************************************************************************/ - -package com.att.nsa.mr.dme.client; - - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -import java.util.concurrent.TimeUnit; - -import javax.ws.rs.core.MultivaluedMap; - -import org.json.JSONObject; - -import com.att.nsa.mr.client.MRBatchingPublisher; -import com.att.nsa.mr.client.MRClientFactory; -import com.att.nsa.mr.client.MRPublisher.message; - -/** - * An example of how to use the Java publisher. - * - * @author author - */ -public class SimpleExamplePublisher { - static String content = null; - static String messageSize = null; - static String transport = null; - static String messageCount = null; - - public void publishMessage(String producerFilePath) throws IOException, InterruptedException { - - // create our publisher - - // publish some messages - - - StringBuilder sb = new StringBuilder(); - final MRBatchingPublisher pub = MRClientFactory.createBatchingPublisher(producerFilePath); - - if (content.equalsIgnoreCase("text/plain")) { - for (int i = 0; i < Integer.parseInt(messageCount); i++) { - for (int j = 0; j < Integer.parseInt(messageSize); j++) { - sb.append("T"); - } - - pub.send(sb.toString()); - } - } else if (content.equalsIgnoreCase("application/cambria")) { - for (int i = 0; i < Integer.parseInt(messageCount); i++) { - for (int j = 0; j < Integer.parseInt(messageSize); j++) { - sb.append("C"); - } - - pub.send("Key", sb.toString()); - } - } else if (content.equalsIgnoreCase("application/json")) { - for (int i = 0; i < Integer.parseInt(messageCount); i++) { - - final JSONObject msg12 = new JSONObject(); - msg12.put("Name", "DMaaP Reference Client to Test jason Message"); - - pub.send(msg12.toString()); - - } - } - - // ... - - // close the publisher to make sure everything's sent before exiting. - // The batching - // publisher interface allows the app to get the set of unsent messages. - // It could - // write them to disk, for example, to try to send them later. - /* final List stuck = pub.close(20, TimeUnit.SECONDS); - if (stuck.size() > 0) { - System.err.println(stuck.size() + " messages unsent"); - } else { - System.out.println("Clean exit; all messages sent."); - }*/ - - if (transport.equalsIgnoreCase("HTTP")) { - MultivaluedMap headersMap = MRClientFactory.HTTPHeadersMap; - for (String key : headersMap.keySet()) { - System.out.println("Header Key " + key); - System.out.println("Header Value " + headersMap.get(key)); - } - } else { - Map dme2headersMap = MRClientFactory.DME2HeadersMap; - for (String key : dme2headersMap.keySet()) { - System.out.println("Header Key " + key); - System.out.println("Header Value " + dme2headersMap.get(key)); - } - } - - } - - public static void main(String[] args) throws InterruptedException, Exception { - - String producerFilePath = args[0]; - content = args[1]; - messageSize = args[2]; - transport = args[3]; - messageCount = args[4]; - - - - - - SimpleExamplePublisher publisher = new SimpleExamplePublisher(); - - publisher.publishMessage("D:\\SG\\producer.properties"); - } - -} -- cgit 1.2.3-korg