From 3cd5e19b313f5835335d04f1f002ff858fcf174f Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 29 Aug 2017 16:06:22 -0400 Subject: Prune code migrated from sdnc/core to ccsdk Remove code from sdnc/core which has been refactored to the CCSDK sli/core project as part of the ONAP Amsterdam release. Added README.md files for each former sdnc/core component redirecting the reader to the correct CCSDK repo. Change-Id: Ifb1f7752fa5e6e08e4393fb34e68dc1a84f35678 Issue-ID: SDNC-59 Signed-off-by: Dan Timoney --- .../sli/resource/dblib/DBLIBResourceActivator.java | 130 --------------------- 1 file changed, 130 deletions(-) delete mode 100644 dblib/provider/src/main/java/org/openecomp/sdnc/sli/resource/dblib/DBLIBResourceActivator.java (limited to 'dblib/provider/src/main/java/org/openecomp/sdnc/sli/resource/dblib/DBLIBResourceActivator.java') diff --git a/dblib/provider/src/main/java/org/openecomp/sdnc/sli/resource/dblib/DBLIBResourceActivator.java b/dblib/provider/src/main/java/org/openecomp/sdnc/sli/resource/dblib/DBLIBResourceActivator.java deleted file mode 100644 index 150a9a8..0000000 --- a/dblib/provider/src/main/java/org/openecomp/sdnc/sli/resource/dblib/DBLIBResourceActivator.java +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openecomp - * ================================================================================ - * Copyright (C) 2016 - 2017 AT&T - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * 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========================================================= - */ - -package org.openecomp.sdnc.sli.resource.dblib; - -import java.io.File; -import java.net.URL; -import java.util.Properties; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.ServiceRegistration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DBLIBResourceActivator implements BundleActivator { - - private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; - - private static final String DBLIB_PROP_PATH = "/dblib.properties"; - - private ServiceRegistration registration = null; - - private static final Logger LOG = LoggerFactory.getLogger(DBLIBResourceActivator.class); - - @Override - public void start(BundleContext ctx) throws Exception { - LOG.info("entering DBLIBResourceActivator.start"); - - DbLibService jdbcDataSource = null; - // Read properties - Properties props = new Properties(); - - File file = null; - URL propURL = null; - String propDir = System.getenv(SDNC_CONFIG_DIR); - if ((propDir == null) || (propDir.length() == 0)) { - propDir = "/opt/sdnc/data/properties"; - } - file = new File(propDir + DBLIB_PROP_PATH); - if(file.exists()) { - propURL = file.toURI().toURL(); - LOG.info("Using property file (1): " + file.toString()); - } else { - propURL = ctx.getBundle().getResource("dblib.properties"); - URL tmp = null; - if (propURL == null) { - file = new File(DBLIB_PROP_PATH); - tmp = this.getClass().getResource(DBLIB_PROP_PATH); -// if(!file.exists()) { - if(tmp == null) { - throw new DblibConfigurationException("Missing configuration properties resource(3) : " + DBLIB_PROP_PATH); - } else { - propURL = tmp; //file.toURI().toURL(); - LOG.info("Using property file (4): " + file.toString()); - } - } else { - LOG.info("Using property file (2): " + propURL.toString()); - } - } - - - try { - props.load(propURL.openStream()); - } catch (Exception e) { - throw new DblibConfigurationException("Could not load properties at URL " + propURL.toString(), e); - - } - - - - try { - jdbcDataSource = DBResourceManager.create(props); - } catch (Exception exc) { - throw new DblibConfigurationException("Could not get initialize database", exc); - } - - String regName = jdbcDataSource.getClass().getName(); - - LOG.info("Registering DBResourceManager service "+regName); - registration = ctx.registerService(new String[] { regName, DbLibService.class.getName(), "javax.sql.DataSource" }, jdbcDataSource, null); - } - - @Override - public void stop(BundleContext ctx) throws Exception { - LOG.info("entering DBLIBResourceActivator.stop"); - if (registration != null) - { - try { - ServiceReference sref = ctx.getServiceReference(DbLibService.class.getName()); - - if (sref == null) { - LOG.warn("Could not find service reference for DBLIB service (" + DbLibService.class.getName() + ")"); - } else { - DBResourceManager dblibSvc = (DBResourceManager) ctx.getService(sref); - if (dblibSvc == null) { - LOG.warn("Could not find service reference for DBLIB service (" + DbLibService.class.getName() + ")"); - } else { - dblibSvc.cleanUp(); - } - } - } catch(Throwable exc) { - LOG.warn("Cleanup", exc); - } - - registration.unregister(); - registration = null; - LOG.debug("Deregistering DBResourceManager service"); - } - } - -} -- cgit 1.2.3-korg