KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tm > JBossTransactionRolledbackException


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.tm;
23
24 import java.io.PrintStream JavaDoc;
25 import java.io.PrintWriter JavaDoc;
26 import java.io.Serializable JavaDoc;
27 import javax.transaction.RollbackException JavaDoc;
28 import javax.transaction.TransactionRolledbackException JavaDoc;
29 import org.jboss.util.NestedThrowable;
30
31
32
33 /**
34  * JBossTransactionRolledbackException.java
35  *
36  *
37  * Created: Sun Feb 9 22:45:03 2003
38  *
39  * @author <a HREF="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
40  * @version
41  */

42
43 public class JBossTransactionRolledbackException
44    extends TransactionRolledbackException JavaDoc
45    implements NestedThrowable, Serializable JavaDoc
46 {
47
48    public JBossTransactionRolledbackException()
49    {
50       super();
51    }
52
53    public JBossTransactionRolledbackException(final String JavaDoc message)
54    {
55       super(message);
56    }
57
58
59    public JBossTransactionRolledbackException(final Throwable JavaDoc t)
60    {
61       super();
62       this.detail = t;
63    }
64
65    public JBossTransactionRolledbackException(final String JavaDoc message, final Throwable JavaDoc t)
66    {
67       super(message);
68       this.detail = t;
69    }
70
71
72    // Implementation of org.jboss.util.NestedThrowable
73

74    public Throwable JavaDoc getNested()
75    {
76       return detail;
77    }
78
79    public Throwable JavaDoc getCause()
80    {
81       return detail;
82    }
83
84    /**
85     * Returns the composite throwable message.
86     *
87     * @return The composite throwable message.
88     */

89    public String JavaDoc getMessage()
90    {
91       return NestedThrowable.Util.getMessage(super.getMessage(), detail);
92    }
93
94    /**
95     * Prints the composite message and the embedded stack trace to the
96     * specified print stream.
97     *
98     * @param stream Stream to print to.
99     */

100    public void printStackTrace(final PrintStream JavaDoc stream)
101    {
102       if (detail == null || NestedThrowable.PARENT_TRACE_ENABLED)
103       {
104          super.printStackTrace(stream);
105       }
106       NestedThrowable.Util.print(detail, stream);
107    }
108
109    /**
110     * Prints the composite message and the embedded stack trace to the
111     * specified print writer.
112     *
113     * @param writer Writer to print to.
114     */

115    public void printStackTrace(final PrintWriter JavaDoc writer)
116    {
117       if (detail == null || NestedThrowable.PARENT_TRACE_ENABLED)
118       {
119          super.printStackTrace(writer);
120       }
121       NestedThrowable.Util.print(detail, writer);
122    }
123
124    /**
125     * Prints the composite message and the embedded stack trace to
126     * <tt>System.err</tt>.
127     */

128    public void printStackTrace()
129    {
130       printStackTrace(System.err);
131    }
132
133 }// JBossTransactionRolledbackException
134
Popular Tags