Fix odl-config-persister
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / md / sal / dom / broker / impl / ShardRegistration.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.md.sal.dom.broker.impl;
9
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeIdentifier;
12 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeShard;
13 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
14
15 /**
16  * ShardRegistration.
17  *
18  * @deprecated To be removed with {@link ShardedDOMDataTree}.
19  */
20 @Deprecated
21 final class ShardRegistration<T extends DOMDataTreeShard> extends AbstractListenerRegistration<T> {
22     private final DOMDataTreeIdentifier prefix;
23     private final ShardedDOMDataTree tree;
24
25     protected ShardRegistration(final ShardedDOMDataTree tree, final DOMDataTreeIdentifier prefix, final T shard) {
26         super(shard);
27         this.tree = Preconditions.checkNotNull(tree);
28         this.prefix = Preconditions.checkNotNull(prefix);
29     }
30
31     DOMDataTreeIdentifier getPrefix() {
32         return prefix;
33     }
34
35     @Override
36     protected void removeRegistration() {
37         tree.removeShard(this);
38     }
39 }