Package org.pentaho.reporting.libraries.resourceloader

Examples of org.pentaho.reporting.libraries.resourceloader.ResourceManager.createKey()


      // success
    }

    // Create key
    final String key1source = "res://org/pentaho/reporting/libraries/resourceloader/test1.properties";
    final ResourceKey key1 = manager.createKey(key1source);
    assertNotNull(key1);

    // Serialize the key
    final String serKey1 = resourceLoader.serialize(null, key1);
    assertNotNull("The returned key should not be null", serKey1); //$NON-NLS-1$
View Full Code Here


    // Serialize a key with factory parameters
    final Map<ParameterKey, Object> factoryParams = new HashMap<ParameterKey, Object>();
    factoryParams.put(new FactoryParameterKey("this"), "that");
    factoryParams.put(new FactoryParameterKey("null"), null);
    final ResourceKey key3 = manager.createKey(key1source, factoryParams);
    assertNotNull(key3);

    final String serKey3 = resourceLoader.serialize(null, key3);
    assertEquals("resourcekey:org.pentaho.reporting.libraries.resourceloader" +
        ".loader.resource.ClassloaderResourceLoader;" +
View Full Code Here

    // Test with a file instead of a URL
    try
    {
      final File tempFile = File.createTempFile("unittest", "test");
      tempFile.deleteOnExit();
      key = manager.createKey(tempFile);
      serializedVersion = resourceLoader.serialize(key, key);
      fail("The resource key should not handled by the URL resource loader"); //$NON-NLS-1$
    }
    catch (IllegalArgumentException iae)
    {
View Full Code Here

    {
      // success
    }

    // Create a key from the temp file
    key = manager.createKey(new URL(URL1));
    serializedVersion = resourceLoader.serialize(key, key);
    assertNotNull("The returned key should not be null", key); //$NON-NLS-1$
    assertTrue("Serialized verison does not start with the correct header", serializedVersion //$NON-NLS-1$
        .startsWith(STRING_SERIALIZATION_PREFIX));
    assertTrue("Serialized version does not contain the correct schema information", serializedVersion //$NON-NLS-1$
View Full Code Here

    assertTrue("Serialized version should contain the filename", serializedVersion.endsWith(URL2)); //$NON-NLS-1$

    // Create a key with factory parameters
    factoryParameters.put(new FactoryParameterKey("this"), "that");
    factoryParameters.put(new FactoryParameterKey("null"), null);
    key = manager.createKey(new URL(URL1), factoryParameters);
    serializedVersion = resourceLoader.serialize(key, key);

    assertEquals("resourcekey:org.pentaho.reporting.libraries.resourceloader.loader.URLResourceLoader;" +
        "http://www.pentaho.com/index.html;\"\"\"f:this=that\"\":\"\"f:null=\"\"\"", serializedVersion);
  }
View Full Code Here

    final ResourceManager manager = new ResourceManager();
    manager.registerDefaults();

    factoryParams.put(new FactoryParameterKey("this"), "that");
    factoryParams.put(new FactoryParameterKey("null"), null);
    final ResourceKey originalKey = manager.createKey(URL1, factoryParams);

    final String serializedVersion = resourceLoader.serialize(null, originalKey);
    final ResourceKey duplicateKey = resourceLoader.deserialize(null, serializedVersion);
    assertNotNull(duplicateKey);
    assertTrue(originalKey.equals(duplicateKey));
View Full Code Here

    parameters.put(ClassicEngineFactoryParameters.ORIGINAL_VALUE, "c:\\invalid dir\\test.png");
    parameters.put(ClassicEngineFactoryParameters.MIME_TYPE, mimeType);
    parameters.put(ClassicEngineFactoryParameters.PATTERN, pattern);
    parameters.put(ClassicEngineFactoryParameters.EMBED, "true"); // NON-NLS
    // create an embedded key in here.
    return resMgr.createKey(bout.toByteArray(), parameters);
  }
}

// need parser fix: On PRD load, the resource-keys loaded must be made embedded-as-edited, and thus must
// be byte-arrays on the key with the bundle-key as parent.
View Full Code Here

      {
        final FontSource fr = (FontSource) fofam.getFontRecord(false, false);
        final ResourceManager resourceManager = new ResourceManager();
        resourceManager.registerDefaults();

        final ResourceKey fontSource = resourceManager.createKey(new File(fr.getFontSource()));
        final FontDataInputSource fs =
            new ResourceFontDataInputSource(resourceManager, fontSource);
        final TrueTypeFont ttf = new TrueTypeFont(fs);
        final NameTable nt = (NameTable) ttf.getTable(NameTable.TABLE_ID);
        //PostscriptInformationTable pst = ttf.getTable(PostscriptInformationTable.TABLE_ID);
View Full Code Here

  private ResourceKey createImageKey()
      throws IOException, ResourceKeyCreationException
  {
    final ResourceManager resMgr = new ResourceManager();
    resMgr.registerDefaults();
    return resMgr.createKey(new URL("http://127.0.0.1:65535/image.jpg"));
  }
}
View Full Code Here

      {
        key = (ResourceKey) value;
      }
      else if (baseKey == null)
      {
        key = manager.createKey(value);
      }
      else if (value instanceof String)
      {
        key = manager.deriveKey(baseKey, (String) value);
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.