001: // The contents of this file are subject to the Mozilla Public License Version
002: // 1.1
003: //(the "License"); you may not use this file except in compliance with the
004: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005: //
006: //Software distributed under the License is distributed on an "AS IS" basis,
007: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008: //for the specific language governing rights and
009: //limitations under the License.
010: //
011: //The Original Code is "The Columba Project"
012: //
013: //The Initial Developers of the Original Code are Frederik Dietz and Timo
014: // Stich.
015: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016: //
017: //All Rights Reserved.
018: package org.columba.api.plugin;
019:
020: import java.util.Hashtable;
021: import java.util.Map;
022:
023: public class ExtensionMetadata {
024:
025: private String id;
026: private String classname;
027: private boolean enabled = true;
028: private boolean singleton = false;
029:
030: private Map<String, String> attributes;
031:
032: public ExtensionMetadata(String id, String classname,
033: Map<String, String> attributes) {
034: this (id, classname);
035:
036: if (attributes == null)
037: throw new IllegalArgumentException("attributes == null");
038:
039: this .attributes = attributes;
040:
041: }
042:
043: public ExtensionMetadata(String id, String classname) {
044: if (id == null)
045: throw new IllegalArgumentException("id == null");
046: if (classname == null)
047: throw new IllegalArgumentException("classname == null");
048:
049: this .id = id;
050: this .classname = classname;
051:
052: attributes = new Hashtable<String, String>();
053: }
054:
055: /**
056: * @return Returns the classname.
057: */
058: public String getClassname() {
059: return classname;
060: }
061:
062: /**
063: * @return Returns the id.
064: */
065: public String getId() {
066: return id;
067: }
068:
069: /**
070: * @return Returns the enabled.
071: */
072: public boolean isEnabled() {
073: return enabled;
074: }
075:
076: /**
077: * @param enabled The enabled to set.
078: */
079: public void setEnabled(boolean enabled) {
080: this .enabled = enabled;
081: }
082:
083: /**
084: * @return Returns the singleton.
085: */
086: public boolean isSingleton() {
087: return singleton;
088: }
089:
090: /**
091: * @param global The singleton to set.
092: */
093: public void setSingleton(boolean singleton) {
094: this .singleton = singleton;
095: }
096:
097: public String getAttribute(String key) {
098: if (key == null)
099: throw new IllegalArgumentException("key == null");
100:
101: return (String) attributes.get(key);
102: }
103:
104: }
|