Fix checkstyle issues in module sal-dom-broker
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / md / sal / dom / broker / impl / TransactionCommitFailedExceptionMapper.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.md.sal.dom.broker.impl;
9
10 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
11 import org.opendaylight.yangtools.util.concurrent.ExceptionMapper;
12
13 /**
14  * Utility exception mapper which translates Exception to {@link TransactionCommitFailedException}.
15  *
16  * @see ExceptionMapper
17  */
18 public final class TransactionCommitFailedExceptionMapper extends ExceptionMapper<TransactionCommitFailedException> {
19
20     public static final TransactionCommitFailedExceptionMapper PRE_COMMIT_MAPPER = create("preCommit");
21
22     public static final TransactionCommitFailedExceptionMapper CAN_COMMIT_ERROR_MAPPER = create("canCommit");
23
24     public static final TransactionCommitFailedExceptionMapper COMMIT_ERROR_MAPPER = create("commit");
25
26     private TransactionCommitFailedExceptionMapper(final String opName) {
27         super(opName, TransactionCommitFailedException.class);
28     }
29
30     public static TransactionCommitFailedExceptionMapper create(final String opName) {
31         return new TransactionCommitFailedExceptionMapper(opName);
32     }
33
34     @Override
35     protected TransactionCommitFailedException newWithCause(final String message, final Throwable cause) {
36         return new TransactionCommitFailedException(message, cause);
37     }
38 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.