From 7916c117627db0411b35f202f88b2ab6e115361a Mon Sep 17 00:00:00 2001
From: "(no author)" <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d>
Date: Fri, 28 Jan 2005 14:10:50 +0000
Subject: This commit was manufactured by cvs2svn to create tag
'MOA-ID-1_20d09'.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/tags/MOA-ID-1_20d09@264 d688527b-c9ab-4aba-bd8d-4036d912da1d
---
.../src/at/gv/egovernment/moa/util/Messages.java | 117 ---------------------
1 file changed, 117 deletions(-)
delete mode 100644 common/src/at/gv/egovernment/moa/util/Messages.java
(limited to 'common/src/at/gv/egovernment/moa/util/Messages.java')
diff --git a/common/src/at/gv/egovernment/moa/util/Messages.java b/common/src/at/gv/egovernment/moa/util/Messages.java
deleted file mode 100644
index a0139ae93..000000000
--- a/common/src/at/gv/egovernment/moa/util/Messages.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package at.gv.egovernment.moa.util;
-
-import java.text.MessageFormat;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.PropertyResourceBundle;
-
-import at.gv.egovernment.moa.logging.Logger;
-
-/**
- * Provides access to the system messages resource used for exception handling
- * and logging messages.
- *
- * Messages must be provided as a resource bundle at the path.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class Messages {
- /** Error message indicating that no messages are avaiable. */
- private static final String ERROR_MESSAGES_UNAVAILABLE =
- "Fehler in der Server-Konfiguration. "
- + "Die Fehlertexte konnten nicht geladen werden.";
- /** Error message indicating that the message is not available. */
- private static final String ERROR_NO_MESSAGE =
- "Keine Fehlermeldung für Fehler-Nr.={0}";
-
- /** The names of the resources containing the messages. */
- private String[] resourceNames;
- /** The corresponding Locale
s of the resources. */
- private Locale[] locales;
- /** The ResourceBundle
s containing the messages. */
- private ResourceBundleChain messages;
-
- /**
- * Create a new Message
object containing the messages
- * in the given resources.
- *
- * @param resourceNames The names of the resources containing the messages.
- * @param locales The corresponding locales.
- */
- public Messages(String[] resourceNames, Locale[] locales) {
- this.resourceNames = resourceNames;
- this.locales = locales;
- this.messages = null;
- }
-
- /**
- * Get the message corresponding to a given message ID.
- *
- * @param messageId The ID of the message.
- * @param parameters The parameters to fill in into the message arguments.
- * @return The formatted message.
- */
- public String getMessage(String messageId, Object[] parameters) {
- // initialize messages
- if (messages == null) {
- initMessages();
- }
-
- // create the message
- if (messages == null) {
- return ERROR_MESSAGES_UNAVAILABLE;
- } else {
- try {
- String rawMessage = messages.getString(messageId);
- return MessageFormat.format(rawMessage, parameters);
- } catch (MissingResourceException e2) {
- // couldn't find any message -> set to default error message
- return MessageFormat.format(
- ERROR_NO_MESSAGE,
- new Object[] { messageId });
- }
- }
- }
-
- /**
- * Return the names of the resources containing the messages.
- *
- * @return String[] The names of the resource bundles containing the messages.
- */
- private String[] getResourceNames() {
- return resourceNames;
- }
-
- /**
- * Return the Locale
s of the resources containing the messages.
- *
- * @return Locale[] The Locale
s of the resource bundles
- * containing the messages.
- */
- private Locale[] getLocales() {
- return locales;
- }
-
- /**
- * Initialize the messages
ResourceBundle
containing
- * the MOA error messages.
- */
- private void initMessages() {
- messages = new ResourceBundleChain();
- int i;
-
- // initialize the message resources
- for (i = 0; i < resourceNames.length; i++) {
- try {
- messages.addResourceBundle(
- PropertyResourceBundle.getBundle(
- getResourceNames()[i],
- getLocales()[i]));
- } catch (MissingResourceException e) {
- Logger.error(ERROR_MESSAGES_UNAVAILABLE, e);
- }
- }
- }
-
-}
--
cgit v1.2.3