Coverage Report - pt.digitalis.dif.utils.logging.DIFCoreTracingAspect
 
Classes in this File Line Coverage Branch Coverage Complexity
DIFCoreTracingAspect
0%
0/33
0%
0/14
0
 
 1  0
 /**
 2  
  * - Digitalis Internal Framework v2.0 - (C) 2007, Digitalis Informatica.
 3  
  * Distribuicao e Gestao de Informatica, Lda. Estrada de Paco de Arcos num.9 -
 4  
  * Piso -1 2780-666 Paco de Arcos Telefone: (351) 21 4408990 Fax: (351) 21
 5  
  * 4408999 http://www.digitalis.pt
 6  
  */
 7  
 package pt.digitalis.dif.utils.logging;
 8  
 
 9  
 import org.aspectj.lang.JoinPoint;
 10  
 import org.aspectj.lang.Signature;
 11  
 
 12  
 import pt.digitalis.log.LogLevel;
 13  
 
 14  
 /**
 15  
  * This aspect performs the tracing duties on the framework's core. Since tracing is cross cutting concern it can be
 16  
  * implemented with AOP and thus the tracing mechanism can be made independent of the core logic.
 17  
  * 
 18  
  * @author Rodrigo Gonçalves <a href="mailto:rgoncalves@digitalis.pt">rgoncalves@digitalis.pt</a>
 19  
  * @created 2007/05/17
 20  
  */
 21  
 
 22  0
 public aspect DIFCoreTracingAspect extends DIFLogAspect {
 23  
 
 24  
     /* --- Advices --- */
 25  
 
 26  
     /** Traces successful object construction. */
 27  
     after() : allConstructors()  
 28  
     {
 29  0
         if (super.getLogger().isTraceEnabled()) {
 30  
 
 31  0
             JoinPoint.StaticPart joinPointStaticPart = thisJoinPointStaticPart;
 32  
             
 33  
             // If it's not a join point on generated source code get it's signature
 34  0
             if (joinPointStaticPart != null) {
 35  0
                 super.getLogger().increaseIndentation();
 36  
 
 37  0
                 Signature signature = joinPointStaticPart.getSignature();
 38  0
                 super.getLogger().log(
 39  0
                         LogLevel.TRACE,
 40  0
                         super.getLogger().getIndentationString() + "Constructed: "
 41  0
                                 + signature.getDeclaringType().getName());
 42  
 
 43  0
                 super.getLogger().decreaseIndentation();
 44  
             }
 45  
         }
 46  0
     }
 47  
 
 48  
     /** Traces all methods entering. */
 49  
     before() : allMethods() 
 50  
     {
 51  0
         if (super.getLogger().isTraceEnabled()) {
 52  0
             super.getLogger().increaseIndentation();
 53  
 
 54  0
             JoinPoint.StaticPart joinPointStaticPart = thisJoinPointStaticPart;
 55  
             
 56  
             // If it's not a join point on generated source code get it's signature
 57  0
             if (joinPointStaticPart != null) {
 58  0
                 Signature signature = joinPointStaticPart.getSignature();
 59  0
                 super.getLogger().log(
 60  0
                         LogLevel.TRACE,
 61  0
                         super.getLogger().getIndentationString() + "Entering: "
 62  0
                                 + signature.getDeclaringType().getName() + "." + signature.getName());
 63  
             }
 64  
         }
 65  
 
 66  0
     }
 67  
 
 68  
     /** Traces all methods exiting. */
 69  
     after() : allMethods()   
 70  
     {
 71  0
         if (super.getLogger().isTraceEnabled()) {
 72  
 
 73  0
             JoinPoint.StaticPart joinPointStaticPart = thisJoinPointStaticPart;
 74  
             
 75  
             // If it's not a join point on generated source code get it's signature
 76  0
             if (joinPointStaticPart != null) {
 77  0
                 Signature signature = joinPointStaticPart.getSignature();
 78  0
                 super.getLogger().log(
 79  0
                         LogLevel.TRACE,
 80  0
                         super.getLogger().getIndentationString() + "Exiting: " + signature.getDeclaringType().getName()
 81  0
                                 + "." + signature.getName());
 82  
             }
 83  
 
 84  0
             super.getLogger().decreaseIndentation();
 85  
         }
 86  
 
 87  0
     }
 88  
 }