/* * Copyright (c) 2014 Cisco 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.sal.common.util; import java.util.Collections; import org.opendaylight.controller.md.sal.common.api.data.DataModification; import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction; import org.opendaylight.yangtools.concepts.Path; import org.opendaylight.yangtools.yang.common.RpcError; import org.opendaylight.yangtools.yang.common.RpcResult; public class CommitHandlerTransactions { private static class AllwaysSuccessfulTransaction

,D> implements DataCommitTransaction { private final DataModification modification; public AllwaysSuccessfulTransaction(DataModification modification) { this.modification = modification; } @Override public RpcResult rollback() throws IllegalStateException { return Rpcs.getRpcResult(true, null, Collections.emptyList()); } @Override public RpcResult finish() throws IllegalStateException { return Rpcs.getRpcResult(true, null, Collections.emptyList()); } @Override public DataModification getModification() { return modification; } } public static final

,D> AllwaysSuccessfulTransaction allwaysSuccessfulTransaction(DataModification modification) { return new AllwaysSuccessfulTransaction<>(modification); } }