See: Description
Class | Description |
---|---|
ResourceMessage |
Information for a resource that has not been found.
|
ResourceMessage.Factory |
Factory to create log messages for a given service.
|
ResourceService |
The service to be used by applications.
|
Enum | Description |
---|---|
ResourceLoggingCode |
Defines test codes for messages with place holders.
|
Exception | Description |
---|---|
ResourceNotFoundException |
Signals that a resource cannot be found.
|
We see the ResourceService
and three classes dealing with exception handling and logging:
ResourceMessage
- the information container for logging and exception event.ResourceNotFoundException
- a contingency exception issued by the service.ResourceLoggingCode
- the codes for logging events.What we do not see in the Java source packages are the resource bundles:
de.smartics.exceptions.sample.lib.exceptions.ServiceCodeBundle.properties
- the bundle where the resource codes are part of.de.smartics.exceptions.sample.lib.resource.ResourceLoggingCodeBundle.properties
- message templates for logging. The contents of ServiceCodeBundle.properties
maps the exception codes to message templates. The index numbers refer to the message parameter annotations found in the resource message.
0001000.title=Service Unavailable 0001000=The service ''{1}'' is unavailable. 0001000.details=The reported cause for this unavailability is: {0} 0001000.implications=The requested service request has not been served. 0001000.todo=Check the reported cause and analyze the log file. 0001001.title=Resource not found 0001001=The service ''{1}'' was not able to retrieve the requested resource ''{2}''. 0001001.details=There is no detailed information available. 0001001.implications=The client requested a resource that is not known to the \ system. The client has to deal with this problem according to its business \ rules. 0001001.todo=There is nothing to be done on the server side. This is no fault.
The contents of ResourceLoggingCodeBundle.properties
shows that for logging we only use title and summary templates (summary keys only have the code while titles have the suffix .title
attached):
0090000.title=Service {1} 0090000=Preparing to store resource {2}: {3} 0090001.title=Service {1} 0090001=Store resource {2}={3} successfully. 0090002.title=Service {1} 0090002=Preparing to access resource {2}. 0090003.title=Service {1} 0090003=Accessed resource {2} successfully, retrieving: {3}.
The service does not provide its own set of exception codes, but uses codes defined in ServiceCode
.
It further derives its classes from the following base classes to reuse code: