View Javadoc

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