Logo Search packages:      
Sourcecode: libloader version File versions  Download package

ResourceKey org::jfree::resourceloader::loader::file::FileResourceLoader::deriveKey ( final ResourceKey  parent,
final String  path,
final Map  factoryKeys 
) throws ResourceKeyCreationException [inline]

Derives a new resource key from the given key. If neither a path nor new factory-keys are given, the parent key is returned.

Parameters:
parentthe parent
paththe derived path (can be null).
factoryKeysthe optional factory keys (can be null).
Returns:
the derived key.
Exceptions:
org.jfree.resourceloader.ResourceKeyCreationExceptionif the key cannot be derived for any reason.

Definition at line 125 of file FileResourceLoader.java.

References isSupportedKey().

  {
    if (isSupportedKey(parent) == false)
    {
      throw new ResourceKeyCreationException("Assertation: Unsupported parent key type");
    }

    final File target;
    if (path != null)
    {
      final File parentResource = (File) parent.getIdentifier();
      target = new File(parentResource.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);
  }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index