001: package org.bouncycastle.i18n;
002:
003: import java.io.UnsupportedEncodingException;
004: import java.util.Locale;
005: import java.util.TimeZone;
006:
007: public class ErrorBundle extends MessageBundle {
008:
009: /**
010: * summary entry key
011: */
012: public static final String SUMMARY_ENTRY = "summary";
013:
014: /**
015: * detail entry key
016: */
017: public static final String DETAIL_ENTRY = "details";
018:
019: /**
020: * Constructs a new ErrorBundle using <code>resource</code> as the base name for the
021: * RessourceBundle and <code>id</code> as the message bundle id the resource file.
022: * @param resource base name of the resource file
023: * @param id the id of the corresponding bundle in the resource file
024: * @throws NullPointerException if <code>resource</code> or <code>id</code> is <code>null</code>
025: */
026: public ErrorBundle(String resource, String id)
027: throws NullPointerException {
028: super (resource, id);
029: }
030:
031: /**
032: * Constructs a new ErrorBundle using <code>resource</code> as the base name for the
033: * RessourceBundle and <code>id</code> as the message bundle id the resource file.
034: * @param resource base name of the resource file
035: * @param id the id of the corresponding bundle in the resource file
036: * @param encoding the encoding of the resource file
037: * @throws NullPointerException if <code>resource</code> or <code>id</code> is <code>null</code>
038: * @throws UnsupportedEncodingException if the encoding is not supported
039: */
040: public ErrorBundle(String resource, String id, String encoding)
041: throws NullPointerException, UnsupportedEncodingException {
042: super (resource, id, encoding);
043: }
044:
045: /**
046: * Constructs a new ErrorBundle using <code>resource</code> as the base name for the
047: * RessourceBundle and <code>id</code> as the message bundle id the resource file.
048: * @param resource base name of the resource file
049: * @param id the id of the corresponding bundle in the resource file
050: * @param arguments an array containing the arguments for the message
051: * @throws NullPointerException if <code>resource</code> or <code>id</code> is <code>null</code>
052: */
053: public ErrorBundle(String resource, String id, Object[] arguments)
054: throws NullPointerException {
055: super (resource, id, arguments);
056: }
057:
058: /**
059: * Constructs a new ErrorBundle using <code>resource</code> as the base name for the
060: * RessourceBundle and <code>id</code> as the message bundle id the resource file.
061: * @param resource base name of the resource file
062: * @param id the id of the corresponding bundle in the resource file
063: * @param encoding the encoding of the resource file
064: * @param arguments an array containing the arguments for the message
065: * @throws NullPointerException if <code>resource</code> or <code>id</code> is <code>null</code>
066: * @throws UnsupportedEncodingException if the encoding is not supported
067: */
068: public ErrorBundle(String resource, String id, String encoding,
069: Object[] arguments) throws NullPointerException,
070: UnsupportedEncodingException {
071: super (resource, id, encoding, arguments);
072: }
073:
074: /**
075: * Returns the summary message in the given locale and timezone.
076: * @param loc the {@link Locale}
077: * @param timezone the {@link TimeZone}
078: * @return the summary message.
079: * @throws MissingEntryException if the message is not available
080: */
081: public String getSummary(Locale loc, TimeZone timezone)
082: throws MissingEntryException {
083: return getEntry(SUMMARY_ENTRY, loc, timezone);
084: }
085:
086: /**
087: * Returns the summary message in the given locale and the default timezone.
088: * @param loc the {@link Locale}
089: * @return the summary message.
090: * @throws MissingEntryException if the message is not available
091: */
092: public String getSummary(Locale loc) throws MissingEntryException {
093: return getEntry(SUMMARY_ENTRY, loc, TimeZone.getDefault());
094: }
095:
096: /**
097: * Returns the detail message in the given locale and timezone.
098: * @param loc the {@link Locale}
099: * @param timezone the {@link TimeZone}
100: * @return the detail message.
101: * @throws MissingEntryException if the message is not available
102: */
103: public String getDetail(Locale loc, TimeZone timezone)
104: throws MissingEntryException {
105: return getEntry(DETAIL_ENTRY, loc, timezone);
106: }
107:
108: /**
109: * Returns the detail message in the given locale and the default timezone.
110: * @param loc the {@link Locale}
111: * @return the detail message.
112: * @throws MissingEntryException if the message is not available
113: */
114: public String getDetail(Locale loc) throws MissingEntryException {
115: return getEntry(DETAIL_ENTRY, loc, TimeZone.getDefault());
116: }
117:
118: }
|