2 * Copyright (c) 2015 Brocade Communications 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.config.yang.config.distributed_entity_ownership_service;
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
13 import org.opendaylight.controller.cluster.datastore.entityownership.DistributedEntityOwnershipService;
14 import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfig;
15 import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfigReader;
16 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
17 import org.osgi.framework.BundleContext;
20 public class DistributedEntityOwnershipServiceProviderModule extends org.opendaylight.controller.config.yang.config.distributed_entity_ownership_service.AbstractDistributedEntityOwnershipServiceProviderModule {
21 private BundleContext bundleContext;
23 public DistributedEntityOwnershipServiceProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
24 super(identifier, dependencyResolver);
27 public DistributedEntityOwnershipServiceProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.distributed_entity_ownership_service.DistributedEntityOwnershipServiceProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
28 super(identifier, dependencyResolver, oldModule, oldInstance);
32 public void customValidation() {
33 // add custom validation form module attributes here.
37 public boolean canReuseInstance(AbstractDistributedEntityOwnershipServiceProviderModule oldModule) {
42 public java.lang.AutoCloseable createInstance() {
43 DOMStore dataStore = getDataStoreDependency();
44 Preconditions.checkArgument(dataStore instanceof DistributedDataStore,
45 "Injected DOMStore must be an instance of DistributedDataStore");
46 EntityOwnerSelectionStrategyConfig strategyConfig = new EntityOwnerSelectionStrategyConfigReader(bundleContext).getConfig();
47 DistributedEntityOwnershipService service = new DistributedEntityOwnershipService((DistributedDataStore)dataStore, strategyConfig);
52 public void setBundleContext(BundleContext bundleContext) {
53 this.bundleContext = bundleContext;