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 EjbRef 33 extends Reference { 34 35 36 38 39 42 public static final String DEFAULT_FACTORY = 43 org.apache.naming.factory.Constants.DEFAULT_EJB_FACTORY; 44 45 46 49 public static final String TYPE = "type"; 50 51 52 55 public static final String REMOTE = "remote"; 56 57 58 61 public static final String LINK = "link"; 62 63 64 66 67 75 public EjbRef(String ejbType, String home, String remote, String link) { 76 this(ejbType, home, remote, link, null, null); 77 } 78 79 80 88 public EjbRef(String ejbType, String home, String remote, String link, 89 String factory, String factoryLocation) { 90 super(home, factory, factoryLocation); 91 StringRefAddr refAddr = null; 92 if (ejbType != null) { 93 refAddr = new StringRefAddr (TYPE, ejbType); 94 add(refAddr); 95 } 96 if (remote != null) { 97 refAddr = new StringRefAddr (REMOTE, remote); 98 add(refAddr); 99 } 100 if (link != null) { 101 refAddr = new StringRefAddr (LINK, link); 102 add(refAddr); 103 } 104 } 105 106 107 109 110 112 113 115 116 120 public String getFactoryClassName() { 121 String factory = super.getFactoryClassName(); 122 if (factory != null) { 123 return factory; 124 } else { 125 factory = System.getProperty(Context.OBJECT_FACTORIES); 126 if (factory != null) { 127 return null; 128 } else { 129 return DEFAULT_FACTORY; 130 } 131 } 132 } 133 134 135 137 138 } 139 | Popular Tags |