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

ResourceKey org::pentaho::reporting::libraries::resourceloader::loader::URLResourceLoader::createKey ( final Object  value,
final Map  factoryKeys 
) throws ResourceKeyCreationException [inline]

Creates a new resource key from the given object and the factory keys.

Parameters:
value
factoryKeys
Returns:
the created key.
Exceptions:
org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationExceptionif creating the key failed.

Definition at line 74 of file URLResourceLoader.java.

Referenced by deserialize().

  {
    if (value instanceof URL)
    {
      return new ResourceKey(SCHEMA_NAME, value, factoryKeys);
    }
    if (value instanceof String)
    {
      final String valueString = (String) value;
      // the 'file' schema is defined to have double-slashes, but the JDK
      // ignores RFC 1738 in that case. So we have to check for these beasts
      // directly ..
      if (valueString.indexOf("://") >= 0 || valueString.startsWith("file:/"))
      {
        try
        {
          return new ResourceKey(SCHEMA_NAME, new URL(valueString), factoryKeys);

        }
        catch (MalformedURLException mfue)
        {
          // we dont take this easy!
          throw new ResourceKeyCreationException("Malformed value: " + value);
        }
      }
    }

    return null;
  }

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index