First part of onap rename
[appc.git] / appc-adapters / appc-netconf-adapter / appc-netconf-adapter-bundle / src / main / java / org / openecomp / appc / adapter / netconf / internal / NetconfDataAccessServiceImpl.java
index 51e9816..f3cca85 100644 (file)
@@ -1,10 +1,11 @@
 /*-
  * ============LICENSE_START=======================================================
- * APPC
+ * ONAP : APPC
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Amdocs
  * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * ============LICENSE_END=========================================================
+ * 
  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.appc.adapter.netconf.internal;
+package org.onap.appc.adapter.netconf.internal;
 
-import javax.sql.rowset.CachedRowSet;
-
-import org.openecomp.appc.adapter.netconf.ConnectionDetails;
-import org.openecomp.appc.adapter.netconf.NetconfConnectionDetails;
-import org.openecomp.appc.adapter.netconf.NetconfDataAccessService;
-import org.openecomp.appc.adapter.netconf.exception.DataAccessException;
-import org.openecomp.appc.adapter.netconf.util.Constants;
-import org.openecomp.appc.exceptions.APPCException;
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
-import org.openecomp.sdnc.sli.resource.dblib.DbLibService;
+import org.onap.appc.adapter.netconf.ConnectionDetails;
+import org.onap.appc.adapter.netconf.NetconfConnectionDetails;
+import org.onap.appc.adapter.netconf.NetconfDataAccessService;
+import org.onap.appc.adapter.netconf.exception.DataAccessException;
+import org.onap.appc.adapter.netconf.util.Constants;
+import org.onap.ccsdk.sli.core.dblib.DbLibService;
 
+import javax.sql.rowset.CachedRowSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
 
-
 public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
 
     private static EELFLogger logger = EELFManager.getInstance().getLogger(NetconfDataAccessServiceImpl.class);
@@ -64,13 +63,11 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
         argList.add(xmlID);
 
         try {
-
             final CachedRowSet data = dbLibService.getData(queryString, argList, schema);
             if (data.first()) {
                 fileContent = data.getString(Constants.FILE_CONTENT_TABLE_FIELD_NAME);
             }
-
-        } catch (Throwable e) {
+        } catch (Exception e) {
             logger.error("Error Accessing Database " + e);
             throw new DataAccessException(e);
         }
@@ -83,7 +80,8 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
                     DataAccessException {
         boolean recordFound = false;
 
-        String queryString = "select " + Constants.USER_NAME_TABLE_FIELD_NAME + "," + Constants.PASSWORD_TABLE_FIELD_NAME + "," + Constants.PORT_NUMBER_TABLE_FIELD_NAME + " " +
+        String queryString = "select " + Constants.USER_NAME_TABLE_FIELD_NAME + "," +
+                Constants.PASSWORD_TABLE_FIELD_NAME + "," + Constants.PORT_NUMBER_TABLE_FIELD_NAME + " " +
                 "from " + Constants.DEVICE_AUTHENTICATION_TABLE_NAME + " " +
                 "where " + Constants.VNF_TYPE_TABLE_FIELD_NAME + " = ?";
 
@@ -91,7 +89,6 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
         argList.add(vnfType);
 
         try {
-
             final CachedRowSet data = dbLibService.getData(queryString, argList, schema);
             if (data.first()) {
                 connectionDetails.setUsername(data.getString(Constants.USER_NAME_TABLE_FIELD_NAME));
@@ -99,7 +96,6 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
                 connectionDetails.setPort(data.getInt(Constants.PORT_NUMBER_TABLE_FIELD_NAME));
                 recordFound = true;
             }
-
         } catch (SQLException e) {
             logger.error("Error Accessing Database " + e);
             throw new DataAccessException(e);
@@ -109,9 +105,8 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
     }
 
     @Override
-    public boolean retrieveNetconfConnectionDetails(String vnfType, NetconfConnectionDetails connectionDetails) throws
-                    DataAccessException
-    {
+    public boolean retrieveNetconfConnectionDetails(String vnfType, NetconfConnectionDetails connectionDetails)
+            throws DataAccessException {
         ConnectionDetails connDetails = new ConnectionDetails();
         if(this.retrieveConnectionDetails(vnfType, connDetails))
         {
@@ -124,9 +119,8 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
     }
 
     @Override
-    public boolean logDeviceInteraction(String instanceId, String requestId, String creationDate, String logText) throws
-                    DataAccessException {
-
+    public boolean logDeviceInteraction(String instanceId, String requestId, String creationDate, String logText)
+            throws DataAccessException {
         String queryString = "INSERT INTO "+ Constants.DEVICE_INTERFACE_LOG_TABLE_NAME+"("+
                 Constants.SERVICE_INSTANCE_ID_FIELD_NAME+","+
                 Constants.REQUEST_ID_FIELD_NAME+","+
@@ -141,9 +135,7 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
         argList.add(logText);
 
         try {
-
             dbLibService.writeData(queryString, argList, schema);
-
         } catch (SQLException e) {
             logger.error("Logging Device interaction failed - "+ queryString);
             throw new DataAccessException(e);