2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 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 package org.onap.aai.introspection;
22 import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
23 import org.onap.aai.introspection.exceptions.AAIUnmarshallingException;
24 import org.onap.aai.restcore.MediaType;
25 import org.onap.aai.setup.SchemaVersion;
29 public abstract class Loader {
31 private final SchemaVersion version;
32 private final ModelType modelType;
35 * Instantiates a new loader.
37 * @param version the version
38 * @param modelType the model type
40 public Loader (SchemaVersion version, ModelType modelType) {
41 this.version = version;
42 this.modelType = modelType;
48 * @param version the version
50 protected abstract void process(SchemaVersion version);
55 * @param name the name
57 * @throws AAIUnknownObjectException
59 public abstract Object objectFromName(String name) throws AAIUnknownObjectException;
62 * Introspector from name.
64 * @param name the name
65 * @return the introspector
66 * @throws AAIUnknownObjectException
68 public abstract Introspector introspectorFromName(String name) throws AAIUnknownObjectException;
73 * @param type the type
74 * @param json the json
75 * @param mediaType the media type
76 * @return the introspector
78 public abstract Introspector unmarshal(String type, String json, MediaType mediaType) throws AAIUnmarshallingException;
83 * @param type the type
84 * @param json the json
85 * @return the introspector
87 public Introspector unmarshal(String type, String json) throws AAIUnmarshallingException {
88 return unmarshal(type, json, MediaType.APPLICATION_JSON_TYPE);
93 * Gets the model type.
95 * @return the model type
97 public ModelType getModelType() {
98 return this.modelType;
104 * @return the version
106 public SchemaVersion getVersion() {
110 public abstract Map<String, Introspector> getAllObjects();