Possible fix for event listener
[appc.git] / appc-adapters / appc-dmaap-adapter / appc-message-adapter-factory / src / main / java / org / onap / appc / adapter / factory / DmaapMessageAdapterFactoryImpl.java
index 19eb4ce..85110f2 100644 (file)
@@ -30,29 +30,29 @@ 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;
 
-import org.onap.appc.adapter.messaging.dmaap.impl.DmaapConsumerImpl;
-import org.onap.appc.adapter.messaging.dmaap.impl.DmaapProducerImpl;
-
 public class DmaapMessageAdapterFactoryImpl implements MessageAdapterFactory {
 
-       //Set to true if the HttpDmaap... should be used instead of the regular Dmaap...
-       private static final boolean HTTP = true;
-       
-       public Producer createProducer(Collection<String> pools, String writeTopic, String apiKey, String apiSecret) {
-               return  HTTP ? new HttpDmaapProducerImpl(pools, writeTopic) : new DmaapProducerImpl(pools, writeTopic,apiKey, apiSecret);
-       }
-
-       public Producer createProducer(Collection<String> pools, Set<String> writeTopics, String apiKey, String apiSecret) {
-               return HTTP ? new HttpDmaapProducerImpl(pools, writeTopics) : new DmaapProducerImpl(pools, writeTopics, apiKey, apiSecret);
-       }
-
-       public Consumer createConsumer(Collection<String> pool, String readTopic, 
-                       String clientName, String clientId, String filter_json, String apiKey, String apiSecret) {
-               return HTTP ? new HttpDmaapConsumerImpl(pool, readTopic, clientName, clientId, apiKey, apiSecret, filter_json) : 
-                       new DmaapConsumerImpl(pool, readTopic, clientName, clientId, apiKey, apiSecret, filter_json);
-       }
+    
+    @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);
+    }
 }