Package de.smartics.exceptions.sample.lib.resource

Contains the service classes that form the business logic in the example that uses smartics-exceptions.

See: Description

Package de.smartics.exceptions.sample.lib.resource Description

Package class diagram package de.smartics.exceptions.sample.lib.resource
Contains the service classes that form the business logic in the example that uses smartics-exceptions.

We see the ResourceService and three classes dealing with exception handling and logging:

  1. ResourceMessage - the information container for logging and exception event.
  2. ResourceNotFoundException - a contingency exception issued by the service.
  3. ResourceLoggingCode - the codes for logging events.

What we do not see in the Java source packages are the resource bundles:

  1. de.smartics.exceptions.sample.lib.exceptions.ServiceCodeBundle.properties - the bundle where the resource codes are part of.
  2. 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:

  1. LibContingencyException
  2. ServiceMessage
Since:
1.0