View Javadoc

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