Package org.pentaho.reporting.libraries.resourceloader

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


          key = resManager.deriveKey(contentBase, (String) value);
        }
      }
      else
      {
        key = resManager.createKey(value);
      }
      if (key == null)
      {
        return null;
      }
View Full Code Here


      }
      else if (value instanceof Blob)
      {
        final Blob b = (Blob) value;
        final byte[] data = IOUtils.getInstance().readBlob(b);
        key = resManager.createKey(data);
      }
      else if (value instanceof String)
      {
        final Object baseURL = element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.CONTENT_BASE);
        if (baseURL instanceof String)
View Full Code Here

          key = createKeyFromString(resManager, baseKey, (String) value);
        }
        else if (baseURL != null)
        {
          // if a base-url object is given, we assume that it is indeed valid.
          final ResourceKey baseKey = resManager.createKey(baseURL);
          key = createKeyFromString(resManager, baseKey, (String) value);
        }
        else
        {
          key = createKeyFromString(resManager, contentBase, (String) value);
View Full Code Here

          key = createKeyFromString(resManager, contentBase, (String) value);
        }
      }
      else
      {
        key = resManager.createKey(value);
      }
      if (key == null)
      {
        return null;
      }
View Full Code Here

    {
      CSSParserContext.getContext().setDefaultNamespace(defaultNamespaceURI);
      final ResourceKey key;
      if (source == null)
      {
        key = manager.createKey(uri);
      }
      else
      {
        key = manager.deriveKey(source, uri);
      }
View Full Code Here

    }

    // Test with a resource key instead of a file key
    try
    {
      key = manager.createKey("res://org/pentaho/reporting/libraries/resourceloader/test1.properties"); //$NON-NLS-1$
      serializedVersion = fileResourceLoader.serialize(key, key);
      fail("The resource key should not handles by the file resource loader"); //$NON-NLS-1$
    }
    catch (IllegalArgumentException iae)
    {
View Full Code Here

    {
      // success
    }

    // Create a key from the temp file
    key = manager.createKey(tempFile);
    serializedVersion = fileResourceLoader.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

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

    // Create a key with factory parameters
    factoryParameters.put(new FactoryParameterKey("this"), "that");
    factoryParameters.put(new FactoryParameterKey("null"), null);
    key = manager.createKey(tempFile, factoryParameters);
    serializedVersion = fileResourceLoader.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));
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(tempFile, factoryParams);
   
    final String serializedVersion = fileResourceLoader.serialize(null, originalKey);
    final ResourceKey duplicateKey = fileResourceLoader.deserialize(null, serializedVersion);
    assertNotNull(duplicateKey);
    assertTrue(originalKey.equals(duplicateKey));
View Full Code Here

   
    // Test failure - not a Classloader resource key
    try
    {
      final File tempFile = File.createTempFile("junit-test", ".tmp");
      final ResourceKey tempKey = manager.createKey(tempFile);
      resourceLoader.serialize(null, tempKey);
      fail("The Classloader Resource Loader should fail when handling a non-classloader resource key");
    }
    catch(IllegalArgumentException iae)
    {
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.