2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 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=========================================================
20 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 package org.onap.aai.introspection;
24 import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
25 import org.onap.aai.introspection.exceptions.AAIUnmarshallingException;
26 import org.onap.aai.restcore.MediaType;
30 public abstract class Loader {
32 private final Version version;
33 private final ModelType modelType;
36 * Instantiates a new loader.
38 * @param version the version
39 * @param modelType the model type
40 * @param llBuilder the ll builder
42 public Loader (Version version, ModelType modelType) {
43 this.version = version;
44 this.modelType = modelType;
50 * @param version the version
52 protected abstract void process(Version version);
57 * @param name the name
59 * @throws AAIUnknownObjectException
61 public abstract Object objectFromName(String name) throws AAIUnknownObjectException;
64 * Introspector from name.
66 * @param name the name
67 * @return the introspector
68 * @throws AAIUnknownObjectException
70 public abstract Introspector introspectorFromName(String name) throws AAIUnknownObjectException;
75 * @param type the type
76 * @param json the json
77 * @param mediaType the media type
78 * @return the introspector
80 public abstract Introspector unmarshal(String type, String json, MediaType mediaType) throws AAIUnmarshallingException;
85 * @param type the type
86 * @param json the json
87 * @return the introspector
89 public Introspector unmarshal(String type, String json) throws AAIUnmarshallingException {
90 return unmarshal(type, json, MediaType.APPLICATION_JSON_TYPE);
95 * Gets the model type.
97 * @return the model type
99 public ModelType getModelType() {
100 return this.modelType;
106 * @return the version
108 public Version getVersion() {
112 public abstract Map<String, Introspector> getAllObjects();