01: /*
02: * Copyright 1999,2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.apache.naming;
18:
19: import javax.naming.Context;
20: import javax.naming.Reference;
21:
22: /**
23: * Represents a reference address to a transaction.
24: *
25: * @author Remy Maucherat
26: * @version $Revision: 1.3 $ $Date: 2004/02/27 14:58:53 $
27: */
28:
29: public class TransactionRef extends Reference {
30:
31: // -------------------------------------------------------------- Constants
32:
33: /**
34: * Default factory for this reference.
35: */
36: public static final String DEFAULT_FACTORY = org.apache.naming.factory.Constants.DEFAULT_TRANSACTION_FACTORY;
37:
38: // ----------------------------------------------------------- Constructors
39:
40: /**
41: * Resource Reference.
42: *
43: * @param resourceClass Resource class
44: * @param scope Resource scope
45: * @param auth Resource authetication
46: */
47: public TransactionRef() {
48: this (null, null);
49: }
50:
51: /**
52: * Resource Reference.
53: *
54: * @param resourceClass Resource class
55: * @param scope Resource scope
56: * @param auth Resource authetication
57: */
58: public TransactionRef(String factory, String factoryLocation) {
59: super ("javax.transaction.UserTransaction", factory,
60: factoryLocation);
61: }
62:
63: // ----------------------------------------------------- Instance Variables
64:
65: // ------------------------------------------------------ Reference Methods
66:
67: /**
68: * Retrieves the class name of the factory of the object to which this
69: * reference refers.
70: */
71: public String getFactoryClassName() {
72: String factory = super .getFactoryClassName();
73: if (factory != null) {
74: return factory;
75: } else {
76: factory = System.getProperty(Context.OBJECT_FACTORIES);
77: if (factory != null) {
78: return null;
79: } else {
80: return DEFAULT_FACTORY;
81: }
82: }
83: }
84:
85: // ------------------------------------------------------------- Properties
86:
87: }
|