View Javadoc

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