2 * Copyright (c) 2015 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.cluster.datastore.entityownership.messages;
11 import com.google.common.base.Preconditions;
12 import java.util.Collection;
13 import org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategy;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 * Message sent when a new owner needs to be selected.
19 public class SelectOwner {
20 private final YangInstanceIdentifier entityPath;
21 private final Collection<String> allCandidates;
22 private final EntityOwnerSelectionStrategy ownerSelectionStrategy;
24 public SelectOwner(YangInstanceIdentifier entityPath, Collection<String> allCandidates,
25 EntityOwnerSelectionStrategy ownerSelectionStrategy) {
27 this.entityPath = Preconditions.checkNotNull(entityPath, "entityPath should not be null");
28 this.allCandidates = Preconditions.checkNotNull(allCandidates, "allCandidates should not be null");
29 this.ownerSelectionStrategy = Preconditions.checkNotNull(ownerSelectionStrategy,
30 "ownerSelectionStrategy should not be null");
33 public YangInstanceIdentifier getEntityPath() {
37 public Collection<String> getAllCandidates() {
41 public EntityOwnerSelectionStrategy getOwnerSelectionStrategy() {
42 return ownerSelectionStrategy;
46 public String toString() {
47 return "SelectOwner [entityPath=" + entityPath + ", allCandidates=" + allCandidates
48 + ", ownerSelectionStrategy=" + ownerSelectionStrategy + "]";