+ if (client == null) {
+ this.client = new NetboxHttpClient(new NetboxProperties());
+ } else {
+ this.client = client;
+ }
+
+ if (dbLibService == null) {
+ Properties dblibProps = System.getProperties();
+
+ String cfgDir = dblibProps.getProperty("sdnc.config.dir", System.getenv("SDNC_CONFIG_DIR"));
+
+ if ((cfgDir == null) || (cfgDir.length() == 0)) {
+ cfgDir = "/opt/sdnc/data/properties";
+ }
+
+ File dblibPropFile = new File(cfgDir + "/dblib.properties");
+ if (dblibPropFile.exists()) {
+ try {
+ LOG.debug("Loading dblib properties from {}", dblibPropFile.getAbsolutePath());
+ dblibProps = new Properties();
+ dblibProps.load(new FileInputStream(dblibPropFile));
+ } catch (Exception e) {
+ LOG.warn("Could not load properties file {}", dblibPropFile.getAbsolutePath(), e);
+
+ dblibProps = System.getProperties();
+ }
+ }
+
+ DbLibService dbSvc = null;
+ try {
+ dbSvc = new DBResourceManager(dblibProps);
+ } catch (Exception e) {
+ LOG.error("Caught exception trying to create dblib service", e);
+ }
+
+ try {
+ dbSvc = new DBResourceManager(dblibProps);
+ } catch (Exception e) {
+ LOG.error("Caught exception trying to create dblib service", e);
+ }
+ this.dbLibService = dbSvc;
+
+ } else {
+ this.dbLibService = dbLibService;
+ }