01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: package org.apache.naming;
19:
20: import javax.naming.Context;
21: import javax.naming.Reference;
22:
23: /**
24: * Represents a reference address to a transaction.
25: *
26: * @author Remy Maucherat
27: * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
28: */
29:
30: public class TransactionRef extends Reference {
31:
32: // -------------------------------------------------------------- Constants
33:
34: /**
35: * Default factory for this reference.
36: */
37: public static final String DEFAULT_FACTORY = org.apache.naming.factory.Constants.DEFAULT_TRANSACTION_FACTORY;
38:
39: // ----------------------------------------------------------- Constructors
40:
41: /**
42: * Resource Reference.
43: */
44: public TransactionRef() {
45: this (null, null);
46: }
47:
48: /**
49: * Resource Reference.
50: *
51: * @param factory The factory class
52: * @param factoryLocation The factory location
53: */
54: public TransactionRef(String factory, String factoryLocation) {
55: super ("javax.transaction.UserTransaction", factory,
56: factoryLocation);
57: }
58:
59: // ----------------------------------------------------- Instance Variables
60:
61: // ------------------------------------------------------ Reference Methods
62:
63: /**
64: * Retrieves the class name of the factory of the object to which this
65: * reference refers.
66: */
67: public String getFactoryClassName() {
68: String factory = super .getFactoryClassName();
69: if (factory != null) {
70: return factory;
71: } else {
72: factory = System.getProperty(Context.OBJECT_FACTORIES);
73: if (factory != null) {
74: return null;
75: } else {
76: return DEFAULT_FACTORY;
77: }
78: }
79: }
80:
81: // ------------------------------------------------------------- Properties
82:
83: }
|