* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
*/
package org.onap.clamp.clds.config.sdc;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.HashMap;
import javax.annotation.PostConstruct;
import org.onap.clamp.clds.exception.sdc.controller.SdcParametersException;
+import org.onap.clamp.clds.util.JacksonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.Resource;
-import org.springframework.stereotype.Component;
/**
* This class maps the SDC config JSON file. This JSON can have multiple
* sdc-controller config. So the json is loaded in a static way and the instance
* must specify the controller name that it represents.
*/
-@Component
public class SdcControllersConfiguration {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcControllersConfiguration.class);
public void loadConfiguration() throws IOException {
Resource resource = appContext.getResource(sdcControllerFile);
// Try to load json tree
- jsonRootNode = new ObjectMapper().readValue(resource.getInputStream(), JsonNode.class);
+ jsonRootNode = JacksonUtils.getObjectMapperInstance().readValue(resource.getInputStream(), JsonNode.class);
}
public SdcSingleControllerConfiguration getSdcSingleControllerConfiguration(String controllerName) {
- Map<String, SdcSingleControllerConfiguration> controllerMap = getAllDefinedControllers();
- return controllerMap.get(controllerName);
+ return getAllDefinedControllers().get(controllerName);
}
/**