View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.endpoint.dynamic;
8   
9   import org.mule.api.MuleContext;
10  import org.mule.api.MuleException;
11  import org.mule.api.lifecycle.InitialisationException;
12  import org.mule.transport.AbstractConnector;
13  
14  /**
15   * A placeholder for a connector that has not been created yet. This used by dynamic endpoints who's actual endpoint is
16   * not created until the first message is received for processing. At that point the real endpoint is created and the 'NullEndpoint'
17   * including this NullConnector is overwritten.
18   *
19   * @since 3.0
20   * @see org.mule.endpoint.DynamicOutboundEndpoint
21   */
22  public class NullConnector extends AbstractConnector
23  {
24      public NullConnector(MuleContext context) throws MuleException
25      {
26          super(context);
27          //We call Initialise here since this connector will never get added to the registry, but we still need to have
28          //it initialised to avoid NPEs and will be thrown away once the first message is received by a dynamic endpoint
29          initialise();
30      }
31  
32      @Override
33      protected void doInitialise() throws InitialisationException
34      {
35          //do nothing
36      }
37  
38      @Override
39      protected void doDispose()
40      {
41          //do nothing
42      }
43  
44      @Override
45      protected void doStart() throws MuleException
46      {
47          //do nothing
48      }
49  
50      @Override
51      protected void doStop() throws MuleException
52      {
53          //do nothing
54      }
55  
56      @Override
57      protected void doConnect() throws Exception
58      {
59          //do nothing
60      }
61  
62      @Override
63      protected void doDisconnect() throws Exception
64      {
65          //do nothing
66      }
67  
68      public String getProtocol()
69      {
70          return "dynamic";
71      }
72  }