1 package org.onap.vid.controllers;
3 import com.fasterxml.jackson.databind.ObjectMapper;
4 import org.apache.commons.io.IOUtils;
5 import org.json.JSONObject;
6 import org.json.JSONTokener;
7 import org.onap.vid.aai.AaiClient;
8 import org.onap.vid.aai.AaiClientInterface;
9 import org.onap.vid.asdc.AsdcClient;
10 import org.onap.vid.asdc.local.LocalAsdcClient;
11 import org.onap.vid.asdc.parser.ToscaParserImpl2;
12 import org.onap.vid.controllers.VidController;
13 import org.onap.vid.services.AaiService;
14 import org.onap.vid.services.AaiServiceImpl;
15 import org.onap.vid.services.VidService;
16 import org.onap.vid.services.VidServiceImpl;
17 import org.springframework.context.annotation.Bean;
18 import org.springframework.context.annotation.Configuration;
20 import java.io.IOException;
21 import java.io.InputStream;
24 public class LocalWebConfig {
27 * Gets the object mapper.
29 * @return the object mapper
32 public ObjectMapper getObjectMapper() {
33 return new ObjectMapper();
38 public VidService vidService(AsdcClient asdcClient) {
39 return new VidServiceImpl(asdcClient, null);
43 public AaiService getAaiService() {
44 return new AaiServiceImpl();
48 public AaiClientInterface getAaiClientInterface() {
49 return new AaiClient(null,null);
53 public AsdcClient asdcClient() throws IOException {
56 final InputStream asdcServicesFile = VidController.class.getClassLoader().getResourceAsStream("sdcservices.json");
58 final JSONTokener jsonTokener = new JSONTokener(IOUtils.toString(asdcServicesFile));
59 final JSONObject sdcServicesCatalog = new JSONObject(jsonTokener);
61 return new LocalAsdcClient.Builder().catalog(sdcServicesCatalog).build();
66 public ToscaParserImpl2 getToscaParser() {
67 return new ToscaParserImpl2();