KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > exchange > simple > PacketHeaderImpl


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.exchange.simple;
14
15 import info.magnolia.exchange.PacketHeader;
16
17 import java.util.Hashtable JavaDoc;
18 import java.util.Map JavaDoc;
19 import java.util.Set JavaDoc;
20
21
22 /**
23  * Date: May 4, 2004 Time: 5:10:56 PM
24  * @author Sameer Charles
25  */

26 public class PacketHeaderImpl implements PacketHeader {
27
28     private Map JavaDoc header;
29
30     public PacketHeaderImpl() {
31         this.header = new Hashtable JavaDoc();
32     }
33
34     public void addHeader(String JavaDoc name, String JavaDoc value) throws IllegalArgumentException JavaDoc {
35         if (value == null) {
36             throw (new IllegalArgumentException JavaDoc("Null value not allowed")); //$NON-NLS-1$
37
}
38         this.header.put(name, value);
39     }
40
41     public String JavaDoc getValueByName(String JavaDoc name) {
42         return (String JavaDoc) this.header.get(name);
43     }
44
45     public Set JavaDoc getKeys() {
46         return this.header.keySet();
47     }
48 }
49
Popular Tags