final AttributeMetaData data = getMetaData().getAttributeDescription(nameSpace, name);
if (data != null && (data.isTransient() == false))
{
if (attribute instanceof ResourceKey)
{
final ResourceKey key = (ResourceKey) attribute;
final ResourceKey parent = key.getParent();
if (AttributeNames.Core.NAMESPACE.equals(nameSpace) &&
(AttributeNames.Core.CONTENT_BASE.equals(name) || AttributeNames.Core.SOURCE.equals(name)))
{
if (parent != null)
{
// unwrap the content base attribute. After deserialization, the report assumes the bundle-location
// as content base, as the bundle will be gone.
if (isKeySerializable(parent))
{
stream.writeByte(0);
SerializerHelper.getInstance().writeObject(parent, stream);
}
else
{
stream.writeByte(1);
}
}
else
{
// great, the report was never part of a bundle. That makes life easier and the key should be
// safely serializable too.
if (isKeySerializable(key))
{
stream.writeByte(0);
SerializerHelper.getInstance().writeObject(key, stream);
}
else
{
stream.writeByte(1);
}
}
}
else
{
if ("Resource".equals(data.getValueRole()) || parent != null)
{
stream.writeByte(0);
// todo: Convert into a byte-array key;
try
{
final ResourceKey resourceKey =
ResourceKeyUtils.embedResourceInKey(locateResourceManager(), key, key.getFactoryParameters());
SerializerHelper.getInstance().writeObject(resourceKey, stream);
}
catch (ResourceException e)
{