1 17 18 19 package org.apache.naming; 20 21 import javax.naming.Context ; 22 import javax.naming.Reference ; 23 import javax.naming.StringRefAddr ; 24 25 31 32 public class ResourceLinkRef 33 extends Reference { 34 35 36 38 39 42 public static final String DEFAULT_FACTORY = 43 org.apache.naming.factory.Constants.DEFAULT_RESOURCE_LINK_FACTORY; 44 45 46 49 public static final String GLOBALNAME = "globalName"; 50 51 52 54 55 61 public ResourceLinkRef(String resourceClass, String globalName) { 62 this(resourceClass, globalName, null, null); 63 } 64 65 66 72 public ResourceLinkRef(String resourceClass, String globalName, 73 String factory, String factoryLocation) { 74 super(resourceClass, factory, factoryLocation); 75 StringRefAddr refAddr = null; 76 if (globalName != null) { 77 refAddr = new StringRefAddr (GLOBALNAME, globalName); 78 add(refAddr); 79 } 80 } 81 82 83 85 86 88 89 93 public String getFactoryClassName() { 94 String factory = super.getFactoryClassName(); 95 if (factory != null) { 96 return factory; 97 } else { 98 factory = System.getProperty(Context.OBJECT_FACTORIES); 99 if (factory != null) { 100 return null; 101 } else { 102 return DEFAULT_FACTORY; 103 } 104 } 105 } 106 107 108 110 111 } 112 | Popular Tags |