net.sf.blunder
Class RelationResolver

java.lang.Object
  extended by net.sf.blunder.RelationResolver

public class RelationResolver
extends Object

This is where magic happens, this class is responsible for dealing with errors.
This class is for internal use of Blunder.

Author:
Ambrosi Lucas

Constructor Summary
RelationResolver()
           
 
Method Summary
 BlunderPersistenceService getBlunderPersistenceService()
           
 ExceptionRelation lookupRelation(Blunder blunder)
          Seeks the object representing the relationship for the chained exception.
 void setBlunderPersistenceService(BlunderPersistenceService blunderPersistenceService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationResolver

public RelationResolver()
Method Detail

lookupRelation

public ExceptionRelation lookupRelation(Blunder blunder)
Seeks the object representing the relationship for the chained exception. The search in the knowledge base is done through the following algorithm. At each step, if it doesn't find any results that match the current context error, continue with the next step.
  1. Tries to find a context with the three main elements, Leaf, Root and Business.
  2. If no match is found or doesn't meet the conditions, then try to find a context with the components, Leaf and Root.
  3. Then, it tries to find a context with the components Leaf and Business.
  4. Then tries to find a context with the compoent Leaf.
  5. Then tries to find a context with the compoent Root.
  6. And finally if none of those steps could solve the context, then it resolves with the default context. It is the one with the ID 0 (zero).

Always is verified the expression in CONDITIONS and the availability of the context in runtime (MATCH_AT_RUNTIME='true').

The main idea behind this series of steps is the generalization. Start with a search as specific as possible and go generalizing step by step. For example it is not necessary that all fields match the current situation; so we could take as rule that every chained exception that was originally generated by a SocketException is a comunication problem, therefore we would like to address as a server error and suggest to the user to retry again in a few minutes. For this, we should specify a context with only this exception as root and all others learned contexts with SocketException as Root should be marked as MATCH_AT_RUNTIME='false'.

Returns:
The ExceptionRelation that matches the current chained exception.
See Also:
ExceptionRelation

getBlunderPersistenceService

public BlunderPersistenceService getBlunderPersistenceService()

setBlunderPersistenceService

public void setBlunderPersistenceService(BlunderPersistenceService blunderPersistenceService)


Copyright © 2009 Blunder. All Rights Reserved.