View Javadoc

1   /*
2    * $Id: AbstractAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  package org.mule;
11  
12  import org.mule.api.MuleContext;
13  import org.mule.api.agent.Agent;
14  import org.mule.api.context.MuleContextAware;
15  import org.mule.api.lifecycle.InitialisationException;
16  
17  import java.util.Collections;
18  import java.util.List;
19  
20  /**
21   * Implements common methods for all Agents. Importantly, the Management context is made available to Agents that
22   * extend this.
23   */
24  public abstract class AbstractAgent implements Agent, MuleContextAware
25  {
26  
27      protected MuleContext muleContext;
28  
29      protected String name;
30  
31      protected AbstractAgent(String name)
32      {
33          this.name = name;
34      }
35  
36      public final String getName()
37      {
38          return name;
39      }
40  
41      public final void setName(String name)
42      {
43          this.name = name;
44      }
45  
46      public String getDescription()
47      {
48          return name;
49      }
50  
51      public List getDependentAgents()
52      {
53          return Collections.EMPTY_LIST;
54      }
55  
56      public void setMuleContext(MuleContext context)
57      {
58          this.muleContext = context;
59      }
60  
61      public abstract void initialise() throws InitialisationException;
62  
63  }