63 * the given interface. If the operation is successful the result will be an |
63 * the given interface. If the operation is successful the result will be an |
64 * object of the specified type, otherwise an exception will be thrown. |
64 * object of the specified type, otherwise an exception will be thrown. |
65 */ |
65 */ |
66 public class PortableRemoteObject { |
66 public class PortableRemoteObject { |
67 |
67 |
68 private static javax.rmi.CORBA.PortableRemoteObjectDelegate proDelegate = null; |
68 private static final javax.rmi.CORBA.PortableRemoteObjectDelegate proDelegate; |
69 |
69 |
70 private static final String PortableRemoteObjectClassKey = |
70 private static final String PortableRemoteObjectClassKey = |
71 "javax.rmi.CORBA.PortableRemoteObjectClass"; |
71 "javax.rmi.CORBA.PortableRemoteObjectClass"; |
72 |
72 |
73 private static final String defaultPortableRemoteObjectImplName = |
|
74 "com.sun.corba.se.impl.javax.rmi.PortableRemoteObject"; |
|
75 |
|
76 static { |
73 static { |
77 proDelegate = (javax.rmi.CORBA.PortableRemoteObjectDelegate) |
74 proDelegate = (javax.rmi.CORBA.PortableRemoteObjectDelegate) |
78 createDelegateIfSpecified(PortableRemoteObjectClassKey); |
75 createDelegate(PortableRemoteObjectClassKey); |
79 } |
76 } |
80 |
77 |
81 /** |
78 /** |
82 * Initializes the object by calling <code>exportObject(this)</code>. |
79 * Initializes the object by calling <code>exportObject(this)</code>. |
83 * @exception RemoteException if export fails. |
80 * @exception RemoteException if export fails. |
179 |
176 |
180 // Same code as in javax.rmi.CORBA.Util. Can not be shared because they |
177 // Same code as in javax.rmi.CORBA.Util. Can not be shared because they |
181 // are in different packages and the visibility needs to be package for |
178 // are in different packages and the visibility needs to be package for |
182 // security reasons. If you know a better solution how to share this code |
179 // security reasons. If you know a better solution how to share this code |
183 // then remove it from here. |
180 // then remove it from here. |
184 private static Object createDelegateIfSpecified(String classKey) { |
181 private static Object createDelegate(String classKey) { |
185 String className = (String) |
182 String className = (String) |
186 AccessController.doPrivileged(new GetPropertyAction(classKey)); |
183 AccessController.doPrivileged(new GetPropertyAction(classKey)); |
187 if (className == null) { |
184 if (className == null) { |
188 Properties props = getORBPropertiesFile(); |
185 Properties props = getORBPropertiesFile(); |
189 if (props != null) { |
186 if (props != null) { |
190 className = props.getProperty(classKey); |
187 className = props.getProperty(classKey); |
191 } |
188 } |
192 } |
189 } |
193 if (className == null) { |
190 if (className == null) { |
194 className = defaultPortableRemoteObjectImplName; |
191 return new com.sun.corba.se.impl.javax.rmi.PortableRemoteObject(); |
195 } |
192 } |
196 |
193 |
197 try { |
194 try { |
198 return (Object) loadDelegateClass(className).newInstance(); |
195 return (Object) loadDelegateClass(className).newInstance(); |
199 } catch (ClassNotFoundException ex) { |
196 } catch (ClassNotFoundException ex) { |