KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > resource > NoTxResourceManagerImpl


1
2 /*
3  * The contents of this file are subject to the terms
4  * of the Common Development and Distribution License
5  * (the License). You may not use this file except in
6  * compliance with the License.
7  *
8  * You can obtain a copy of the license at
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
10  * glassfish/bootstrap/legal/CDDLv1.0.txt.
11  * See the License for the specific language governing
12  * permissions and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL
15  * Header Notice in each file and include the License file
16  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
17  * If applicable, add the following below the CDDL Header,
18  * with the fields enclosed by brackets [] replaced by
19  * you own identifying information:
20  * "Portions Copyrighted [year] [name of copyright owner]"
21  *
22  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23  */

24 package com.sun.enterprise.resource;
25
26 import java.util.*;
27 import java.util.logging.*;
28
29 import javax.transaction.*;
30 import javax.transaction.xa.*;
31
32 import com.sun.logging.*;
33 import com.sun.enterprise.*;
34 import com.sun.enterprise.log.Log;
35
36 /**
37  * Resource Manager for a resource request from a component
38  * that is not to be associated with a transaction.
39  *
40  * @author Aditya Gore
41  */

42 public class NoTxResourceManagerImpl implements ResourceManager {
43     
44     
45     static Logger _logger = null;
46     static {
47         _logger = LogDomains.getLogger(LogDomains.RSR_LOGGER);
48     }
49     
50     /**
51      * Returns null since this connection is outside any tx context
52      *
53      * @exception <code>PoolingException<code>
54      */

55     public Transaction getTransaction() throws PoolingException{
56         return null;
57     }
58     
59     /**
60      * Returns the component invoking resource request.
61      *
62      * @return Handle to the component
63      */

64     public Object JavaDoc getComponent(){
65     return null;
66     }
67     
68     /**
69      * Enlist the <code>ResourceHandle</code> in the transaction
70      * This implementation of the method is expected to be a no-op
71      *
72      * @param h <code>ResourceHandle</code> object
73      * @exception <code>PoolingException</code>
74      */

75     public void enlistResource(ResourceHandle h) throws PoolingException{
76         if (_logger.isLoggable( Level.FINE ) ) {
77         _logger.fine( "NoTxResourceManagerImpl :: enlistResource called");
78     }
79     }
80     
81     /**
82      * Register the <code>ResourceHandle</code> in the transaction
83      * This implementation of the method is expected to be a no-op
84      *
85      *
86      * @param h <code>ResourceHandle</code> object
87      * @exception <code>PoolingException</code>
88      */

89     public void registerResource(ResourceHandle handle)
90             throws PoolingException
91     {
92         if (_logger.isLoggable( Level.FINE ) ) {
93         _logger.fine( "NoTxResourceManagerImpl :: registerResource called");
94     }
95     }
96     
97     /**
98      * Get's the component's transaction and marks it for rolling back.
99      * This implementation of the method is expected to be a no-op
100      *
101      */

102     public void rollBackTransaction() {
103     if (_logger.isLoggable(Level.FINE)) {
104             _logger.fine("rollBackTransaction called in NoTxResourceManagerImpl");
105     }
106     }
107     
108     /**
109      * delist the <code>ResourceHandle</code> from the transaction
110      * This implementation of the method is expected to be a no-op
111      *
112      *
113      * @param h <code>ResourceHandle</code> object
114      * @param xaresFlag flag indicating transaction success. This can
115      * be XAResource.TMSUCCESS or XAResource.TMFAIL
116      * @exception <code>PoolingException</code>
117      */

118     public void delistResource(ResourceHandle resource, int xaresFlag) {
119         if (_logger.isLoggable( Level.FINE ) ) {
120         _logger.fine( "NoTxResourceManagerImpl :: delistResource called");
121     }
122     }
123     
124     /**
125      * Unregister the <code>ResourceHandle</code> from the transaction
126      * This implementation of the method is expected to be a no-op
127      *
128      *
129      * @param h <code>ResourceHandle</code> object
130      * @param xaresFlag flag indicating transaction success. This can
131      * be XAResource.TMSUCCESS or XAResource.TMFAIL
132      * @exception <code>PoolingException</code>
133      */

134     public void unregisterResource(ResourceHandle resource, int xaresFlag) {
135         if (_logger.isLoggable( Level.FINE ) ) {
136         _logger.fine( "NoTxResourceManagerImpl :: unregisterResource called");
137     }
138     }
139 }
140
Popular Tags