{
objectId = orb.getPOACurrent().get_object_id();
}
catch (org.omg.PortableServer.CurrentPackage.NoContext e)
{
throw new POAInternalError("error: not in invocation context (servant_to_reference)");
}
return getReference(objectId,
servant._all_interfaces(this, objectId)[0],
true);
}
if (isRetain())
{
if (isUniqueId())
{
/* the object reference encapsulating the information
used to activate the servant is returned */
objectId = aom.getObjectId(servant);
if (objectId != null)
{
return getReference(objectId, servant._all_interfaces(this, objectId)[0], true);
}
}
if (isImplicitActivation() && (isMultipleId() || !aom.contains(servant)) )
{
objectId = generateObjectId();
/* activate the servant using a generated objectId and
the intfRepId associated with the servant
and a corresponding object reference is returned */
try
{
aom.add(objectId, servant);
}
catch (ObjectAlreadyActive e)
{
throw new POAInternalError("error: object already active (servant_to_reference)");
}
catch (ServantAlreadyActive e)
{
/* it's ok, another one was faster with activation
(only occurs if unique_id is set) */