KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > api > plugin > ExtensionMetadata


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.api.plugin;
19
20 import java.util.Hashtable JavaDoc;
21 import java.util.Map JavaDoc;
22
23 public class ExtensionMetadata {
24
25     private String JavaDoc id;
26     private String JavaDoc classname;
27     private boolean enabled=true;
28     private boolean singleton=false;
29     
30     private Map JavaDoc<String JavaDoc, String JavaDoc> attributes;
31     
32     public ExtensionMetadata(String JavaDoc id, String JavaDoc classname, Map JavaDoc<String JavaDoc, String JavaDoc> attributes) {
33         this(id, classname);
34         
35         if ( attributes == null ) throw new IllegalArgumentException JavaDoc("attributes == null");
36         
37         this.attributes = attributes;
38         
39     }
40     
41     public ExtensionMetadata(String JavaDoc id, String JavaDoc classname) {
42         if ( id == null ) throw new IllegalArgumentException JavaDoc("id == null");
43         if ( classname == null) throw new IllegalArgumentException JavaDoc("classname == null");
44         
45         this.id = id;
46         this.classname = classname;
47
48         
49  
50         attributes = new Hashtable JavaDoc<String JavaDoc, String JavaDoc>();
51     }
52
53     /**
54      * @return Returns the classname.
55      */

56     public String JavaDoc getClassname() {
57         return classname;
58     }
59
60     /**
61      * @return Returns the id.
62      */

63     public String JavaDoc getId() {
64         return id;
65     }
66
67     /**
68      * @return Returns the enabled.
69      */

70     public boolean isEnabled() {
71         return enabled;
72     }
73
74     /**
75      * @param enabled The enabled to set.
76      */

77     public void setEnabled(boolean enabled) {
78         this.enabled = enabled;
79     }
80
81     /**
82      * @return Returns the singleton.
83      */

84     public boolean isSingleton() {
85         return singleton;
86     }
87
88     /**
89      * @param global The singleton to set.
90      */

91     public void setSingleton(boolean singleton) {
92         this.singleton = singleton;
93     }
94     
95     public String JavaDoc getAttribute(String JavaDoc key) {
96         if ( key == null ) throw new IllegalArgumentException JavaDoc("key == null");
97         
98         return (String JavaDoc) attributes.get(key);
99     }
100     
101 }
102
Popular Tags