KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > recover > bean > MockLoggerService


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.test.recover.bean;
23
24 import org.jboss.test.recover.interfaces.MockLogger;
25 import org.jboss.tm.TxManager;
26 import org.jboss.tm.recovery.BatchRecoveryLogger;
27 import org.jboss.tm.recovery.BatchRecoveryLoggerService;
28
29 /**
30  *
31  * A MockLoggerService.
32  *
33  * @author <a HREF="mailto:bill@jboss.org">Bill Burke</a>
34  * @author <a HREF="reverbel@ime.usp.br">Francisco Reverbel</a>
35  * @version $Revision: 37406 $
36  */

37 public class MockLoggerService
38       extends BatchRecoveryLoggerService
39       implements MockLoggerServiceMBean
40 {
41    protected BatchRecoveryLogger createLogger()
42    {
43       return new MockLogger();
44    }
45
46    public boolean isCrashOnFailure()
47    {
48       return ((MockLogger)logger).isCrashOnFailure();
49    }
50
51    public void setCrashOnFailure(boolean crashOnFailure)
52    {
53       ((MockLogger)logger).setCrashOnFailure(crashOnFailure);
54    }
55
56    public int getFailBefore()
57    {
58       return ((MockLogger)logger).getFailBefore();
59    }
60
61    public void setFailBefore(int failBefore)
62    {
63       ((MockLogger)logger).setFailBefore(failBefore);
64    }
65
66    public int getFailAfter()
67    {
68       return ((MockLogger)logger).getFailAfter();
69    }
70
71    public void setFailAfter(int failAfter)
72    {
73       ((MockLogger)logger).setFailAfter(failAfter);
74    }
75
76    public boolean isFailBeforeCommitting()
77    {
78       return ((MockLogger)logger).isFailBeforeCommitting();
79    }
80
81    public void setFailBeforeCommitting(boolean failBeforeCommitting)
82    {
83       ((MockLogger)logger).setFailBeforeCommitting(failBeforeCommitting);
84    }
85
86    public boolean isFailAfterCommitting()
87    {
88       return ((MockLogger)logger).isFailAfterCommitting();
89    }
90
91    public void setFailAfterCommitting(boolean failAfterCommitting)
92    {
93       ((MockLogger)logger).setFailAfterCommitting(failAfterCommitting);
94    }
95
96    public boolean isFailBeforePreparing()
97    {
98       return ((MockLogger)logger).isFailBeforePreparing();
99    }
100
101    public void setFailBeforePreparing(boolean failBeforePreparing)
102    {
103       ((MockLogger)logger).setFailBeforePreparing(failBeforePreparing);
104    }
105
106    public boolean isFailAfterPreparing()
107    {
108       return ((MockLogger)logger).isFailAfterPreparing();
109    }
110
111    public void setFailAfterPreparing(boolean failAfterPreparing)
112    {
113       ((MockLogger)logger).setFailAfterPreparing(failAfterPreparing);
114    }
115
116    public boolean isFailBeforeSavingHeuristicStatus()
117    {
118       return ((MockLogger)logger).isFailBeforeSavingHeuristicStatus();
119    }
120
121    public void setFailBeforeSavingHeuristicStatus(
122                                     boolean failBeforeSavingHeuristicStatus)
123    {
124       ((MockLogger)logger).setFailBeforeSavingHeuristicStatus(
125                                              failBeforeSavingHeuristicStatus);
126    }
127
128    public boolean isFailAfterSavingHeuristicStatus()
129    {
130       return ((MockLogger)logger).isFailAfterSavingHeuristicStatus();
131    }
132
133    public void setFailAfterSavingHeuristicStatus(
134                                     boolean failAfterSavingHeuristicStatus)
135    {
136       ((MockLogger)logger).setFailAfterSavingHeuristicStatus(
137                                              failAfterSavingHeuristicStatus);
138    }
139
140    public boolean isFailBeforeClearingHeuristicStatus()
141    {
142       return ((MockLogger)logger).isFailBeforeClearingHeuristicStatus();
143    }
144
145    public void setFailBeforeClearingHeuristicStatus(
146                                     boolean failBeforeClearingHeuristicStatus)
147    {
148       ((MockLogger)logger).setFailBeforeClearingHeuristicStatus(
149                                              failBeforeClearingHeuristicStatus);
150    }
151
152    public boolean isFailAfterClearingHeuristicStatus()
153    {
154       return ((MockLogger)logger).isFailAfterClearingHeuristicStatus();
155    }
156
157    public void setFailAfterClearingHeuristicStatus(
158                                     boolean failAfterClearingHeuristicStatus)
159    {
160       ((MockLogger)logger).setFailAfterClearingHeuristicStatus(
161                                              failAfterClearingHeuristicStatus);
162    }
163
164    public void startService() throws Exception JavaDoc
165    {
166       super.startService();
167       TxManager.getInstance().setRecoveryLogger(logger);
168    }
169
170 }
171
Popular Tags