View Javadoc

1   /*
2    * $Id: InboundEndpointFactoryBean.java 11343 2008-03-13 10:58:26Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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 InboundEndpointFactoryBean extends AbstractEndpointFactoryBean
24  {
25  
26      public InboundEndpointFactoryBean(EndpointURIEndpointBuilder global) throws EndpointException
27      {
28          super(global);
29      }
30  
31      public InboundEndpointFactoryBean()
32      {
33          super();
34      }
35      
36      public Class getObjectType()
37      {
38          return InboundEndpoint.class;
39      }
40  
41      public Object doGetObject() throws Exception
42      {
43          EndpointFactory ef = muleContext.getRegistry().lookupEndpointFactory();
44          if (ef != null)
45          {
46              return ef.getInboundEndpoint(this);
47          }
48          else
49          {
50              throw new ConfigurationException(MessageFactory.createStaticMessage("EndpointFactory not found in Registry"));
51          }
52      }
53  
54  }