*/
package org.onap.aai.util;
-import java.io.StringWriter;
-import java.util.Iterator;
-import java.util.UUID;
-
-import javax.xml.bind.Marshaller;
-
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.eclipse.persistence.dynamic.DynamicEntity;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
import org.json.JSONException;
import org.json.JSONObject;
-import org.onap.aai.config.SpringContextAware;
import org.onap.aai.dmaap.AAIDmaapEventJMSProducer;
-import org.onap.aai.dmaap.JMSProducer;
import org.onap.aai.dmaap.MessageProducer;
import org.onap.aai.domain.notificationEvent.NotificationEvent;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
+import javax.xml.bind.Marshaller;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.UUID;
+
public class StoreNotificationEvent {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(StoreNotificationEvent.class);
* Instantiates a new store notification event.
*/
public StoreNotificationEvent(String transactionId, String sourceOfTruth) {
- this.context = SpringContextAware.getApplicationContext();
- // If the context is null then this is being invoked from
- // non spring context so creating the jms producer each time
- // Otherwise, get the jms producer from the spring context so
- // no need to create a instance of this each time
- // Also check if the environment has the dmaap profile
- // TODO - Add the constants for profile so do this when adding the https two-way ssl and one way with basic auth
- if(this.context == null){
- this.messageProducer = new AAIDmaapEventJMSProducer();
- } else {
- env = context.getEnvironment();
- if(env.acceptsProfiles("dmaap")){
- try {
- this.messageProducer = (JMSProducer)context.getBean("jmsProducer");
- } catch(NoSuchBeanDefinitionException ex){
- logger.error("Currently using the dmaap profile but still not able to find bean so check DmaapConfig", ex);
- }
- } else {
- this.messageProducer = new AAIDmaapEventJMSProducer();
- }
- }
+ this.messageProducer = new AAIDmaapEventJMSProducer();
this.transactionId = transactionId;
this.sourceOfTruth = sourceOfTruth;
}