2 * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. 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.genius.utils.batching;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.util.concurrent.ListenableFuture;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17 public abstract class ActionableResource<T extends DataObject> {
19 static final short CREATE = 1;
20 static final short UPDATE = 2;
21 static final short DELETE = 3;
22 static final short READ = 4;
23 // MDSAL-534 Merge,Put with no create_missing_parents flag
24 static final short UPDATECONTAINER = 5;
26 private final InstanceIdentifier<T> path;
27 private final short action;
29 // Hidden to prevent subclassing outside of this package
30 ActionableResource(final InstanceIdentifier<T> path, final short action) {
31 this.path = requireNonNull(path);
35 final short getAction() {
39 final @NonNull InstanceIdentifier<T> getInstanceIdentifier() {
43 abstract Object getInstance();
45 abstract Object getOldInstance();
47 abstract ListenableFuture<Void> getResultFuture();