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.sal.connector.remoterpc.impl;
11 import org.apache.felix.dm.Component;
12 import org.opendaylight.controller.clustering.services.ICacheUpdateAware;
13 import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
14 import org.opendaylight.controller.sal.connector.remoterpc.api.RoutingTable;
15 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
19 import java.util.Dictionary;
20 import java.util.HashSet;
21 import java.util.Hashtable;
27 public class Activator extends ComponentActivatorAbstractBase {
29 protected static final Logger logger = LoggerFactory
30 .getLogger(Activator.class);
31 private static final String CACHE_UPDATE_AWARE_REGISTRY_KEY = "cachenames" ;
35 * Method which tells how many Global implementations are
36 * supported by the bundle. This way we can tune the number of
37 * components created. This components will be created ONLY at the
38 * time of bundle startup and will be destroyed only at time of
39 * bundle destruction, this is the major difference with the
40 * implementation retrieved via getImplementations where all of
41 * them are assumed to be in a container!
44 * @return The list of implementations the bundle will support,
49 protected Object[] getGlobalImplementations(){
50 logger.debug("Calling getGlobalImplementations to return:", RoutingTableImpl.class);
52 RoutingTableImpl.class
57 * Configure the dependency for a given instance Global
59 * @param c Component assigned for this instance, this will be
60 * what will be used for configuration
61 * @param imp implementation to be configured
65 protected void configureGlobalInstance(Component c, Object imp){
66 if (imp.equals(RoutingTableImpl.class)) {
67 Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
68 Set<String> propSet = new HashSet<String>();
69 propSet.add(RoutingTableImpl.ROUTING_TABLE_GLOBAL_CACHE);
70 props.put(CACHE_UPDATE_AWARE_REGISTRY_KEY, propSet);
72 c.setInterface(new String[] { RoutingTable.class.getName(),ICacheUpdateAware.class.getName() }, props);
73 logger.debug("configureGlobalInstance adding dependency:", IClusterGlobalServices.class);
75 c.add(createServiceDependency().setService(
76 IClusterGlobalServices.class).setCallbacks(
77 "setClusterGlobalServices",
78 "unsetClusterGlobalServices").setRequired(true));