2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.restconf.nb.rfc8040.rests.transactions;
10 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
11 import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
12 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
13 import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
14 import org.opendaylight.restconf.nb.rfc8040.handlers.TransactionChainHandler;
17 * This class represent delegation wrapper for transaction variables.
20 public final class TransactionVarsWrapper {
22 private final InstanceIdentifierContext<?> instanceIdentifier;
23 private final DOMMountPoint mountPoint;
24 private LogicalDatastoreType configuration = null;
25 private final DOMTransactionChain transactionChain;
26 private final TransactionChainHandler transactionChainHandler;
29 * Set base type of variables, which ones we need for transaction.
30 * {@link LogicalDatastoreType} is default set to null (to read all data
31 * from DS - config + state).
33 * @param instanceIdentifier
34 * {@link InstanceIdentifierContext} of data for transaction
36 * mount point if is present
37 * @param transactionChainHandler
38 * used to obtain the transaction chain for creating specific type of transaction
39 * in specific operation
41 public TransactionVarsWrapper(final InstanceIdentifierContext<?> instanceIdentifier, final DOMMountPoint mountPoint,
42 final TransactionChainHandler transactionChainHandler) {
43 this.instanceIdentifier = instanceIdentifier;
44 this.mountPoint = mountPoint;
45 this.transactionChainHandler = transactionChainHandler;
46 transactionChain = transactionChainHandler.get();
50 * Get instance identifier of data.
52 * @return {@link InstanceIdentifierContext}
54 public InstanceIdentifierContext<?> getInstanceIdentifier() {
55 return this.instanceIdentifier;
61 * @return {@link DOMMountPoint}
63 public DOMMountPoint getMountPoint() {
64 return this.mountPoint;
68 * Set {@link LogicalDatastoreType} of data for transaction.
70 * @param datastoreType
71 * {@link LogicalDatastoreType}
73 public void setLogicalDatastoreType(final LogicalDatastoreType datastoreType) {
74 this.configuration = datastoreType;
81 * @return {@link LogicalDatastoreType}
83 public LogicalDatastoreType getLogicalDatastoreType() {
84 return this.configuration;
88 * Get transaction chain for creating specific transaction for specific
91 * @return transaction chain
93 public DOMTransactionChain getTransactionChain() {
94 return this.transactionChain;
97 public TransactionChainHandler getTransactionChainHandler() {
98 return transactionChainHandler;