2 * Copyright © 2017-2018 AT&T Intellectual Property.
\r
3 * Modifications Copyright © 2018 IBM.
\r
5 * Licensed under the Apache License, Version 2.0 (the "License");
\r
6 * you may not use this file except in compliance with the License.
\r
7 * You may obtain a copy of the License at
\r
9 * http://www.apache.org/licenses/LICENSE-2.0
\r
11 * Unless required by applicable law or agreed to in writing, software
\r
12 * distributed under the License is distributed on an "AS IS" BASIS,
\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 * See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
18 package org.onap.ccsdk.features.assignment.service;
\r
20 import java.util.List;
\r
22 import org.onap.ccsdk.features.assignment.data.ResourceAssignmentData;
\r
23 import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
\r
24 import org.onap.ccsdk.features.generator.service.ConfigGeneratorService;
\r
25 import org.onap.ccsdk.features.model.data.ResourceAssignment;
\r
26 import org.onap.ccsdk.features.model.service.ComponentNodeService;
\r
27 import org.onap.ccsdk.features.model.service.ConfigModelService;
\r
28 import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
\r
29 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
\r
30 import com.att.eelf.configuration.EELFLogger;
\r
31 import com.att.eelf.configuration.EELFManager;
\r
33 public class ConfigAssignmentServiceImpl implements ConfigAssignmentService {
\r
35 private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentServiceImpl.class);
\r
37 private ComponentNodeService componentNodeService;
\r
38 private ConfigResourceService configResourceService;
\r
39 private ConfigModelService configModelService;
\r
40 private ConfigRestAdaptorService configRestAdaptorService;
\r
41 private ConfigGeneratorService configGeneratorService;
\r
43 private static final String CLASS_NAME = "ConfigAssignmentServiceImpl";
\r
45 public ConfigAssignmentServiceImpl(ConfigResourceService configResourceService,
\r
46 ConfigRestAdaptorService configRestAdaptorService, ConfigModelService configModelService,
\r
47 ComponentNodeService componentNodeService, ConfigGeneratorService configGeneratorService) {
\r
48 logger.info("{} Constuctor Initated...", CLASS_NAME);
\r
49 this.componentNodeService = componentNodeService;
\r
50 this.configResourceService = configResourceService;
\r
51 this.configModelService = configModelService;
\r
52 this.configRestAdaptorService = configRestAdaptorService;
\r
53 this.configGeneratorService = configGeneratorService;
\r
57 public void resolveResources(ResourceAssignmentData resourceAssignmentData) throws SvcLogicException {
\r
58 ConfigAssignmentProcessService configAssignmentProcessService =
\r
59 new ConfigAssignmentProcessService(configResourceService, configRestAdaptorService, configModelService,
\r
60 componentNodeService, configGeneratorService);
\r
61 configAssignmentProcessService.resolveResources(resourceAssignmentData);
\r
65 public void saveResourceMapping(ResourceAssignmentData resourceAssignmentData, String templateName,
\r
66 List<ResourceAssignment> resourceAssignments) throws SvcLogicException {
\r
67 ConfigAssignmentPersistService configAssignmentPersistService =
\r
68 new ConfigAssignmentPersistService(configResourceService);
\r
69 configAssignmentPersistService.saveResourceMapping(resourceAssignmentData, templateName, resourceAssignments);
\r
73 public ResourceAssignmentData generateTemplateResourceMash(ResourceAssignmentData resourceAssignmentData)
\r
74 throws SvcLogicException {
\r
75 ConfigPreviewService configPreviewService =
\r
76 new ConfigPreviewService(configResourceService, configModelService, configGeneratorService);
\r
77 return configPreviewService.generateTemplateResourceMash(resourceAssignmentData);
\r