aboutsummaryrefslogtreecommitdiff
path: root/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java
diff options
context:
space:
mode:
authormcentner <mcentner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-08 07:25:32 +0000
committermcentner <mcentner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-08 07:25:32 +0000
commit43e57a42832ea8b4ceb0317f3c9028a4174ffa7b (patch)
treef5ed9074b8d7b89b2dd5b22d326f63be103e7551 /common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java
parent10889e9dea2cc2f70b475e6ff7af37fdba1621d9 (diff)
downloadmoa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.tar.gz
moa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.tar.bz2
moa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.zip
Adapted project directory structure to suit the new maven based build process.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@909 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java')
-rw-r--r--common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java66
1 files changed, 0 insertions, 66 deletions
diff --git a/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java b/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java
deleted file mode 100644
index 90b28548a..000000000
--- a/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package at.gv.egovernment.moa.util;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * A class to chain <code>ResourceBundle</code>s.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class ResourceBundleChain {
- /** Error message indicating the resource is not available. */
- private static final String ERROR_MISSING_RESOURCE = "Missing resource";
- /** The <code>ResourceBundle</code>s contained in this chain. */
- private List resourceBundles = new ArrayList();
-
- /**
- * Add a <code>ResourceBundle</code> to the chain.
- *
- * @param resourceBundle The <code>ResourceBundle</code> to add.
- */
- public void addResourceBundle(ResourceBundle resourceBundle) {
- resourceBundles.add(resourceBundle);
- }
-
- /**
- * Return the value of the resource.
- *
- * @param key The key to access the <code>String</code> resource.
- * @return The resource value. All the registered <code>ResourceBundle</code>s
- * are searched in the order in which they have previously been added to this
- * <code>ResourceBundleChain</code>.
- * @throws MissingResourceException The resource coult not be found in any of
- * the bundles.
- */
- public String getString(String key) throws MissingResourceException {
- MissingResourceException lastException = null;
- Iterator iter;
-
- // handle case where no resource bundles have been added
- if (resourceBundles.size() == 0) {
- throw new MissingResourceException(
- ERROR_MISSING_RESOURCE,
- this.getClass().getName(),
- key);
- }
-
- // try to find the resource in one of the bundles; if it cannot be found,
- // return the exception thrown by the last bundle in the list
- for (iter = resourceBundles.iterator(); iter.hasNext();) {
- ResourceBundle resourceBundle = (ResourceBundle) iter.next();
- try {
- String value = resourceBundle.getString(key);
- return value;
- } catch (MissingResourceException e) {
- lastException = e;
- }
- }
- throw lastException;
- }
-
-}