View Javadoc

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