View Javadoc

1   /*
2    * $Id: ConnectorLifecycleTracker.java 20321 2010-11-24 15:21:24Z dfeist $
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.test.integration.transport;
12  
13  import org.mule.api.MuleContext;
14  import org.mule.api.MuleException;
15  import org.mule.api.endpoint.OutboundEndpoint;
16  import org.mule.api.lifecycle.InitialisationException;
17  import org.mule.api.processor.MessageProcessor;
18  import org.mule.transport.AbstractConnector;
19  
20  import java.util.ArrayList;
21  import java.util.List;
22  
23  /**
24   * TODO
25   */
26  public class ConnectorLifecycleTracker extends AbstractConnector
27  {
28      private final List<String> tracker = new ArrayList<String>();
29  
30      private String property1;
31  
32      boolean connected = false;
33      
34      public ConnectorLifecycleTracker(MuleContext context)
35      {
36          super(context);
37      }
38      
39      public List<String> getTracker() {
40          return tracker;
41      }
42  
43      public String getProtocol()
44      {
45          return "test";
46      }
47  
48      public void doConnect() throws Exception
49      {
50          connected = true;
51          getTracker().add("connect");
52      }
53  
54      public void doDisconnect() throws Exception
55      {
56          connected = false;
57          getTracker().add("disconnect");
58      }
59  
60  
61  
62      public void setProperty(final String value) {
63          tracker.add("setProperty");
64      }
65  
66      public void doInitialise() throws InitialisationException
67      {
68          tracker.add("initialise");
69      }
70  
71      public void doStart() throws MuleException
72      {
73          tracker.add("start");
74      }
75  
76      public void doStop() throws MuleException {
77          tracker.add("stop");
78      }
79  
80      public void doDispose() {
81          tracker.add("dispose");
82      }
83  
84  
85      public String getProperty1()
86      {
87          return property1;
88      }
89  
90      public void setProperty1(String property1)
91      {
92          tracker.add("setProperty");
93          this.property1 = property1;
94      }
95  
96      public MessageProcessor getOutboundEndpointMessageProcessor(OutboundEndpoint endpoint)
97          throws MuleException
98      {
99          return null;
100     }
101 }