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;
11 import org.opendaylight.yangtools.util.concurrent.ExceptionMapper;
14 * Utility exception mapper which translates Exception to {@link TransactionCommitFailedException}.
16 * @see ExceptionMapper
18 public final class TransactionCommitFailedExceptionMapper
19 extends ExceptionMapper<TransactionCommitFailedException> {
21 public static final TransactionCommitFailedExceptionMapper PRE_COMMIT_MAPPER = create("preCommit");
23 public static final TransactionCommitFailedExceptionMapper CAN_COMMIT_ERROR_MAPPER = create("canCommit");
25 public static final TransactionCommitFailedExceptionMapper COMMIT_ERROR_MAPPER = create("commit");
27 private TransactionCommitFailedExceptionMapper(final String opName) {
28 super( opName, TransactionCommitFailedException.class );
31 public static TransactionCommitFailedExceptionMapper create(final String opName) {
32 return new TransactionCommitFailedExceptionMapper(opName);
36 protected TransactionCommitFailedException newWithCause( final String message, final Throwable cause ) {
37 return new TransactionCommitFailedException( message, cause );