X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=generic-resource-api%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fsdnc%2Fnorthbound%2FGenericResourceApiUtil.java;h=04d0b6fe9aa558c5d17c19d2544be4c15da0f544;hb=3bccabac70d77c10128f8441c9758fbf0b527f61;hp=56a2fae7defe08fe504599f0c7d0bdca408c0d05;hpb=c3342a09a1bec20195a9617ad5b31f5bd9ac7e00;p=sdnc%2Fnorthbound.git diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java index 56a2fae7..04d0b6fe 100644 --- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java +++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java @@ -14,7 +14,7 @@ public class GenericResourceApiUtil extends MdsalHelper { private static final Logger LOG = LoggerFactory.getLogger(GenericResourceApiUtil.class); - public static final String PROPERTIES_FILE="/opt/bvc/controller/configuration/generic-resource-api.properties"; + public static final String PROPERTIES_FILE="/opt/opendaylight/current/configuration/generic-resource-api.properties"; private static Properties properties; @@ -22,23 +22,15 @@ public class GenericResourceApiUtil extends MdsalHelper { File file = new File(PROPERTIES_FILE); properties = new Properties(); - InputStream input = null; - if (file.isFile() && file.canRead()) { - try { - input = new FileInputStream(file); + if(file.isFile() && file.canRead()) { + try(InputStream input = new FileInputStream(file)){ properties.load(input); LOG.info("Loaded properties from " + PROPERTIES_FILE ); - setProperties(properties); + setYangMappingProperties(properties); + } catch (IOException e) { + LOG.error("Failed to close properties file " + PROPERTIES_FILE +"\n",e); } catch (Exception e) { LOG.error("Failed to load properties " + PROPERTIES_FILE +"\n",e); - } finally { - if (input != null) { - try { - input.close(); - } catch (IOException e) { - LOG.error("Failed to close properties file " + PROPERTIES_FILE +"\n",e); - } - } } } } @@ -48,8 +40,8 @@ public class GenericResourceApiUtil extends MdsalHelper { // Trick class loader into loading builders. Some of // these will be needed later by Reflection classes, but need // to explicitly "new" them here to get class loader to load them. - org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ecomp.model.information.EcompModelInformationBuilder u1 = - new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ecomp.model.information.EcompModelInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.onap.model.information.OnapModelInformationBuilder u1 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.onap.model.information.OnapModelInformationBuilder(); org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.assignments.NetworkAssignmentsBuilder u2 = new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.assignments.NetworkAssignmentsBuilder(); org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.information.NetworkInformationBuilder u3 =