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 resource environment.
24: *
25: * @author Remy Maucherat
26: * @version $Revision: 1.3 $ $Date: 2004/02/27 14:58:53 $
27: */
28:
29: public class ResourceEnvRef 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_RESOURCE_ENV_FACTORY;
37:
38: // ----------------------------------------------------------- Constructors
39:
40: /**
41: * Resource env reference.
42: *
43: * @param type Type
44: */
45: public ResourceEnvRef(String resourceType) {
46: super (resourceType);
47: }
48:
49: /**
50: * Resource env reference.
51: *
52: * @param type Type
53: */
54: public ResourceEnvRef(String resourceType, String factory,
55: String factoryLocation) {
56: super (resourceType, factory, 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: }
|