1 17 package org.alfresco.repo.transaction; 18 19 import java.util.Properties ; 20 21 import javax.transaction.TransactionManager ; 22 23 import org.jboss.cache.TransactionManagerLookup; 24 import org.springframework.jndi.JndiObjectFactoryBean; 25 import org.springframework.jndi.JndiTemplate; 26 27 45 public class TransactionManagerJndiLookup implements TransactionManagerLookup 46 { 47 public static final String DEFAULT_JNDI_NAME = "java:/TransactionManager"; 48 49 private JndiObjectFactoryBean jndiLookup; 50 51 public TransactionManagerJndiLookup() 52 { 53 jndiLookup = new JndiObjectFactoryBean(); 54 jndiLookup.setJndiName(DEFAULT_JNDI_NAME); 55 jndiLookup.setProxyInterface(TransactionManager .class); 56 } 57 58 61 public void setJndiTemplate(JndiTemplate jndiTemplate) 62 { 63 this.jndiLookup.setJndiTemplate(jndiTemplate); 64 } 65 66 69 public void setJndiEnvironment(Properties jndiEnvironment) 70 { 71 this.jndiLookup.setJndiEnvironment(jndiEnvironment); 72 } 73 74 79 public void setJndiName(String jndiName) 80 { 81 jndiLookup.setJndiName(jndiName); 82 } 83 84 87 public TransactionManager getTransactionManager() throws Exception 88 { 89 return (TransactionManager ) jndiLookup.getObject(); 90 } 91 } 92 | Popular Tags |