001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: ResourceBundleAsMap.java,v 1.2 2006/09/29 12:32:08 drmlipp Exp $
021: *
022: * $Log: ResourceBundleAsMap.java,v $
023: * Revision 1.2 2006/09/29 12:32:08 drmlipp
024: * Consistently using WfMOpen as projct name now.
025: *
026: * Revision 1.1.1.1 2003/06/30 20:05:12 drmlipp
027: * Initial import
028: *
029: * Revision 1.14 2003/06/27 08:51:47 lipp
030: * Fixed copyright/license information.
031: *
032: * Revision 1.13 2003/04/25 14:50:59 lipp
033: * Fixed javadoc errors and warnings.
034: *
035: * Revision 1.12 2002/07/24 05:48:16 huaiyang
036: * javadocs added.
037: *
038: * Revision 1.11 2002/01/29 16:12:07 feldgen
039: * Bugfix
040: *
041: * Revision 1.10 2002/01/29 15:13:22 feldgen
042: * Added overriding-methods for write-operations
043: *
044: * Revision 1.9 2001/12/04 16:32:51 feldgen
045: * changed implementation to HashMap
046: *
047: * Revision 1.8 2001/12/04 15:54:04 feldgen
048: * doccheck the second
049: *
050: * Revision 1.7 2001/12/04 15:36:47 lipp
051: * Removed unnecessary toString implementations.
052: *
053: * Revision 1.6 2001/12/04 10:12:02 feldgen
054: * doccheck the second
055: *
056: * Revision 1.5 2001/12/04 10:02:22 feldgen
057: * doccheck
058: *
059: * Revision 1.4 2001/11/26 17:36:35 feldgen
060: * Code-fixing
061: *
062: * Revision 1.3 2001/11/26 08:34:27 feldgen
063: * Codestyle fixing
064: *
065: * Revision 1.2 2001/11/25 14:12:19 lipp
066: * Headers fixed.
067: *
068: */
069:
070: package de.danet.an.util;
071:
072: import java.util.HashMap;
073: import java.util.Map;
074: import java.util.Enumeration;
075: import java.util.MissingResourceException;
076: import java.util.ResourceBundle;
077:
078: /**
079: * This Class represents the ResourceBundle as a Map.
080: * It copies the ResourceBundle entries to itself for further handling.
081: */
082:
083: public class ResourceBundleAsMap extends HashMap {
084: /**
085: * Default constructor.
086: * @param bundle Resource bundle for handling requests
087: * @throws MissingResourceException if bundle is not found
088: */
089: public ResourceBundleAsMap(ResourceBundle bundle)
090: throws MissingResourceException {
091: for (Enumeration e = bundle.getKeys(); e.hasMoreElements();) {
092: Object key = e.nextElement();
093: super .put(key, bundle.getObject((String) key));
094: }
095: }
096:
097: /**
098: * Overriding because writing on the ResourceBundle is not supported.
099: */
100: public void clear() {
101: throw new UnsupportedOperationException();
102: }
103:
104: /**
105: * Overriding because writing is not supported.
106: * @param key an <code>Object</code> value
107: * @param value an <code>Object</code> value
108: * @return an <code>Object</code> value
109: */
110: public Object put(Object key, Object value) {
111: throw new UnsupportedOperationException();
112: }
113:
114: /**
115: * Overriding because writing is not supported.
116: * @param t a <code>Map</code> value
117: */
118: public void putAll(Map t) {
119: throw new UnsupportedOperationException();
120: }
121:
122: /**
123: * Overriding because writing is not supported.
124: * @param key an <code>Object</code> value
125: * @return an <code>Object</code> value
126: */
127: public Object remove(Object key) {
128: throw new UnsupportedOperationException();
129: }
130: }
|