1 | // jademx - JADE management using JMX |
2 | // Copyright 2005 Caboodle Networks, Inc. |
3 | // |
4 | // This library is free software; you can redistribute it and/or |
5 | // modify it under the terms of the GNU Lesser General Public |
6 | // License as published by the Free Software Foundation; either |
7 | // version 2.1 of the License, or (at your option) any later version. |
8 | // |
9 | // This library is distributed in the hope that it will be useful, |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | // Lesser General Public License for more details. |
13 | // |
14 | // You should have received a copy of the GNU Lesser General Public |
15 | // License along with this library; if not, write to the Free Software |
16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
17 | |
18 | package jade.jademx.config.jademx.onto; |
19 | |
20 | import jade.content.AgentAction; |
21 | import jade.util.leap.Iterator; |
22 | import jade.util.leap.LinkedList; |
23 | import jade.util.leap.List; |
24 | |
25 | /** |
26 | * top-level concept in jademx config ontology. |
27 | * should runtimes be limited to single one? |
28 | * @author David Bernstein, <a href="http://www.caboodlenetworks.com" |
29 | * >Caboodle Networks, Inc.</a> |
30 | */ |
31 | public class JademxConfig implements AgentAction, JademxConfigVocabulary { |
32 | |
33 | /** list of runtimes of type Runtime */ |
34 | private List runtimes = null; |
35 | |
36 | /** |
37 | * Create a new jademx config class |
38 | */ |
39 | public JademxConfig() { |
40 | } |
41 | |
42 | /** |
43 | * @return Returns the runtimes. |
44 | */ |
45 | public List getRuntimes() { |
46 | return runtimes; |
47 | } |
48 | |
49 | /** |
50 | * @param runtimes The runtimes to set. |
51 | */ |
52 | public void setRuntimes(List runtimes) { |
53 | this.runtimes = runtimes; |
54 | } |
55 | |
56 | /** |
57 | * add a runtime to this configuration |
58 | * @param runtime runtime to add |
59 | */ |
60 | public void addRuntime( ConfigRuntime runtime ) { |
61 | if ( null == runtimes ) { |
62 | runtimes = new LinkedList(); |
63 | } |
64 | runtimes.add( runtime ); |
65 | } |
66 | |
67 | /* (non-Javadoc) |
68 | * @see java.lang.Object#toString() |
69 | */ |
70 | public String toString() { |
71 | StringBuffer sb = new StringBuffer(); |
72 | sb.append( "JademxConfig[" ); |
73 | if ( null != runtimes ) { |
74 | Iterator runtimeI = runtimes.iterator(); |
75 | boolean first = true; |
76 | while ( runtimeI.hasNext() ) { |
77 | if ( first ) { |
78 | first = false; |
79 | } |
80 | else { |
81 | sb.append(","); |
82 | } |
83 | sb.append( runtimeI.next().toString() ); |
84 | } |
85 | } |
86 | sb.append("]"); |
87 | return sb.toString(); |
88 | } |
89 | |
90 | } |