package org.openecomp.appc.licmgr.impl;
+import javax.sql.rowset.CachedRowSet;
+
import org.openecomp.appc.licmgr.Constants;
import org.openecomp.appc.licmgr.LicenseDataAccessService;
import org.openecomp.appc.licmgr.exception.DataAccessException;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.openecomp.sdnc.sli.resource.dblib.DbLibService;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-
-import javax.sql.rowset.CachedRowSet;
import static org.openecomp.appc.licmgr.Constants.ASDC_ARTIFACTS_FIELDS;
@SuppressWarnings("JavaDoc")
-class LicenseDataAccessServiceImpl implements LicenseDataAccessService {
+public class LicenseDataAccessServiceImpl implements LicenseDataAccessService {
private static EELFLogger logger = EELFManager.getInstance().getLogger(LicenseDataAccessServiceImpl.class);
private String schema;
- private DbLibService dbLibService;
-
- private void checkDbLibService() throws DataAccessException {
- if (null != dbLibService) {return;}
+ public void setDbLibService(DbLibService dbLibService) {
+ this.dbLibService = dbLibService;
+ }
- //get dblib service and send it to DAService
- BundleContext bctx = FrameworkUtil.getBundle(LicenseManagerImpl.class).getBundleContext();
- ServiceReference sref = bctx.getServiceReference(DbLibService.class.getName());
- dbLibService = (DbLibService)bctx.getService(sref);
+ private DbLibService dbLibService;
- }
/**
* empty constructor
public Map<String,String> retrieveLicenseModelData(String vnfType, String vnfVersion, String... fields) throws
DataAccessException {
- checkDbLibService();
-
Map<String,String> result = new HashMap<>();
if (null == fields || 0 == fields.length) fields = new String[]{ASDC_ARTIFACTS_FIELDS.ARTIFACT_CONTENT.name()};
@Override
public void storeArtifactPayload(Map<String, String> parameters) throws RuntimeException {
- checkDbLibService();
-
if(parameters == null || parameters.isEmpty()) {
throw new RuntimeException("No parameters for insert are provided");
}