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

static ResourceKeyData org::pentaho::reporting::libraries::resourceloader::ResourceKeyUtils::parse ( final String  resourceKeyString ) throws ResourceKeyCreationException [inline, static]

Parses the string version of the Resource Key into the components

Returns:

Definition at line 71 of file ResourceKeyUtils.java.

References parseFactoryParametersFromString().

Referenced by org::pentaho::reporting::libraries::resourceloader::loader::URLResourceLoader::deserialize(), org::pentaho::reporting::libraries::resourceloader::loader::resource::ClassloaderResourceLoader::deserialize(), org::pentaho::reporting::libraries::resourceloader::loader::raw::RawResourceLoader::deserialize(), and org::pentaho::reporting::libraries::resourceloader::loader::file::FileResourceLoader::deserialize().

  {
    if (resourceKeyString == null)
    {
      throw new IllegalArgumentException("Source string can not be null");
    }
    if (!resourceKeyString.startsWith(SERIALIZATION_PREFIX))
    {
      throw new ResourceKeyCreationException("The source string does not start with the string ["
          + SERIALIZATION_PREFIX + "]");
    }

    final CSVTokenizer tokenizer = new CSVTokenizer(resourceKeyString, DELIMITER, CSVTokenizer.DOUBLE_QUATE, false);
    if (tokenizer.hasMoreElements() == false)
    {
      throw new ResourceKeyCreationException("Schema is missing");
    }
    final String rawSchema = tokenizer.nextToken();
    if (rawSchema.startsWith(SERIALIZATION_PREFIX) == false)
    {
      throw new ResourceKeyCreationException("Prefix is wrong");
    }
    final String schema = rawSchema.substring(SERIALIZATION_PREFIX.length());

    if (tokenizer.hasMoreElements() == false)
    {
      throw new ResourceKeyCreationException("Identifier is missing");
    }
    final String id = tokenizer.nextToken();
    final Map parameters;
    if (tokenizer.hasMoreElements())
    {
      parameters = parseFactoryParametersFromString(tokenizer.nextToken());
    }
    else
    {
      parameters = null;
    }

    // The 1st component is the schema... the 2nd is the identifier... the 3rd is the factory parameters (optional)
    return new ResourceKeyData(schema, id, parameters);
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index