X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fconfig%2Fdistributed_datastore_provider%2FForwardingDistributedDataStore.java;fp=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fconfig%2Fdistributed_datastore_provider%2FForwardingDistributedDataStore.java;h=b04bf1bf81d8635c63ef0fa43ee99a6346495681;hb=dceb9db7853dabfbd4abdfb3d886a79871097831;hp=0000000000000000000000000000000000000000;hpb=2608b7032d0d019f5125704609eaaa0590c4598a;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/ForwardingDistributedDataStore.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/ForwardingDistributedDataStore.java new file mode 100644 index 0000000000..b04bf1bf81 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/ForwardingDistributedDataStore.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.config.yang.config.distributed_datastore_provider; + +import com.google.common.collect.ForwardingObject; +import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface; +import org.opendaylight.controller.cluster.datastore.utils.ActorContext; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; +import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction; +import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction; +import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain; +import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; + +/** + * DOMStore implementation that forwards to a delegate. + * + * @author Thomas Pantelis + */ +class ForwardingDistributedDataStore extends ForwardingObject implements DistributedDataStoreInterface, AutoCloseable { + private final DistributedDataStoreInterface delegate; + private final AutoCloseable closeable; + + ForwardingDistributedDataStore(DistributedDataStoreInterface delegate, AutoCloseable closeable) { + this.delegate = delegate; + this.closeable = closeable; + } + + @Override + public DOMStoreReadTransaction newReadOnlyTransaction() { + return delegate().newReadOnlyTransaction(); + } + + @Override + public DOMStoreWriteTransaction newWriteOnlyTransaction() { + return delegate().newWriteOnlyTransaction(); + } + + @Override + public DOMStoreReadWriteTransaction newReadWriteTransaction() { + return delegate().newReadWriteTransaction(); + } + + @Override + public >> ListenerRegistration registerChangeListener( + YangInstanceIdentifier path, L listener, DataChangeScope scope) { + return delegate().registerChangeListener(path, listener, scope); + } + + @Override + public DOMStoreTransactionChain createTransactionChain() { + return delegate().createTransactionChain(); + } + + @Override + public ActorContext getActorContext() { + return delegate().getActorContext(); + } + + @Override + public void close() throws Exception { + closeable.close(); + } + + @Override + protected DistributedDataStoreInterface delegate() { + return delegate; + } +}