01: /*
02: * $Id: AbstractAgent.java 10808 2008-02-14 20:36:57Z acooke $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
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: import org.mule.api.lifecycle.LifecycleTransitionResult;
17:
18: /**
19: * Implements common methods for all Agents. Importantly, the Management context is made available to Agents that
20: * extend this.
21: */
22: public abstract class AbstractAgent implements Agent, MuleContextAware {
23:
24: protected MuleContext muleContext;
25:
26: protected String name;
27:
28: protected AbstractAgent(String name) {
29: this .name = name;
30: }
31:
32: public final String getName() {
33: return name;
34: }
35:
36: public final void setName(String name) {
37: this .name = name;
38: }
39:
40: public String getDescription() {
41: return name;
42: }
43:
44: public void setMuleContext(MuleContext context) {
45: this .muleContext = context;
46: }
47:
48: public abstract LifecycleTransitionResult initialise()
49: throws InitialisationException;
50:
51: }
|