* Retrieves the (JNDI) reference of this PMF object.
* @return The reference
*/
public Reference getReference()
{
Reference rc = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try
{
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(this);
rc = new Reference(JDOClassNameConstants.JAVAX_JDO_PersistenceManagerFactory,
JDOClassNameConstants.JDOPersistenceManagerFactory, null);
Map p = getOptions();
for (Iterator i = p.keySet().iterator(); i.hasNext();)
{
String key = (String) i.next();
if (p.get(key) instanceof String)
{
String value = (String) p.get(key);
rc.add(new StringRefAddr(key, value));
if (JPOXLogger.NAMING.isDebugEnabled())
{
JPOXLogger.NAMING.debug(LOCALISER_JDO.msg("012009", key, value));
}
}
else if (p.get(key) instanceof Long)
{
String value = "" + p.get(key);
rc.add(new StringRefAddr(key, value));
if (JPOXLogger.NAMING.isDebugEnabled())
{
JPOXLogger.NAMING.debug(LOCALISER_JDO.msg("012009", key, value));
}
}
else if (p.get(key) instanceof Integer)
{
String value = "" + p.get(key);
rc.add(new StringRefAddr(key, value));
if (JPOXLogger.NAMING.isDebugEnabled())
{
JPOXLogger.NAMING.debug(LOCALISER_JDO.msg("012009", key, value));
}
}
else if (p.get(key) instanceof Boolean)
{
String value = (((Boolean)p.get(key)).booleanValue() ? "true" : "false");
rc.add(new StringRefAddr(key, value));
if (JPOXLogger.NAMING.isDebugEnabled())
{
JPOXLogger.NAMING.debug(LOCALISER_JDO.msg("012009", key, value));
}
}