6e6891dee26b9ef44afedac85f8fb906f7bf22e6
[appc.git] /
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP : APPC\r
4  * ================================================================================\r
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  * Copyright (C) 2017 Amdocs\r
8  * =============================================================================\r
9  * Licensed under the Apache License, Version 2.0 (the "License");\r
10  * you may not use this file except in compliance with the License.\r
11  * You may obtain a copy of the License at\r
12  * \r
13  *      http://www.apache.org/licenses/LICENSE-2.0\r
14  * \r
15  * Unless required by applicable law or agreed to in writing, software\r
16  * distributed under the License is distributed on an "AS IS" BASIS,\r
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
18  * See the License for the specific language governing permissions and\r
19  * limitations under the License.\r
20  * \r
21  * ============LICENSE_END=========================================================\r
22  */\r
23 \r
24 package org.onap.appc.adapter.factory;\r
25 \r
26 import java.util.Collection;\r
27 import java.util.Set;\r
28 \r
29 import org.onap.appc.adapter.message.Consumer;\r
30 import org.onap.appc.adapter.message.MessageAdapterFactory;\r
31 import org.onap.appc.adapter.message.Producer;\r
32 import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapConsumerImpl;\r
33 import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapProducerImpl;\r
34 \r
35 public class DmaapMessageAdapterFactoryImpl implements MessageAdapterFactory {\r
36 \r
37     \r
38     @Override\r
39     public Producer createProducer(Collection<String> pools, String writeTopic, String apiKey, String apiSecret) {\r
40         return  new  HttpDmaapProducerImpl(pools, writeTopic);\r
41     }\r
42 \r
43     @Override\r
44     public Producer createProducer(Collection<String> pools, Set<String> writeTopics, String apiKey, String apiSecret) {\r
45         String topic = "";\r
46         for(String s : writeTopics){\r
47             topic = s;\r
48         }\r
49         return new HttpDmaapProducerImpl(pools,topic);\r
50     }\r
51 \r
52     @Override\r
53     public Consumer createConsumer(Collection<String> pool, String readTopic, \r
54             String clientName, String clientId, String filterJson, String apiKey, String apiSecret) {\r
55         return new HttpDmaapConsumerImpl(pool, readTopic, clientName, clientId, apiKey, apiSecret, filterJson);\r
56     }\r
57 }\r