2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.generator.service;
23 import static org.openecomp.sdc.generator.data.GeneratorConstants.ERROR_CATEGORY;
24 import static org.openecomp.sdc.generator.data.GeneratorConstants.ERROR_CODE;
25 import static org.openecomp.sdc.generator.data.GeneratorConstants.ERROR_DESCRIPTION;
26 import static org.openecomp.sdc.generator.data.GeneratorConstants.GENERATOR_ERROR_CODE;
27 import static org.openecomp.sdc.generator.data.GeneratorConstants.GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED;
28 import static org.openecomp.sdc.generator.data.GeneratorConstants.GENERATOR_PARTNER_NAME;
29 import static org.openecomp.sdc.generator.data.GeneratorConstants.PARTNER_NAME;
31 import org.openecomp.sdc.logging.api.Logger;
32 import org.openecomp.sdc.logging.api.LoggerFactory;
33 import org.openecomp.sdc.generator.data.Artifact;
34 import org.openecomp.sdc.generator.data.GenerationData;
35 import org.openecomp.sdc.generator.logging.CategoryLogLevel;
38 import java.io.PrintWriter;
39 import java.io.StringWriter;
40 import java.util.List;
45 * Artifact Generation Service interface.
47 public interface ArtifactGenerationService {
51 * Method to get artifact generation service implementation.
53 * @return Artifact generation implementation instance
55 public static ArtifactGenerationService lookup() {
57 Logger log = LoggerFactory.getLogger(ArtifactGenerationService.class.getName());
58 log.debug("Instantiating Artifact Generation Service");
60 return ArtifactGenerationService.class.cast(
61 Class.forName("org.openecomp.sdc.generator.impl.ArtifactGenerationServiceImpl")
63 } catch (Exception exception) {
64 MDC.put(PARTNER_NAME, GENERATOR_PARTNER_NAME);
65 MDC.put(ERROR_CATEGORY, CategoryLogLevel.ERROR.name());
66 MDC.put(ERROR_CODE, GENERATOR_ERROR_CODE);
67 MDC.put(ERROR_DESCRIPTION, GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED);
68 log.error(GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED, exception);
70 log.debug(GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED);
74 public GenerationData generateArtifact(List<Artifact> input, String overridingConfiguration,
75 Map<String, String> additionalParams);