2 * Copyright (c) 2014 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.mdsal.dom.broker;
10 import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
12 import org.opendaylight.yangtools.util.concurrent.ExceptionMapper;
15 * Utility exception mapper which translates Exception to {@link TransactionCommitFailedException}.
17 * @see ExceptionMapper
19 public final class TransactionCommitFailedExceptionMapper
20 extends ExceptionMapper<TransactionCommitFailedException> {
22 public static final TransactionCommitFailedExceptionMapper PRE_COMMIT_MAPPER = create("preCommit");
24 public static final TransactionCommitFailedExceptionMapper CAN_COMMIT_ERROR_MAPPER = create("canCommit");
26 public static final TransactionCommitFailedExceptionMapper COMMIT_ERROR_MAPPER = create("commit");
28 private TransactionCommitFailedExceptionMapper(final String opName) {
29 super( opName, TransactionCommitFailedException.class );
32 public static TransactionCommitFailedExceptionMapper create(final String opName) {
33 return new TransactionCommitFailedExceptionMapper(opName);
37 protected TransactionCommitFailedException newWithCause( final String message, final Throwable cause ) {
38 return new TransactionCommitFailedException( message, cause );