X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fadsal%2Fnorthbound%2Fbundlescanner%2Fimplementation%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnorthbound%2Fbundlescanner%2Finternal%2FActivator.java;fp=opendaylight%2Fadsal%2Fnorthbound%2Fbundlescanner%2Fimplementation%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnorthbound%2Fbundlescanner%2Finternal%2FActivator.java;h=69c81242d99c1ace9cc2ebdbb8a9fd47d9ca07c8;hb=42c32160bfd41de57189bb246fec5ffb48ed8e9e;hp=0000000000000000000000000000000000000000;hpb=edf5bfcee83c750853253ccfd991ba7000f5f65b;p=controller.git diff --git a/opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/Activator.java b/opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/Activator.java new file mode 100644 index 0000000000..69c81242d9 --- /dev/null +++ b/opendaylight/adsal/northbound/bundlescanner/implementation/src/main/java/org/opendaylight/controller/northbound/bundlescanner/internal/Activator.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.northbound.bundlescanner.internal; + +import org.apache.felix.dm.Component; +import org.opendaylight.controller.northbound.bundlescanner.IBundleScanService; +import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; + +/** + * The activator registers the BundleScanner. + */ +public class Activator extends ComponentActivatorAbstractBase { + + @Override + protected void init() { + BundleContext context = FrameworkUtil.getBundle(BundleScanner.class).getBundleContext(); + context.addBundleListener(BundleScanner.getInstance()); + } + + @Override + public void destroy() { + BundleContext context = FrameworkUtil.getBundle(BundleScanner.class).getBundleContext(); + context.removeBundleListener(BundleScanner.getInstance()); + } + + @Override + protected Object[] getGlobalImplementations() { + return new Object[] { BundleScanServiceImpl.class }; + } + + @Override + protected void configureGlobalInstance(Component c, Object imp) { + if (!imp.equals(BundleScanServiceImpl.class)) return; + // export service + c.setInterface( + new String[] { IBundleScanService.class.getName() }, + null); + } + +}