01: /*
02: * $Id: AbstractRouter.java 11343 2008-03-13 10:58:26Z tcarlson $
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.routing;
11:
12: import org.mule.api.MuleContext;
13: import org.mule.api.context.MuleContextAware;
14: import org.mule.api.lifecycle.InitialisationException;
15: import org.mule.api.lifecycle.LifecycleTransitionResult;
16: import org.mule.api.routing.Router;
17: import org.mule.management.stats.RouterStatistics;
18:
19: /**
20: * Implements the shared methods that all routers have. The implementations of the different
21: * router types can vary depending on their usage pattern. The types of router are inbound, outbound
22: * response and nested.
23: */
24: public abstract class AbstractRouter implements Router,
25: MuleContextAware {
26:
27: private RouterStatistics routerStatistics;
28:
29: protected MuleContext muleContext;
30:
31: // default impl does nothing
32: public LifecycleTransitionResult initialise()
33: throws InitialisationException {
34: return LifecycleTransitionResult.OK;
35: }
36:
37: public void dispose() {
38: // Template
39: }
40:
41: public void setMuleContext(MuleContext context) {
42: this .muleContext = context;
43: }
44:
45: public MuleContext getMuleContext() {
46: return muleContext;
47: }
48:
49: public void setRouterStatistics(RouterStatistics stats) {
50: this .routerStatistics = stats;
51: }
52:
53: public RouterStatistics getRouterStatistics() {
54: return routerStatistics;
55: }
56: }
|