001    // SECTION-START[License Header]
002    // <editor-fold defaultstate="collapsed" desc=" Generated License ">
003    /*
004     *   Copyright (c) 2010 The JOMC Project
005     *   Copyright (c) 2005 Christian Schulte <schulte2005@users.sourceforge.net>
006     *   All rights reserved.
007     *
008     *   Redistribution and use in source and binary forms, with or without
009     *   modification, are permitted provided that the following conditions
010     *   are met:
011     *
012     *     o Redistributions of source code must retain the above copyright
013     *       notice, this list of conditions and the following disclaimer.
014     *
015     *     o Redistributions in binary form must reproduce the above copyright
016     *       notice, this list of conditions and the following disclaimer in
017     *       the documentation and/or other materials provided with the
018     *       distribution.
019     *
020     *   THIS SOFTWARE IS PROVIDED BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS"
021     *   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
022     *   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
023     *   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR
024     *   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
025     *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
026     *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
027     *   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
028     *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
029     *   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
030     *   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031     *
032     *   $Id: TopLinkTransactionController.java 2242 2010-06-29 07:54:56Z schulte2005 $
033     *
034     */
035    // </editor-fold>
036    // SECTION-END
037    package org.jomc.standalone.ri.naming.support;
038    
039    import javax.transaction.TransactionManager;
040    import oracle.toplink.essentials.transaction.JTATransactionController;
041    import org.jomc.standalone.ri.StandaloneEnvironment;
042    
043    // SECTION-START[Documentation]
044    // <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
045    /**
046     * Standalone Toplink {@code ExternalTransactionController}.
047     *
048     * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0
049     * @version $Id: TopLinkTransactionController.java 2242 2010-06-29 07:54:56Z schulte2005 $
050     */
051    // </editor-fold>
052    // SECTION-END
053    // SECTION-START[Annotations]
054    // <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
055    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" )
056    // </editor-fold>
057    // SECTION-END
058    public final class TopLinkTransactionController extends JTATransactionController
059    {
060        // SECTION-START[TopLinkTransactionController]
061    
062        private StandaloneEnvironment standaloneEnvironment;
063    
064        @Override
065        protected TransactionManager acquireTransactionManager() throws Exception
066        {
067            return (TransactionManager) this.jndiLookup( this.getStandaloneEnvironment().getTransactionManagerJndiName() );
068        }
069    
070        protected StandaloneEnvironment getStandaloneEnvironment()
071        {
072            if ( this.standaloneEnvironment == null )
073            {
074                this.standaloneEnvironment = new StandaloneEnvironment();
075            }
076    
077            return this.standaloneEnvironment;
078        }
079    
080        // SECTION-END
081        // SECTION-START[Constructors]
082        // <editor-fold defaultstate="collapsed" desc=" Generated Constructors ">
083    
084        /** Creates a new {@code TopLinkTransactionController} instance. */
085        @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" )
086        public TopLinkTransactionController()
087        {
088            // SECTION-START[Default Constructor]
089            super();
090            // SECTION-END
091        }
092        // </editor-fold>
093        // SECTION-END
094        // SECTION-START[Dependencies]
095        // SECTION-END
096        // SECTION-START[Properties]
097        // SECTION-END
098        // SECTION-START[Messages]
099        // SECTION-END
100    }