d80fec8a98fde7ef9ea041039b75a2e97a634683
[ccsdk/features.git] /
1 /*\r
2  * Copyright © 2017-2018 AT&T Intellectual Property.\r
3  * \r
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
5  * in compliance with the License. You may obtain a copy of the License at\r
6  * \r
7  * http://www.apache.org/licenses/LICENSE-2.0\r
8  * \r
9  * Unless required by applicable law or agreed to in writing, software distributed under the License\r
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
11  * or implied. See the License for the specific language governing permissions and limitations under\r
12  * the License.\r
13  */\r
14 \r
15 package org.onap.ccsdk.config.assignment.processor;\r
16 \r
17 import org.onap.ccsdk.config.data.adaptor.service.ConfigResourceService;\r
18 import org.onap.ccsdk.config.model.ConfigModelConstant;\r
19 import org.onap.ccsdk.config.model.service.ComponentNode;\r
20 import org.onap.ccsdk.config.model.service.ComponentNodeService;\r
21 import org.onap.ccsdk.config.rest.adaptor.service.ConfigRestAdaptorService;\r
22 \r
23 public class ProcessorFactory {\r
24     \r
25     private ConfigResourceService configResourceService;\r
26     private ConfigRestAdaptorService configRestAdaptorService;\r
27     private ComponentNodeService componentNodeService;\r
28     \r
29     public ProcessorFactory(ConfigResourceService configResourceService,\r
30             ConfigRestAdaptorService configRestAdaptorService, ComponentNodeService componentNodeService) {\r
31         this.componentNodeService = componentNodeService;\r
32         this.configResourceService = configResourceService;\r
33         this.configRestAdaptorService = configRestAdaptorService;\r
34     }\r
35     \r
36     public ComponentNode getInstance(String source) {\r
37         \r
38         if (ConfigModelConstant.SOURCE_DEFAULT.equalsIgnoreCase(source)) {\r
39             return new DefaultResourceProcessor(configResourceService);\r
40         } else if (ConfigModelConstant.SOURCE_DB.equalsIgnoreCase(source)) {\r
41             return new DBResourceProcessor(configResourceService);\r
42         } else if (ConfigModelConstant.SOURCE_MDSAL.equalsIgnoreCase(source)) {\r
43             return new MdsalResourceProcessor(configRestAdaptorService);\r
44         }\r
45         // Default\r
46         return new InputResourceProcessor(configResourceService);\r
47     }\r
48     \r
49 }\r