Skip to content

Commit

Permalink
Added support for the JCA 1.7 getActivationName() method
Browse files Browse the repository at this point in the history
Issue: SPR-11067
  • Loading branch information
jhoeller committed Nov 4, 2013
1 parent bedb8e9 commit e146e53
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,7 @@
import javax.jms.MessageListener;
import javax.resource.ResourceException;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.jca.endpoint.GenericMessageEndpointManager;
import org.springframework.jms.support.destination.DestinationResolver;

Expand All @@ -45,7 +46,7 @@
* @see JmsActivationSpecFactory
* @see JmsMessageEndpointFactory
*/
public class JmsMessageEndpointManager extends GenericMessageEndpointManager {
public class JmsMessageEndpointManager extends GenericMessageEndpointManager implements BeanNameAware {

private final JmsMessageEndpointFactory endpointFactory = new JmsMessageEndpointFactory();

Expand Down Expand Up @@ -127,6 +128,14 @@ public void setActivationSpecConfig(JmsActivationSpecConfig activationSpecConfig
this.activationSpecConfig = activationSpecConfig;
}

/**
* Set the name of this message endpoint. Populated with the bean name
* automatically when defined within Spring's bean factory.
*/
@Override
public void setBeanName(String beanName) {
this.endpointFactory.setBeanName(beanName);
}

@Override
public void afterPropertiesSet() throws ResourceException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,11 +29,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.transaction.jta.SimpleTransactionFactory;
import org.springframework.transaction.jta.TransactionFactory;

/**
* Abstract base implementation of the JCA 1.5/1.6
* Abstract base implementation of the JCA 1.5/1.6/1.7
* {@link javax.resource.spi.endpoint.MessageEndpointFactory} interface,
* providing transaction management capabilities as well as ClassLoader
* exposure for endpoint invocations.
Expand All @@ -42,7 +43,7 @@
* @since 2.5
* @see #setTransactionManager
*/
public abstract class AbstractMessageEndpointFactory implements MessageEndpointFactory {
public abstract class AbstractMessageEndpointFactory implements MessageEndpointFactory, BeanNameAware {

/** Logger available to subclasses */
protected final Log logger = LogFactory.getLog(getClass());
Expand All @@ -53,6 +54,8 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF

private int transactionTimeout = -1;

private String beanName;


/**
* Set the the XA transaction manager to use for wrapping endpoint
Expand Down Expand Up @@ -116,6 +119,24 @@ public void setTransactionTimeout(int transactionTimeout) {
this.transactionTimeout = transactionTimeout;
}

/**
* Set the name of this message endpoint. Populated with the bean name
* automatically when defined within Spring's bean factory.
*/
@Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}


/**
* Implementation of the JCA 1.7 {@code #getActivationName()} method,
* returning the bean name as set on this MessageEndpointFactory.
* @see #setBeanName
*/
public String getActivationName() {
return this.beanName;
}

/**
* This implementation returns {@code true} if a transaction manager
Expand Down Expand Up @@ -157,8 +178,7 @@ public MessageEndpoint createEndpoint(XAResource xaResource, long timeout) throw
* @return the actual endpoint instance (never {@code null})
* @throws UnavailableException if no endpoint is available at present
*/
protected abstract AbstractMessageEndpoint createEndpointInternal()
throws UnavailableException;
protected abstract AbstractMessageEndpoint createEndpointInternal() throws UnavailableException;


/**
Expand Down

0 comments on commit e146e53

Please sign in to comment.