Deprecate legacy EOS API classes
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / clustering / CandidateAlreadyRegisteredException.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
9 package org.opendaylight.controller.md.sal.common.api.clustering;
10
11 import com.google.common.base.Preconditions;
12 import javax.annotation.Nonnull;
13
14 /**
15  * Thrown when a Candidate has already been registered for a given Entity. This could be due to a component doing a
16  * duplicate registration or two different components within the same process trying to register a Candidate.
17  *
18  * @deprecated Use org.opendaylight.mdsal.common.api.clustering.CandidateAlreadyRegisteredException instead
19  */
20 @Deprecated
21 public class CandidateAlreadyRegisteredException extends Exception {
22     private static final long serialVersionUID = 1L;
23
24     private final Entity entity;
25
26     public CandidateAlreadyRegisteredException(@Nonnull Entity entity) {
27         super(String.format("Candidate has already been registered for %s",
28                 Preconditions.checkNotNull(entity, "entity should not be null")));
29         this.entity = entity;
30     }
31
32     /**
33      * Returns the entity for which a Candidate has already been registered in the current process.
34      *
35      * @return the entity for which a Candidate has already been registered in the current process
36      */
37     @Nonnull
38     public Entity getEntity() {
39         return entity;
40     }
41 }