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.aai.introspection;
25 import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
26 import org.openecomp.aai.introspection.exceptions.AAIUnmarshallingException;
27 import org.openecomp.aai.restcore.MediaType;
29 public abstract class Loader {
31 private final Version version;
32 private final ModelType modelType;
35 * Instantiates a new loader.
37 * @param version the version
38 * @param modelType the model type
39 * @param llBuilder the ll builder
41 public Loader (Version version, ModelType modelType) {
42 this.version = version;
43 this.modelType = modelType;
49 * @param version the version
51 protected abstract void process(Version version);
56 * @param name the name
58 * @throws AAIUnknownObjectException
60 public abstract Object objectFromName(String name) throws AAIUnknownObjectException;
63 * Introspector from name.
65 * @param name the name
66 * @return the introspector
67 * @throws AAIUnknownObjectException
69 public abstract Introspector introspectorFromName(String name) throws AAIUnknownObjectException;
74 * @param type the type
75 * @param json the json
76 * @param mediaType the media type
77 * @return the introspector
79 public abstract Introspector unmarshal(String type, String json, MediaType mediaType) throws AAIUnmarshallingException;
84 * @param type the type
85 * @param json the json
86 * @return the introspector
88 public Introspector unmarshal(String type, String json) throws AAIUnmarshallingException {
89 return unmarshal(type, json, MediaType.APPLICATION_JSON_TYPE);
94 * Gets the model type.
96 * @return the model type
98 public ModelType getModelType() {
99 return this.modelType;
105 * @return the version
107 public Version getVersion() {
111 public abstract Map<String, Introspector> getAllObjects();