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.config.spring.factories;
8   
9   import org.mule.api.config.ConfigurationException;
10  import org.mule.api.endpoint.EndpointException;
11  import org.mule.api.endpoint.EndpointFactory;
12  import org.mule.api.endpoint.InboundEndpoint;
13  import org.mule.config.i18n.MessageFactory;
14  import org.mule.endpoint.EndpointURIEndpointBuilder;
15  
16  /**
17   * Spring FactoryBean used to create concrete instances of inbound endpoints
18   */
19  public class PollInboundEndpointFactoryBean extends AbstractEndpointFactoryBean
20  {
21  
22      public PollInboundEndpointFactoryBean(EndpointURIEndpointBuilder global) throws EndpointException
23      {
24          super(global);
25      }
26  
27      public PollInboundEndpointFactoryBean()
28      {
29          super();
30      }
31  
32      public Class<?> getObjectType()
33      {
34          return InboundEndpoint.class;
35      }
36  
37      @Override
38      public Object doGetObject() throws Exception
39      {
40          EndpointFactory ef = muleContext.getEndpointFactory();
41          if (ef != null)
42          {
43              return ef.getInboundEndpoint(this);
44          }
45          else
46          {
47              throw new ConfigurationException(MessageFactory.createStaticMessage("EndpointFactory not found in Registry"));
48          }
49      }
50  
51  }