1package org.bouncycastle.i18n;
2
3import java.util.Locale;
4import java.util.TimeZone;
5
6public class ErrorBundle extends MessageBundle
7{
8
9    /**
10     * summary entry key
11     */
12    public static final String SUMMARY_ENTRY = "summary";
13
14    /**
15     * detail entry key
16     */
17    public static final String DETAIL_ENTRY = "details";
18
19    /**
20     * Constructs a new ErrorBundle using <code>resource</code> as the base name for the
21     * RessourceBundle and <code>id</code> as the message bundle id the resource file.
22     * @param resource base name of the resource file
23     * @param id the id of the corresponding bundle in the resource file
24     * @throws NullPointerException if <code>resource</code> or <code>id</code> is <code>null</code>
25     */
26    public ErrorBundle(String resource, String id) throws NullPointerException
27    {
28        super(resource, id);
29    }
30
31    /**
32     * Constructs a new ErrorBundle using <code>resource</code> as the base name for the
33     * RessourceBundle and <code>id</code> as the message bundle id the resource file.
34     * @param resource base name of the resource file
35     * @param id the id of the corresponding bundle in the resource file
36     * @param arguments an array containing the arguments for the message
37     * @throws NullPointerException if <code>resource</code> or <code>id</code> is <code>null</code>
38     */
39    public ErrorBundle(String resource, String id, Object[] arguments) throws NullPointerException
40    {
41        super(resource, id, arguments);
42    }
43
44    /**
45     * Returns the summary message in the given locale and timezone.
46     * @param loc the {@link Locale}
47     * @param timezone the {@link TimeZone}
48     * @return the summary message.
49     * @throws MissingEntryException if the message is not available
50     */
51    public String getSummary(Locale loc, TimeZone timezone) throws MissingEntryException
52    {
53        return getEntry(SUMMARY_ENTRY,loc,timezone);
54    }
55
56    /**
57     * Returns the summary message in the given locale and the default timezone.
58     * @param loc the {@link Locale}
59     * @return the summary message.
60     * @throws MissingEntryException if the message is not available
61     */
62    public String getSummary(Locale loc) throws MissingEntryException
63    {
64        return getEntry(SUMMARY_ENTRY,loc,TimeZone.getDefault());
65    }
66
67    /**
68     * Returns the detail message in the given locale and timezone.
69     * @param loc the {@link Locale}
70     * @param timezone the {@link TimeZone}
71     * @return the detail message.
72     * @throws MissingEntryException if the message is not available
73     */
74    public String getDetail(Locale loc, TimeZone timezone) throws MissingEntryException
75    {
76        return getEntry(DETAIL_ENTRY,loc,timezone);
77    }
78
79    /**
80     * Returns the detail message in the given locale and the default timezone.
81     * @param loc the {@link Locale}
82     * @return the detail message.
83     * @throws MissingEntryException if the message is not available
84     */
85    public String getDetail(Locale loc) throws MissingEntryException
86    {
87        return getEntry(DETAIL_ENTRY,loc,TimeZone.getDefault());
88    }
89
90}
91