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.onap.sdc.generator.aai;
23 import org.onap.sdc.generator.data.GeneratorConstants;
24 import org.onap.sdc.generator.aai.model.Resource;
25 import org.onap.sdc.generator.aai.model.Service;
26 import org.onap.sdc.generator.logging.CategoryLogLevel;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
31 import java.io.StringWriter;
33 public interface AaiModelGenerator {
38 * @return the instance
40 public static AaiModelGenerator getInstance() {
41 Logger log = LoggerFactory.getLogger(AaiModelGenerator.class.getName());
43 return AaiModelGenerator.class.cast(
44 Class.forName("org.onap.sdc.generator.aai.AaiModelGeneratorImpl").newInstance());
45 } catch (Exception exception) {
46 MDC.put(GeneratorConstants.PARTNER_NAME, GeneratorConstants.GENERATOR_PARTNER_NAME);
47 MDC.put(GeneratorConstants.ERROR_CATEGORY, CategoryLogLevel.ERROR.name());
48 MDC.put(GeneratorConstants.ERROR_CODE, GeneratorConstants.GENERATOR_ERROR_CODE);
50 GeneratorConstants.ERROR_DESCRIPTION, GeneratorConstants.GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED);
51 StringWriter sw = new StringWriter();
52 log.error(sw.toString(), exception);
57 public String generateModelFor(Service service);
59 public String generateModelFor(Resource resource);