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 resource environment.
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 ResourceEnvRef 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_RESOURCE_ENV_FACTORY;
38:
39: // ----------------------------------------------------------- Constructors
40:
41: /**
42: * Resource env reference.
43: *
44: * @param resourceType Type
45: */
46: public ResourceEnvRef(String resourceType) {
47: super (resourceType);
48: }
49:
50: /**
51: * Resource env reference.
52: *
53: * @param resourceType Type
54: * @param factory The factory class
55: * @param factoryLocation The factory location
56: */
57: public ResourceEnvRef(String resourceType, String factory,
58: String factoryLocation) {
59: super (resourceType, factory, factoryLocation);
60: }
61:
62: // ----------------------------------------------------- Instance Variables
63:
64: // ------------------------------------------------------ Reference Methods
65:
66: /**
67: * Retrieves the class name of the factory of the object to which this
68: * reference refers.
69: */
70: public String getFactoryClassName() {
71: String factory = super .getFactoryClassName();
72: if (factory != null) {
73: return factory;
74: } else {
75: factory = System.getProperty(Context.OBJECT_FACTORIES);
76: if (factory != null) {
77: return null;
78: } else {
79: return DEFAULT_FACTORY;
80: }
81: }
82: }
83:
84: // ------------------------------------------------------------- Properties
85:
86: }
|