View Javadoc

1   /*
2    * $Id: NullConnector.java 20320 2010-11-24 15:03:31Z 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  package org.mule.endpoint.dynamic;
11  
12  import org.mule.api.MuleContext;
13  import org.mule.api.MuleException;
14  import org.mule.api.lifecycle.InitialisationException;
15  import org.mule.transport.AbstractConnector;
16  
17  /**
18   * A placeholder for a connector that has not been created yet. This used by dynamic endpoints who's actual endpoint is
19   * not created until the first message is received for processing. At that point the real endpoint is created and the 'NullEndpoint'
20   * including this NullConnector is overwritten.
21   *
22   * @since 3.0
23   * @see org.mule.endpoint.DynamicOutboundEndpoint
24   */
25  public class NullConnector extends AbstractConnector
26  {
27      public NullConnector(MuleContext context) throws MuleException
28      {
29          super(context);
30          //We call Initialise here since this connector will never get added to the registry, but we still need to have
31          //it initialised to avoid NPEs and will be thrown away once the first message is received by a dynamic endpoint
32          initialise();
33      }
34  
35      @Override
36      protected void doInitialise() throws InitialisationException
37      {
38          //do nothing
39      }
40  
41      @Override
42      protected void doDispose()
43      {
44          //do nothing
45      }
46  
47      @Override
48      protected void doStart() throws MuleException
49      {
50          //do nothing
51      }
52  
53      @Override
54      protected void doStop() throws MuleException
55      {
56          //do nothing
57      }
58  
59      @Override
60      protected void doConnect() throws Exception
61      {
62          //do nothing
63      }
64  
65      @Override
66      protected void doDisconnect() throws Exception
67      {
68          //do nothing
69      }
70  
71      public String getProtocol()
72      {
73          return "dynamic";
74      }
75  }