2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.sdnc.vnftools;
25 import java.io.FileInputStream;
26 import java.util.LinkedList;
27 import java.util.List;
28 import java.util.Properties;
30 import org.onap.ccsdk.sli.core.sli.ConfigurationException;
31 import org.osgi.framework.BundleActivator;
32 import org.osgi.framework.BundleContext;
33 import org.osgi.framework.ServiceRegistration;
34 import org.slf4j.Logger;
35 import org.slf4j.LoggerFactory;
37 public class VnfToolsActivator implements BundleActivator {
39 private static final String VNFTOOLS_PROP_VAR = "/vnftools.properties";
40 private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR";
42 @SuppressWarnings("rawtypes")
43 private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
45 private static final Logger LOG = LoggerFactory.getLogger(VnfToolsActivator.class);
48 public void start(BundleContext ctx) throws Exception {
50 VnfTools plugin = new VnfTools(null);
52 LOG.info("Registering service " + plugin.getClass().getName());
53 registrations.add(ctx.registerService(plugin.getClass().getName(), plugin, null));
57 public void stop(BundleContext ctx) throws Exception {
59 for (@SuppressWarnings("rawtypes")
60 ServiceRegistration registration : registrations) {
61 registration.unregister();