9a710899460f8d19fe8e71f269333c0467f47651
[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 final class ShardRegistration<T extends DOMDataTreeShard> extends AbstractListenerRegistration<T> {
16     private final DOMDataTreeIdentifier prefix;
17     private final ShardedDOMDataTree tree;
18
19     protected ShardRegistration(final ShardedDOMDataTree tree, final DOMDataTreeIdentifier prefix, final T shard) {
20         super(shard);
21         this.tree = Preconditions.checkNotNull(tree);
22         this.prefix = Preconditions.checkNotNull(prefix);
23     }
24
25     DOMDataTreeIdentifier getPrefix() {
26         return prefix;
27     }
28
29     @Override
30     protected void removeRegistration() {
31         tree.removeShard(this);
32     }
33 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.