diff options
author | Venkata Harish K Kajur <vk250x@att.com> | 2017-05-22 12:00:26 -0400 |
---|---|---|
committer | Venkata Harish K Kajur <vk250x@att.com> | 2017-05-22 12:25:37 -0400 |
commit | 6513d40a636fc6c55755bf91095a5404647d990b (patch) | |
tree | 297170bc0774814ef5963cfae38f7539888e9113 /aai-traversal/src/main/java/org/openecomp | |
parent | abe16d208c3a76040ff3b49f459e331dd5bd9c9f (diff) |
Update the pom to remove unnecessary dependency
Change-Id: I0ded3dd843c2d14d303565d3af4aa1456be9a3e7
Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
Diffstat (limited to 'aai-traversal/src/main/java/org/openecomp')
-rw-r--r-- | aai-traversal/src/main/java/org/openecomp/aai/dmaap/AAIDmaapEventJMSConsumer.java | 184 | ||||
-rw-r--r-- | aai-traversal/src/main/java/org/openecomp/aai/dmaap/AAIDmaapEventJMSProducer.java | 22 |
2 files changed, 103 insertions, 103 deletions
diff --git a/aai-traversal/src/main/java/org/openecomp/aai/dmaap/AAIDmaapEventJMSConsumer.java b/aai-traversal/src/main/java/org/openecomp/aai/dmaap/AAIDmaapEventJMSConsumer.java index d8a0ce7..e0c4ec7 100644 --- a/aai-traversal/src/main/java/org/openecomp/aai/dmaap/AAIDmaapEventJMSConsumer.java +++ b/aai-traversal/src/main/java/org/openecomp/aai/dmaap/AAIDmaapEventJMSConsumer.java @@ -40,8 +40,8 @@ import org.openecomp.aai.logging.ErrorLogHelper; import org.openecomp.aai.util.AAIConstants; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.att.nsa.mr.client.MRBatchingPublisher; -import com.att.nsa.mr.client.MRClientFactory; +//import com.att.nsa.mr.client.MRBatchingPublisher; +//import com.att.nsa.mr.client.MRClientFactory; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; @@ -52,7 +52,7 @@ public class AAIDmaapEventJMSConsumer implements MessageListener { private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(AAIDmaapEventJMSConsumer.class); private final static String COMPONENT = "aaiDmaapEvent"; - private MRBatchingPublisher adp = null; + //private MRBatchingPublisher adp = null; private Properties props; @@ -64,100 +64,100 @@ public class AAIDmaapEventJMSConsumer implements MessageListener { private Client client; public AAIDmaapEventJMSConsumer() throws org.apache.commons.configuration.ConfigurationException { - super(); - - if (this.adp == null) { - try { - FileReader reader = new FileReader(new File(AAIConstants.AAI_EVENT_DMAAP_PROPS)); - props = new Properties(); - props.load(reader); - props.setProperty("DME2preferredRouterFilePath", AAIConstants.AAI_HOME_ETC_APP_PROPERTIES + "preferredRoute.txt"); - if (props.getProperty("password") != null && props.getProperty("password").startsWith("OBF:")) { - props.setProperty("password", Password.deobfuscate(props.getProperty("password"))); - } - this.adp = MRClientFactory.createBatchingPublisher(props); - - String host = props.getProperty("host"); - String topic = props.getProperty("topic"); - String protocol = props.getProperty("Protocol"); - - username = props.getProperty("username"); - password = props.getProperty("password"); - contentType = props.getProperty("contenttype"); - - url = protocol + "://" + host + "/events/" + topic; - client = Client.create(); - client.addFilter(new HTTPBasicAuthFilter(username, password)); - - } catch (IOException e) { - ErrorLogHelper.logError("AAI_4000", "Error updating dmaap config file for aai event."); - } - } + //super(); + + //if (this.adp == null) { + //try { + //FileReader reader = new FileReader(new File(AAIConstants.AAI_EVENT_DMAAP_PROPS)); + //props = new Properties(); + //props.load(reader); + //props.setProperty("DME2preferredRouterFilePath", AAIConstants.AAI_HOME_ETC_APP_PROPERTIES + "preferredRoute.txt"); + //if (props.getProperty("password") != null && props.getProperty("password").startsWith("OBF:")) { + //props.setProperty("password", Password.deobfuscate(props.getProperty("password"))); + //} + //this.adp = MRClientFactory.createBatchingPublisher(props); + + //String host = props.getProperty("host"); + //String topic = props.getProperty("topic"); + //String protocol = props.getProperty("Protocol"); + + //username = props.getProperty("username"); + //password = props.getProperty("password"); + //contentType = props.getProperty("contenttype"); + + //url = protocol + "://" + host + "/events/" + topic; + //client = Client.create(); + //client.addFilter(new HTTPBasicAuthFilter(username, password)); + + //} catch (IOException e) { + //ErrorLogHelper.logError("AAI_4000", "Error updating dmaap config file for aai event."); + //} + //} } @Override public void onMessage(Message message) { - String jsmMessageTxt = ""; - String aaiEvent = ""; - String transId = ""; - String fromAppId = ""; - String fullId = ""; - - if (message instanceof TextMessage) { - try { - jsmMessageTxt = ((TextMessage) message).getText(); - JSONObject jo = new JSONObject(jsmMessageTxt); - - if (jo.has("aaiEventPayload")) { - aaiEvent = jo.getJSONObject("aaiEventPayload").toString(); - } else { - return; - } - if (jo.getString("transId") != null) { - MDC.put("requestId", jo.getString("transId")); - } - if (jo.getString("fromAppId") != null) { - MDC.put("partnerName", jo.getString("fromAppId")); - } - if (jo.getString("fullId") != null) { - fullId = jo.getString("fullId"); - } - - LOGGER.info(fullId + "|" + transId + "|" + fromAppId + "|" + aaiEvent); - - String environment = System.getProperty("lrmRO"); - - if (environment == null) { - this.adp.send(aaiEvent); - } else { - if (environment.startsWith("dev") || environment.startsWith("testINT") || environment.startsWith("testEXT")) { - - WebResource webResource = client.resource(url); - - ClientResponse response = webResource.accept(contentType).type(MediaType.APPLICATION_JSON).post(ClientResponse.class, aaiEvent); - - if (response.getStatus() != 200) { - System.out.println("Failed : HTTP error code : " + response.getStatus()); - } - } else { - this.adp.send(aaiEvent); - } - } - - } catch (IOException e) { - if (e instanceof java.net.SocketException) { - if (e.getMessage().contains("Connection reset")) { - } else { - ErrorLogHelper.logError("AAI_7304", "Error reaching DMaaP to send event. " + aaiEvent); - } - } else { - ErrorLogHelper.logError("AAI_7304", "Error reaching DMaaP to send event. " + aaiEvent); - } - } catch (JMSException | JSONException e) { - ErrorLogHelper.logError("AAI_7350", "Error parsing aaievent jsm message for sending to dmaap. " + jsmMessageTxt); - } - } + //String jsmMessageTxt = ""; + //String aaiEvent = ""; + //String transId = ""; + //String fromAppId = ""; + //String fullId = ""; + + //if (message instanceof TextMessage) { + //try { + //jsmMessageTxt = ((TextMessage) message).getText(); + //JSONObject jo = new JSONObject(jsmMessageTxt); + + //if (jo.has("aaiEventPayload")) { + //aaiEvent = jo.getJSONObject("aaiEventPayload").toString(); + //} else { + //return; + //} + //if (jo.getString("transId") != null) { + //MDC.put("requestId", jo.getString("transId")); + //} + //if (jo.getString("fromAppId") != null) { + //MDC.put("partnerName", jo.getString("fromAppId")); + //} + //if (jo.getString("fullId") != null) { + //fullId = jo.getString("fullId"); + //} + + //LOGGER.info(fullId + "|" + transId + "|" + fromAppId + "|" + aaiEvent); + + //String environment = System.getProperty("lrmRO"); + + //if (environment == null) { + //this.adp.send(aaiEvent); + //} else { + //if (environment.startsWith("dev") || environment.startsWith("testINT") || environment.startsWith("testEXT")) { + + //WebResource webResource = client.resource(url); + + //ClientResponse response = webResource.accept(contentType).type(MediaType.APPLICATION_JSON).post(ClientResponse.class, aaiEvent); + + //if (response.getStatus() != 200) { + //System.out.println("Failed : HTTP error code : " + response.getStatus()); + //} + //} else { + //this.adp.send(aaiEvent); + //} + //} + + //} catch (IOException e) { + //if (e instanceof java.net.SocketException) { + //if (e.getMessage().contains("Connection reset")) { + //} else { + //ErrorLogHelper.logError("AAI_7304", "Error reaching DMaaP to send event. " + aaiEvent); + //} + //} else { + //ErrorLogHelper.logError("AAI_7304", "Error reaching DMaaP to send event. " + aaiEvent); + //} + //} catch (JMSException | JSONException e) { + //ErrorLogHelper.logError("AAI_7350", "Error parsing aaievent jsm message for sending to dmaap. " + jsmMessageTxt); + //} + //} } } diff --git a/aai-traversal/src/main/java/org/openecomp/aai/dmaap/AAIDmaapEventJMSProducer.java b/aai-traversal/src/main/java/org/openecomp/aai/dmaap/AAIDmaapEventJMSProducer.java index 305e585..8b27f3a 100644 --- a/aai-traversal/src/main/java/org/openecomp/aai/dmaap/AAIDmaapEventJMSProducer.java +++ b/aai-traversal/src/main/java/org/openecomp/aai/dmaap/AAIDmaapEventJMSProducer.java @@ -20,25 +20,25 @@ package org.openecomp.aai.dmaap; -import org.apache.activemq.ActiveMQConnectionFactory; -import org.apache.activemq.command.ActiveMQQueue; +//import org.apache.activemq.ActiveMQConnectionFactory; +//import org.apache.activemq.command.ActiveMQQueue; import org.json.JSONObject; -import org.springframework.jms.connection.CachingConnectionFactory; -import org.springframework.jms.core.JmsTemplate; +//import org.springframework.jms.connection.CachingConnectionFactory; +//import org.springframework.jms.core.JmsTemplate; public class AAIDmaapEventJMSProducer { - private JmsTemplate jmsTemplate; + //private JmsTemplate jmsTemplate; public AAIDmaapEventJMSProducer() { - this.jmsTemplate = new JmsTemplate(); - this.jmsTemplate.setConnectionFactory(new CachingConnectionFactory(new ActiveMQConnectionFactory("tcp://localhost:61446"))); - this.jmsTemplate.setDefaultDestination(new ActiveMQQueue("IN_QUEUE")); + //this.jmsTemplate = new JmsTemplate(); + //this.jmsTemplate.setConnectionFactory(new CachingConnectionFactory(new ActiveMQConnectionFactory("tcp://localhost:61446"))); + //this.jmsTemplate.setDefaultDestination(new ActiveMQQueue("IN_QUEUE")); } public void sendMessageToDefaultDestination(JSONObject finalJson) { - jmsTemplate.convertAndSend(finalJson.toString()); - CachingConnectionFactory ccf = (CachingConnectionFactory)this.jmsTemplate.getConnectionFactory(); - ccf.destroy(); + //jmsTemplate.convertAndSend(finalJson.toString()); + //CachingConnectionFactory ccf = (CachingConnectionFactory)this.jmsTemplate.getConnectionFactory(); + //ccf.destroy(); } } |