Coverage Report - org.mule.AbstractAgent
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractAgent
0%
0/13
N/A
1.167
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule;
 8  
 
 9  
 import org.mule.api.MuleContext;
 10  
 import org.mule.api.MuleException;
 11  
 import org.mule.api.agent.Agent;
 12  
 import org.mule.api.context.MuleContextAware;
 13  
 
 14  
 /**
 15  
  * Implements common methods for all Agents. Importantly, the MuleContext is made available to Agents that
 16  
  * extend this.
 17  
  */
 18  
 public abstract class AbstractAgent implements Agent, MuleContextAware
 19  
 {
 20  
 
 21  
     protected MuleContext muleContext;
 22  
 
 23  
     protected String name;
 24  
 
 25  
     protected AbstractAgent(String name)
 26  0
     {
 27  0
         this.name = name;
 28  0
     }
 29  
 
 30  
     public final String getName()
 31  
     {
 32  0
         return name;
 33  
     }
 34  
 
 35  
     public final void setName(String name)
 36  
     {
 37  0
         this.name = name;
 38  0
     }
 39  
 
 40  
     public String getDescription()
 41  
     {
 42  0
         return name;
 43  
     }
 44  
 
 45  
     public void setMuleContext(MuleContext context)
 46  
     {
 47  0
         this.muleContext = context;
 48  0
     }
 49  
 
 50  
     /**
 51  
      * Quietly unregister ourselves.
 52  
      */
 53  
     protected void unregisterMeQuietly()
 54  
     {
 55  
         try
 56  
         {
 57  
             // remove the agent from the list, it's not functional
 58  0
             muleContext.getRegistry().unregisterAgent(this.getName());
 59  
         }
 60  0
         catch (MuleException e)
 61  
         {
 62  
             // not interested, really
 63  0
         }
 64  0
     }
 65  
 }