Merge "Fixed bug in Data store where multiple readers could overwrite other augmentat...
[controller.git] / opendaylight / md-sal / clustered-data-store / implementation / src / main / java / org / opendaylight / controller / datastore / internal / Activator.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.datastore.internal;
11
12 import org.apache.felix.dm.Component;
13 import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
14 import org.opendaylight.controller.datastore.ClusteredDataStore;
15 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 import java.util.Dictionary;
20 import java.util.Hashtable;
21 import java.util.Set;
22
23 public class Activator extends ComponentActivatorAbstractBase {
24     protected static final Logger logger = LoggerFactory
25             .getLogger(Activator.class);
26
27
28     @Override
29     protected Object[] getGlobalImplementations(){
30         logger.debug("Calling getGlobalImplementations to return:", ClusteredDataStoreManager.class);
31         return new Object[] {
32             ClusteredDataStoreManager.class
33         };
34     }
35
36
37     @Override
38     protected void configureGlobalInstance(Component c, Object imp){
39         if (imp.equals(ClusteredDataStoreManager.class)) {
40             Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
41
42             c.setInterface(new String[] { ClusteredDataStore.class.getName() }, props);
43             logger.debug("configureGlobalInstance adding dependency:", IClusterGlobalServices.class);
44             
45             c.add(createServiceDependency().setService(
46                     IClusterGlobalServices.class).setCallbacks(
47                     "setClusterGlobalServices",
48                     "unsetClusterGlobalServices").setRequired(true));
49
50         }
51     }
52
53
54 }