I also followed up a post on this to suggest that instead of package names, what about organising them by module name instead. Would this be better?
Perhaps that to structure the messages via module is better.
Can you explain what you mean a bit more by these points, and provide examples of what you're thinking? It's obviously late in the day (and I'm not allowed coffee at the moment) so I can't understand what you mean ...
Quick overview of what I try to suggest:
1. A set of resource bundles defining the messages of specific services, e.g. JavaMailMessages.properties; JCAMessages.properties; et cetera.
2. A set of type-safe enumerations, one for each resource bundle, which maps the keys of its related resource bundle to an element of the type-safe enumeration.
e.g.
JavaMailMessage.properties defines the following messages:
00001=Authentication failed ${0} ${1}.
00002=Authentication failed#2.One defines the following class:
public final class JavaMailMessage {
private JavaMailMessage(int anErrorCode) {}
public JavaMailMessage FAILED = new JavaMailMessage(00001);
public JavaMailMessage FAILED_2 = new JavaMailMessage(00002);
}3. A i18n exception specific to JavaMail.
public I18NJavaMaiExceptionl extends I18NException {
public I18NJavaMailException(JavaMailMessage anException, Object[] aListOfParameters) {};
}
4. An exception formatter specific to JavaMail.
public I18NJavaMailExceptionFormatter extends I18NExceptionFormatter {
private I18NJavaMailExceptionFormatter SINGLETON = new I18NJavaMailExceptionFormatter();
public I18NJavaMailExceptionFormatter getInstance() {};
public String format(I18NJavaMaiException) {};
}
5. In the code, one uses this:
throw new I18NJavaMailException(JavaMailMessage.FAILED, new Object[] {"value1", "value2"});
6. A last resort handling mechanism:
public String handle(I18NException anException) {
return I18NException.format(anException);
}Cheers, Gianny
_________________________________________________________________
MSN Messenger 6 http://g.msn.fr/FR1001/866 : dialoguez en son et en image avec vos amis.
