KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > naming > TransactionRef


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18
19 package org.apache.naming;
20
21 import javax.naming.Context JavaDoc;
22 import javax.naming.Reference JavaDoc;
23
24 /**
25  * Represents a reference address to a transaction.
26  *
27  * @author Remy Maucherat
28  * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
29  */

30
31 public class TransactionRef
32     extends Reference JavaDoc {
33
34
35     // -------------------------------------------------------------- Constants
36

37
38     /**
39      * Default factory for this reference.
40      */

41     public static final String JavaDoc DEFAULT_FACTORY =
42         org.apache.naming.factory.Constants.DEFAULT_TRANSACTION_FACTORY;
43
44
45     // ----------------------------------------------------------- Constructors
46

47
48     /**
49      * Resource Reference.
50      */

51     public TransactionRef() {
52         this(null, null);
53     }
54
55
56     /**
57      * Resource Reference.
58      *
59      * @param factory The factory class
60      * @param factoryLocation The factory location
61      */

62     public TransactionRef(String JavaDoc factory, String JavaDoc factoryLocation) {
63         super("javax.transaction.UserTransaction", factory, factoryLocation);
64     }
65
66
67     // ----------------------------------------------------- Instance Variables
68

69
70     // ------------------------------------------------------ Reference Methods
71

72
73     /**
74      * Retrieves the class name of the factory of the object to which this
75      * reference refers.
76      */

77     public String JavaDoc getFactoryClassName() {
78         String JavaDoc factory = super.getFactoryClassName();
79         if (factory != null) {
80             return factory;
81         } else {
82             factory = System.getProperty(Context.OBJECT_FACTORIES);
83             if (factory != null) {
84                 return null;
85             } else {
86                 return DEFAULT_FACTORY;
87             }
88         }
89     }
90
91
92     // ------------------------------------------------------------- Properties
93

94
95 }
96
Popular Tags