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