11/* 
2-  * Copyright 2002-2012  the original author or authors. 
2+  * Copyright 2002-2013  the original author or authors. 
33 * 
44 * Licensed under the Apache License, Version 2.0 (the "License"); 
55 * you may not use this file except in compliance with the License. 
2929import  org .apache .commons .logging .Log ;
3030import  org .apache .commons .logging .LogFactory ;
3131
32+ import  org .springframework .beans .factory .BeanNameAware ;
3233import  org .springframework .transaction .jta .SimpleTransactionFactory ;
3334import  org .springframework .transaction .jta .TransactionFactory ;
3435
3536/** 
36-  * Abstract base implementation of the JCA 1.5/1.6 
37+  * Abstract base implementation of the JCA 1.5/1.6/1.7  
3738 * {@link javax.resource.spi.endpoint.MessageEndpointFactory} interface, 
3839 * providing transaction management capabilities as well as ClassLoader 
3940 * exposure for endpoint invocations. 
4243 * @since 2.5 
4344 * @see #setTransactionManager 
4445 */ 
45- public  abstract  class  AbstractMessageEndpointFactory  implements  MessageEndpointFactory  {
46+ public  abstract  class  AbstractMessageEndpointFactory  implements  MessageEndpointFactory ,  BeanNameAware  {
4647
4748	/** Logger available to subclasses */ 
4849	protected  final  Log  logger  = LogFactory .getLog (getClass ());
@@ -53,6 +54,8 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF
5354
5455	private  int  transactionTimeout  = -1 ;
5556
57+ 	private  String  beanName ;
58+ 
5659
5760	/** 
5861	 * Set the the XA transaction manager to use for wrapping endpoint 
@@ -116,6 +119,24 @@ public void setTransactionTimeout(int transactionTimeout) {
116119		this .transactionTimeout  = transactionTimeout ;
117120	}
118121
122+ 	/** 
123+ 	 * Set the name of this message endpoint. Populated with the bean name 
124+ 	 * automatically when defined within Spring's bean factory. 
125+ 	 */ 
126+ 	@ Override 
127+ 	public  void  setBeanName (String  beanName ) {
128+ 		this .beanName  = beanName ;
129+ 	}
130+ 
131+ 
132+ 	/** 
133+ 	 * Implementation of the JCA 1.7 {@code #getActivationName()} method, 
134+ 	 * returning the bean name as set on this MessageEndpointFactory. 
135+ 	 * @see #setBeanName 
136+ 	 */ 
137+ 	public  String  getActivationName () {
138+ 		return  this .beanName ;
139+ 	}
119140
120141	/** 
121142	 * This implementation returns {@code true} if a transaction manager 
@@ -157,8 +178,7 @@ public MessageEndpoint createEndpoint(XAResource xaResource, long timeout) throw
157178	 * @return the actual endpoint instance (never {@code null}) 
158179	 * @throws UnavailableException if no endpoint is available at present 
159180	 */ 
160- 	protected  abstract  AbstractMessageEndpoint  createEndpointInternal ()
161- 			throws  UnavailableException ;
181+ 	protected  abstract  AbstractMessageEndpoint  createEndpointInternal () throws  UnavailableException ;
162182
163183
164184	/** 
0 commit comments