View Javadoc

1   package org.opensync.engine.server;
2   
3   import org.opensync.engine.util.I18n;
4   import java.util.*;
5   
6   /***
7    * This class represents a list of agendas. 
8    * It's just a helper class.
9    */
10  
11  public class Agendas extends Hashtable {
12  
13    /***
14     * Construct a Agendas object
15     * 
16     */
17    public Agendas() {
18    }
19    /***
20     * Add an agenda to the list
21     * 
22     * @param	agenda the agenda to add
23     */
24    public void add(Agenda agenda){
25      if(get(agenda.getName()) != null){
26        throw new IllegalArgumentException(
27          I18n.getInstance().format(
28            "error.config.agenda.already-bound",new Object[]{agenda.getName()}
29          )
30        );
31      }
32      put(agenda.getName(),agenda);
33    }
34    /***
35     * Use for debug only
36     * 
37     */
38    public String toString(){
39      StringBuffer buffer = new StringBuffer();
40      buffer.append("Agendas{\n");
41      Iterator iterator = values().iterator();
42      while(iterator.hasNext()){
43        buffer.append(iterator.next().toString());
44      }
45      buffer.append("}\n");
46      return buffer.toString();
47    }
48  }