KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jts > jta > UserTransactionFactory


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

23
24 /*
25  * Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
26  * Use is subject to license terms.
27  */

28
29 package com.sun.jts.jta;
30
31 import javax.naming.*;
32 import javax.naming.spi.*;
33
34 /**
35  * Factory for producing the UserTransactionImpl objects.
36  *
37  * @author Ram Jeyaraman
38  * @version 1.0 Feb 09, 1999
39  */

40 public class UserTransactionFactory implements ObjectFactory {
41
42     /**
43      * @param obj Reference information that can be used in creating an object.
44      * @param name of this object relative to nameCtx (optional).
45      * @param nameCtx context relative to which the name parameter specified.
46      * If null, name is relative to the default initial context.
47      * @param environment possibly null environment used in creating the object.
48      *
49      * @return object created; null if an object cannot be created.
50      *
51      * @exception java.lang.Exception if this object factory encountered
52      * an exception while attempting to create an object.
53      */

54     public Object JavaDoc getObjectInstance(Object JavaDoc refObj, Name name,
55         Context nameCtx, java.util.Hashtable JavaDoc env)
56         throws Exception JavaDoc {
57
58         if (refObj == null || !(refObj instanceof Reference))
59             return null;
60
61         Reference ref = (Reference) refObj;
62
63         if (ref.getClassName().
64             equals(UserTransactionImpl.class.getName())) {
65             // create a new object
66
return new UserTransactionImpl();
67         }
68
69         return null;
70     }
71 }
72
Popular Tags