JPOX
JPOX
 Project  |  Ver 1.1  |  Ver 1.2  |  JDO  |  JPA  |  Guides  |  Tools
1.2 | Persistence | JDO ORM | JPA ORM | Runtime | JDO Runtime | JPA Runtime | Extensions | Developer
Extensions
Plugins : JTA Locator

JPOX is developed as a plugin-driven framework and one of the components that is pluggable is the locator for JTA TransactionManagers (since J2EE doesnt define a standard mechanism for location). JPOX provides several plugins for the principal application servers available but is structured so that you can easily add your own variant and have it usable within your JPOX usage.

Locators for JTA TransactionManagers can be plugged using the plugin extension org.jpox.jta_locator. These are of relevance when running with JTA transaction and linking in to the JTA transaction of some controlling application server

Plugin extension-pointKeyDescriptionLocation
org.jpox.jta_locatorjbossJBossjpox-core
org.jpox.jta_locatorjonasJOnASjpox-core
org.jpox.jta_locatorjotmJOTMjpox-core
org.jpox.jta_locatoroc4jOC4Jjpox-core
org.jpox.jta_locatororionOrionjpox-core
org.jpox.jta_locatorresinResinjpox-core
org.jpox.jta_locatorsapSAP app serverjpox-core
org.jpox.jta_locatorsunSun ONE app serverjpox-core
org.jpox.jta_locatorweblogicWebLogic app serverjpox-core
org.jpox.jta_locatorwebsphereWebSphere 4/5jpox-core
org.jpox.jta_locatorcustom_jndiCustom JNDIjpox-core

The following sections describe how to create your own JTA Locator plugin for JPOX.

Interface

If you have your own JTA Locator you can easily use it with JPOX. JPOX defines a TransactionManagerLocator interface and you need to implement this.

package org.jpox.jta;

import javax.transaction.TransactionManager;
import org.jpox.ClassLoaderResolver;

public interface TransactionManagerLocator
{
    /**
     * Method to return the TransactionManager.
     * @param clr ClassLoader resolver
     * @return The TransactionManager
     */
    TransactionManager getTransactionManager(ClassLoaderResolver clr);
}

So you need to create a class, MyTransactionManagerLocator for example, that implements this interface.



Plugin Specification

Once you have this implementation you then need to make the class available as a JPOX plugin. You do this by putting a file plugin.xml in your JAR at the root of the CLASSPATH. The file plugin.xml will look like this

<?xml version="1.0"?>
<plugin id="mydomain.mylocator" name="JPOX plug-ins" provider-name="My Company">
    <extension point="org.jpox.jta_locator">
	    <cache name="MyLocator" class-name="mydomain.MyTransactionManagerLocator"/>
    </extension>
</plugin>
Plugin Usage

The only thing remaining is to use your JTA Locator plugin. To do this you specify the PersistenceManagerFactory property org.jpox.jtaLocator as MyLocator (the "name" in plugin.xml).