View Javadoc

1   /*
2    * $Id: LifecycleTrackerComponent.java 15966 2009-11-04 23:25:23Z rossmason $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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  
11  package org.mule.lifecycle;
12  
13  import org.mule.api.MuleEvent;
14  import org.mule.api.MuleException;
15  import org.mule.api.component.Component;
16  import org.mule.api.construct.FlowConstruct;
17  import org.mule.api.construct.FlowConstructAware;
18  import org.mule.management.stats.ComponentStatistics;
19  
20  import org.mockito.Mockito;
21  
22  /**
23   * @author David Dossot (david@dossot.net)
24   */
25  public class LifecycleTrackerComponent extends AbstractLifecycleTracker implements FlowConstructAware, Component
26  {
27  
28      private FlowConstruct flowConstruct;
29  
30      public void springInitialize()
31      {
32          getTracker().add("springInitialize");
33      }
34  
35      public void springDestroy()
36      {
37          getTracker().add("springDestroy");
38      }
39  
40      public void setFlowConstruct(final FlowConstruct flowConstruct)
41      {
42          getTracker().add("setService");
43          this.flowConstruct = flowConstruct;
44      }
45  
46      public FlowConstruct getFlowConstruct()
47      {
48          return flowConstruct;
49      }
50  
51      public ComponentStatistics getStatistics()
52      {
53          return Mockito.mock(ComponentStatistics.class);
54      }
55  
56      public MuleEvent process(MuleEvent event) throws MuleException
57      {
58          return event;
59      }
60  }