View Javadoc

1   /*
2    * $Id: AbstractEndpointFactoryBean.java 20297 2010-11-22 18:49:18Z aperepel $
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.endpoint.EndpointException;
14  import org.mule.api.lifecycle.Initialisable;
15  import org.mule.api.lifecycle.InitialisationException;
16  import org.mule.endpoint.EndpointURIEndpointBuilder;
17  
18  import org.apache.commons.logging.Log;
19  import org.apache.commons.logging.LogFactory;
20  import org.springframework.beans.factory.FactoryBean;
21  
22  /**
23   * Abstract spring FactoryBean used to creating endpoints via spring.
24   */
25  public abstract class AbstractEndpointFactoryBean extends EndpointURIEndpointBuilder
26      implements FactoryBean, Initialisable
27  {
28  
29      protected final Log logger = LogFactory.getLog(getClass());
30  
31      public AbstractEndpointFactoryBean(EndpointURIEndpointBuilder global) throws EndpointException
32      {
33          super(global);
34      }
35  
36      public AbstractEndpointFactoryBean()
37      {
38          super();
39      }
40  
41      public Object getObject() throws Exception
42      {
43          return doGetObject();
44      }
45  
46      public boolean isSingleton()
47      {
48          return true;
49      }
50  
51      public void initialise() throws InitialisationException
52      {
53          // subclasses may override this method
54      }
55      
56      protected abstract Object doGetObject() throws Exception;
57  
58  }