TransactionManager
.
- *
- * The JBossTransactionManagerLookup
will work when Alfresco is running in JBoss,
- * but the TreeCache
can be used within other containers; there might not be any
- * container and the TransactionManager
may held in a local JNDI tree.
- *
- * For compatibility with other app servers, the JBoss GenericTransactionManagerLookup
- * could also be used.
- *
- * The default constructor configures the object to look in java:/TransactionManager
- * for a TransactionManager
. The only customisation that should be required is
- * to change the {@link #setJndiName(String) jndiName} property. If more JNDI details need
- * changing, then the actual {@link #setJndiLookup(JndiObjectFactoryBean) jndiLookup object} can
- * be substituted with a customized version.
- *
- * @author Derek Hulley
- */
-public class TransactionManagerJndiLookup implements TransactionManagerLookup
-{
- public static final String DEFAULT_JNDI_NAME = "java:/TransactionManager";
-
- private JndiObjectFactoryBean jndiLookup;
-
- public TransactionManagerJndiLookup()
- {
- jndiLookup = new JndiObjectFactoryBean();
- jndiLookup.setJndiName(DEFAULT_JNDI_NAME);
- jndiLookup.setProxyInterface(TransactionManager.class);
- }
-
- /**
- * @see org.springframework.jndi.JndiAccessor#setJndiTemplate(org.springframework.jndi.JndiTemplate)
- */
- public void setJndiTemplate(JndiTemplate jndiTemplate)
- {
- this.jndiLookup.setJndiTemplate(jndiTemplate);
- }
-
- /**
- * @see org.springframework.jndi.JndiAccessor#setJndiEnvironment(java.util.Properties)
- */
- public void setJndiEnvironment(Properties jndiEnvironment)
- {
- this.jndiLookup.setJndiEnvironment(jndiEnvironment);
- }
-
- /**
- * Set the JNDI location where the TransactionManager
can be found.
- *
- * @param jndiName
- */
- public void setJndiName(String jndiName)
- {
- jndiLookup.setJndiName(jndiName);
- }
-
- /**
- * @return Returns a TransactionManager
looked up at the JNDI location
- */
- public TransactionManager getTransactionManager() throws Exception
- {
- return (TransactionManager) jndiLookup.getObject();
- }
-}