01: /*
02: * $Id: AbstractEndpointFactoryBean.java 10961 2008-02-22 19:01:02Z dfeist $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
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.lifecycle.LifecycleTransitionResult;
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
27: EndpointURIEndpointBuilder implements FactoryBean,
28: Initialisable {
29:
30: protected final Log logger = LogFactory.getLog(getClass());
31:
32: public AbstractEndpointFactoryBean(EndpointURIEndpointBuilder global)
33: throws EndpointException {
34: super (global);
35: }
36:
37: public AbstractEndpointFactoryBean() {
38: super ();
39: }
40:
41: public Object getObject() throws Exception {
42: return doGetObject();
43: }
44:
45: public boolean isSingleton() {
46: return true;
47: }
48:
49: public LifecycleTransitionResult initialise()
50: throws InitialisationException {
51: return LifecycleTransitionResult.OK;
52: }
53:
54: protected abstract Object doGetObject() throws Exception;
55:
56: }
|