|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
JMSFactories.java | 75% | 100% | 100% | 94.1% |
|
1 | /** | |
2 | * JTRunner is free software; you can redistribute it and/or modify it under the | |
3 | * terms of the GNU General Public License as published by the Free Software | |
4 | * Foundation; either version 2, or (at your option) any later version. | |
5 | */ | |
6 | ||
7 | package jtr.config.jms; | |
8 | ||
9 | import java.io.Serializable; | |
10 | import java.util.Collection; | |
11 | import java.util.Vector; | |
12 | import java.util.Iterator; | |
13 | ||
14 | /** | |
15 | * This class is used for gathering a set of <code>JMSConnectionFactory</code> | |
16 | * instances. | |
17 | * | |
18 | * @author Francesco Russo (frusso@dev.java.net) | |
19 | * @version 4.0 | |
20 | * @since 1.1 | |
21 | * @see jtr.config.jms.JMSConnectionFactory | |
22 | */ | |
23 | public class JMSFactories implements Serializable { | |
24 | ||
25 | /** | |
26 | * Default constructor | |
27 | */ | |
28 | 1 | public JMSFactories() { |
29 | 1 | factories = new Vector<JMSConnectionFactory>(); |
30 | } | |
31 | ||
32 | /** | |
33 | * Add a new <code>JMSConnectionFactory</code> to the current | |
34 | * configuration. | |
35 | * | |
36 | * @param jmsCF | |
37 | * The new <code>JMSConnectionFactory</code> | |
38 | */ | |
39 | 1 | public void addConnectionFactory(JMSConnectionFactory jmsCF) { |
40 | 1 | factories.add(jmsCF); |
41 | } | |
42 | ||
43 | /** | |
44 | * Get all the configured <code>JMSConnectionFactory</code> instances. | |
45 | * | |
46 | * @return Collection A <code>Collection</code> of | |
47 | * <code>JMSConnectionFactory</code> | |
48 | */ | |
49 | 14 | public Collection<JMSConnectionFactory> getConnectionFactories() { |
50 | 14 | return factories; |
51 | } | |
52 | ||
53 | /** | |
54 | * @see java.lang.Object#toString() | |
55 | */ | |
56 | 14 | public String toString() { |
57 | 14 | String res = "JMS Connection Factories:\n"; |
58 | 14 | if (factories != null) { |
59 | 14 | Iterator iter = factories.iterator(); |
60 | 14 | while (iter.hasNext()) { |
61 | 14 | res = res + iter.next().toString() + "\n"; |
62 | } | |
63 | } | |
64 | 14 | return res; |
65 | } | |
66 | ||
67 | private Collection<JMSConnectionFactory> factories; | |
68 | } |
|