Switch default stream output to Magnesium
[controller.git] / opendaylight / md-sal / sal-distributed-eos / src / main / java / org / opendaylight / controller / cluster / entityownership / messages / SelectOwner.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.entityownership.messages;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.util.Collection;
13 import org.opendaylight.controller.cluster.entityownership.selectionstrategy.EntityOwnerSelectionStrategy;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15
16 /**
17  * Message sent when a new owner needs to be selected.
18  */
19 public class SelectOwner {
20     private final YangInstanceIdentifier entityPath;
21     private final Collection<String> allCandidates;
22     private final EntityOwnerSelectionStrategy ownerSelectionStrategy;
23
24     public SelectOwner(final YangInstanceIdentifier entityPath, final Collection<String> allCandidates,
25                        final EntityOwnerSelectionStrategy ownerSelectionStrategy) {
26         this.entityPath = requireNonNull(entityPath, "entityPath should not be null");
27         this.allCandidates = requireNonNull(allCandidates, "allCandidates should not be null");
28         this.ownerSelectionStrategy = requireNonNull(ownerSelectionStrategy,
29             "ownerSelectionStrategy should not be null");
30     }
31
32     public YangInstanceIdentifier getEntityPath() {
33         return entityPath;
34     }
35
36     public Collection<String> getAllCandidates() {
37         return allCandidates;
38     }
39
40     public EntityOwnerSelectionStrategy getOwnerSelectionStrategy() {
41         return ownerSelectionStrategy;
42     }
43
44     @Override
45     public String toString() {
46         return "SelectOwner [entityPath=" + entityPath + ", allCandidates=" + allCandidates
47                 + ", ownerSelectionStrategy=" + ownerSelectionStrategy + "]";
48     }
49 }