Package org.pentaho.reporting.libraries.resourceloader

Examples of org.pentaho.reporting.libraries.resourceloader.FactoryParameterKey


    assertNotNull(key1);
    assertTrue(key1.getIdentifier() instanceof File);
    assertEquals(FileResourceLoader.class.getName(), key1.getSchema());
    assertEquals(tempFile.getCanonicalPath(), ((File)key1.getIdentifier()).getCanonicalPath());
    assertEquals(2, key1.getFactoryParameters().size());
    assertTrue(!key1.getFactoryParameters().containsKey(new FactoryParameterKey("invalid")));
    assertTrue(key1.getFactoryParameters().containsKey(new FactoryParameterKey("null")));
    assertNull(key1.getFactoryParameters().get(new FactoryParameterKey("null")));
    assertEquals("that", key1.getFactoryParameters().get(new FactoryParameterKey("this")));
  }
View Full Code Here


    final FileResourceLoader fileResourceLoader = new FileResourceLoader();
    final Map<ParameterKey, Object> factoryParams = new HashMap<ParameterKey, Object>();
    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);
View Full Code Here

    assertTrue("Serialized version does not contain the correct schema information", serKey2.startsWith(DESERIALIZE_PREFIX));
    assertTrue("Serialized version should contain the identifier intact", serKey2.endsWith(";res://org/pentaho/reporting/libraries/resourceloader/test2.properties"));

    // 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" +
View Full Code Here

    assertTrue("Serialized version does not contain the correct schema information", serializedVersion //$NON-NLS-1$
        .startsWith(STRING_SERIALIZATION_PREFIX + resourceLoader.getClass().getName() + ';'));
    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

    assertNotNull(key1);
    assertTrue(key1.getIdentifier() instanceof URL);
    assertEquals(URLResourceLoader.class.getName(), key1.getSchema());
    assertEquals(new URL(URL1), key1.getIdentifier());
    assertEquals(2, key1.getFactoryParameters().size());
    assertTrue(!key1.getFactoryParameters().containsKey(new FactoryParameterKey("invalid")));
    assertTrue(key1.getFactoryParameters().containsKey(new FactoryParameterKey("null")));
    assertNull(key1.getFactoryParameters().get(new FactoryParameterKey("null")));
    assertEquals("that", key1.getFactoryParameters().get(new FactoryParameterKey("this")));
  }
View Full Code Here

    final URLResourceLoader resourceLoader = new URLResourceLoader();
    final Map<ParameterKey, Object> factoryParams = new HashMap<ParameterKey, Object>();
    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);
View Full Code Here

      final FileRepository repository = new FileRepository(directory);
      final String bundleType = BundleUtilities.getBundleType(repository);
      final String bundleMapping = BundleUtilities.getBundleMapping(bundleType);

      final HashMap<FactoryParameterKey, Object> map = new HashMap<FactoryParameterKey, Object>();
      map.put(new FactoryParameterKey("repository"), repository);
      map.put(new FactoryParameterKey("repository-loader"), this);

      final ResourceKey mainKey = new ResourceKey
          (key, DirectoryResourceBundleLoader.class.getName(), bundleMapping, map);

      return new RepositoryResourceBundleData(key, repository, mainKey, true);
View Full Code Here

        ("org.pentaho.reporting.libraries.docbundle.bundleloader.directory.StrictKeyCheck", "true")))
    {
      try
      {
        final FileRepository repository = (FileRepository)
            parent.getFactoryParameters().get(new FactoryParameterKey("repository"));
        if (RepositoryUtilities.isExistsEntity(repository, RepositoryUtilities.split(entry, "/")) == false)
        {
          throw new ResourceKeyCreationException("The key does not exist: " + entry);
        }
      }
View Full Code Here

        final ZipReadRepository zipReadRepository = new ZipReadRepository(stream);
        final String bundleType = BundleUtilities.getBundleType(zipReadRepository);
        final String bundleMapping = BundleUtilities.getBundleMapping(bundleType);

        final HashMap<FactoryParameterKey,Object> map = new HashMap<FactoryParameterKey,Object>();
        map.put(new FactoryParameterKey("repository"), zipReadRepository);
        map.put(new FactoryParameterKey("repository-loader"), this);

        final ResourceKey mainKey = new ResourceKey(key, ZipResourceBundleLoader.class.getName(), bundleMapping, map);
        return new RepositoryResourceBundleData(key, zipReadRepository, mainKey, false);
      }
      finally
View Full Code Here

        ("org.pentaho.reporting.libraries.docbundle.bundleloader.zip.StrictKeyCheck", "true")))
    {
      try
      {
        final ZipReadRepository repository = (ZipReadRepository)
            parent.getFactoryParameters().get(new FactoryParameterKey("repository"));
        if (RepositoryUtilities.isExistsEntity(repository, RepositoryUtilities.split(entry, "/")) == false)
        {
          throw new ResourceKeyCreationException("The key does not exist: " + entry);
        }
      }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.resourceloader.FactoryParameterKey

Copyright © 2018 www.massapicom. 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.