final Map factoryKeys)
throws ResourceKeyCreationException
{
if (isSupportedKey(parent) == false)
{
throw new ResourceKeyCreationException("Assertation: Unsupported parent key type");
}
try
{
final File target;
if (path != null)
{
final File parentResource = (File) parent.getIdentifier();
target = new File(parentResource.getCanonicalFile().getParentFile(), path);
if (target.exists() == false || target.isFile() == false)
{
throw new ResourceKeyCreationException("Malformed value: " + path + " (" + target + ')');
}
}
else
{
target = (File) parent.getIdentifier();
}
final Map map;
if (factoryKeys != null)
{
map = new HashMap();
map.putAll(parent.getFactoryParameters());
map.putAll(factoryKeys);
}
else
{
map = parent.getFactoryParameters();
}
return new ResourceKey(parent.getSchema(), target, map);
}
catch(IOException ioe)
{
throw new ResourceKeyCreationException("Failed to create key", ioe);
}
}