001/* 002 * Copyright (c) 2006-2013 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Florent Guillaume 011 */ 012 013package org.nuxeo.runtime.jtajca; 014 015import java.util.Hashtable; 016 017import javax.naming.Context; 018import javax.naming.Name; 019import javax.naming.NamingException; 020import javax.naming.Reference; 021import javax.naming.spi.ObjectFactory; 022import javax.transaction.UserTransaction; 023 024/** 025 * Factory for the UserTransaction. 026 */ 027public class NuxeoUserTransactionFactory implements ObjectFactory { 028 029 @Override 030 public Object getObjectInstance(Object obj, Name objName, Context nameCtx, Hashtable<?, ?> env) { 031 Reference ref = (Reference) obj; 032 if (!UserTransaction.class.getName().equals(ref.getClassName())) { 033 return null; 034 } 035 return NuxeoContainer.ut; 036 } 037 038}