2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.protocol_plugin.openflow.internal;
11 import java.util.Arrays;
12 import java.util.List;
13 import java.util.ArrayList;
15 import org.apache.felix.dm.Component;
16 import org.opendaylight.controller.protocol_plugin.openflow.core.internal.EnhancedController;
17 import org.opendaylight.openflowplugin.openflow.core.internal.Controller;
18 import org.opendaylight.openflowplugin.openflow.internal.Activator;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
23 * Openflow protocol plugin Activator
27 public class EnhancedActivator extends Activator {
28 protected static final Logger logger = LoggerFactory
29 .getLogger(EnhancedActivator.class);
31 // Default Constructor for the activator
32 public EnhancedActivator() {
34 logger.debug("Enhanced activator called!");
38 * Function that is used to communicate to dependency manager the list of
39 * known implementations for services that are container independent.
42 * @return An array containing all the CLASS objects that will be
43 * instantiated in order to get an fully working implementation
47 public Object[] getGlobalImplementations() {
48 Object[] res = super.getGlobalImplementations();
49 // Now remove the Controller.class and return the
51 List resList = new ArrayList(Arrays.asList(res));
52 resList.remove(Controller.class);
53 resList.add(EnhancedController.class);
54 return resList.toArray();
58 * Function that is called when configuration of the dependencies is
62 * dependency manager Component object, used for configuring the
63 * dependencies exported and imported
65 * Implementation class that is being configured, needed as long
66 * as the same routine can configure multiple implementations
69 public void configureGlobalInstance(Component c, Object imp) {
70 if (imp.equals(EnhancedController.class)) {
71 // Configure it like if was the Controller.class
72 super.configureGlobalInstance(c, Controller.class);
74 super.configureGlobalInstance(c, imp);