1 | // Copyright 2004-2007 Jean-Francois Poilpret |
2 | // |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | // you may not use this file except in compliance with the License. |
5 | // You may obtain a copy of the License at |
6 | // |
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | // |
9 | // Unless required by applicable law or agreed to in writing, software |
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | // See the License for the specific language governing permissions and |
13 | // limitations under the License. |
14 | |
15 | package net.sourceforge.hivetranse.transaction; |
16 | |
17 | import java.util.ArrayList; |
18 | import java.util.List; |
19 | |
20 | import org.apache.hivemind.impl.BaseLocatable; |
21 | import org.apache.hivemind.util.ToStringBuilder; |
22 | |
23 | /** |
24 | * @author Jean-Francois Poilpret |
25 | */ |
26 | public class TransactionSettingsContribution extends BaseLocatable |
27 | { |
28 | public void addTransactionContribution(TransactionContribution contribution) |
29 | { |
30 | _transactionContributions.add(contribution); |
31 | } |
32 | |
33 | public TransactionContribution[] getTransactionContributions() |
34 | { |
35 | return _transactionContributions.toArray( |
36 | new TransactionContribution[_transactionContributions.size()]); |
37 | } |
38 | |
39 | public void addRollbackExceptionContribution(RollbackExceptionContribution contribution) |
40 | { |
41 | _rollbackExceptionContributions.add(contribution); |
42 | } |
43 | |
44 | public RollbackExceptionContribution[] getRollbackExceptionContributions() |
45 | { |
46 | return _rollbackExceptionContributions.toArray( |
47 | new RollbackExceptionContribution[_rollbackExceptionContributions.size()]); |
48 | } |
49 | |
50 | public String toString() |
51 | { |
52 | ToStringBuilder builder = new ToStringBuilder(this); |
53 | builder.append("rollbackExceptionContributions", _rollbackExceptionContributions); |
54 | builder.append("transactionContributions", _transactionContributions); |
55 | return builder.toString(); |
56 | } |
57 | |
58 | private List<RollbackExceptionContribution> _rollbackExceptionContributions = |
59 | new ArrayList<RollbackExceptionContribution>(); |
60 | private List<TransactionContribution> _transactionContributions = |
61 | new ArrayList<TransactionContribution>(); |
62 | } |