is being done locally or remotely and returns either the just bound
connection factory, or a DataSource proxy that uses the detached
invoker framework to expose remote proxies to the server side
DataSource and related elements.
*/
Referenceable referenceable = (Referenceable) cf;
// Set the DataSource proxy as the ProxyData ref address
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(theProxy);
oos.close();
byte[] proxyBytes = baos.toByteArray();
BinaryRefAddr dsAddr = new BinaryRefAddr("ProxyData", proxyBytes);
String factory = DataSourceFactory.class.getName();
Reference dsRef = new Reference("javax.sql.DataSource", dsAddr, factory, null);
referenceable.setReference(dsRef);
// Set the VMID as the address local/remote indicator
baos.reset();
ObjectOutputStream oos2 = new ObjectOutputStream(baos);
oos2.writeObject(DataSourceFactory.vmID);
oos2.close();