Package org.pentaho.reporting.libraries.resourceloader

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


    }
    try
    {
      final ResourceManager resourceManager = new ResourceManager();
      resourceManager.registerDefaults();
      final Resource resource = resourceManager.createDirectly(expressionMetaSource,
          ExpressionMetaDataCollection.class);
      final ExpressionMetaDataCollection typeCollection = (ExpressionMetaDataCollection) resource.getResource();
      final ExpressionMetaData[] types = typeCollection.getExpressionMetaData();
      for (int i = 0; i < types.length; i++)
      {
        final ExpressionMetaData metaData = types[i];
        if (metaData != null)
View Full Code Here


        return null;
      }
      try
      {
        final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
        final Resource resource = resManager.createDirectly(url, DrawableWrapper.class);
        return resource.getResource();
      }
      catch (ResourceException e)
      {
        if (DrawableLoadFilter.logger.isDebugEnabled())
        {
          DrawableLoadFilter.logger.debug("Error while loading the drawable from " + url, e);
        }
        else if (DrawableLoadFilter.logger.isWarnEnabled())
        {
          DrawableLoadFilter.logger.warn("Error while loading the drawable from " + url + ": " + e.getMessage());
        }
        failureCache.add(urlString);
        return null;
      }
    }
    else if (o instanceof byte[])
    {
      try
      {
        final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
        final Resource resource = resManager.createDirectly(o, DrawableWrapper.class);
        return resource.getResource();
      }
      catch (ResourceException e)
      {
        if (DrawableLoadFilter.logger.isDebugEnabled())
        {
          DrawableLoadFilter.logger.debug("Error while loading the drawable from byte[]", e);
        }
        else if (DrawableLoadFilter.logger.isWarnEnabled())
        {
          DrawableLoadFilter.logger.warn("Error while loading the drawable from byte[]: " + e.getMessage());
        }
        return null;
      }
    }
    else if (o instanceof Blob)
    {
      try
      {
        final Blob b = (Blob) o;
        final byte[] data = b.getBytes(1, (int) b.length());
        final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
        final Resource resource = resManager.createDirectly(data, DrawableWrapper.class);
        return resource.getResource();
      }
      catch (Exception e)
      {
        if (DrawableLoadFilter.logger.isDebugEnabled())
        {
View Full Code Here

      final Object sourceKey = configuration.getConfigProperty((String) sources.next());
      try
      {
        logger.debug ("Loading data-schema " + sourceKey);
        final Resource resource = manager.createDirectly(sourceKey, DataSchemaDefinition.class);
        final DataSchemaDefinition fromResource = (DataSchemaDefinition) resource.getResource();
        definition.merge(fromResource);
      }
      catch (ResourceKeyCreationException e)
      {
        // silently ignored .. the key was invalid
View Full Code Here

    final DebugExpressionRuntime runtime = new DebugExpressionRuntime(new DefaultTableModel(), 0, processingContext);

    final URL target = LineBreakTest.class.getResource("linebreak-test.xml"); //$NON-NLS-1$
    final ResourceManager rm = new ResourceManager();
    rm.registerDefaults();
    final Resource directly = rm.createDirectly(target, MasterReport.class);
    final MasterReport report = (MasterReport) directly.getResource();

    final DebugRenderer debugLayoutSystem = new DebugRenderer();
    debugLayoutSystem.startReport(report);
    debugLayoutSystem.startSection(Renderer.TYPE_NORMALFLOW);
View Full Code Here

    }
    try
    {
      final ResourceManager resourceManager = new ResourceManager();
      resourceManager.registerDefaults();
      final Resource resource = resourceManager.createDirectly(dataFactoryMetaSource,
          DataFactoryMetaDataCollection.class);
      final DataFactoryMetaDataCollection typeCollection = (DataFactoryMetaDataCollection) resource.getResource();
      final DataFactoryMetaData[] types = typeCollection.getFactoryMetaData();
      for (int i = 0; i < types.length; i++)
      {
        final DataFactoryMetaData metaData = types[i];
        if (metaData != null)
View Full Code Here

      final URL reportDefinitionURL = classloader.getResource("org/pentaho/reporting/engine/classic/samples/Sample1.prpt");

      // Parse the report file
      final ResourceManager resourceManager = new ResourceManager();
      resourceManager.registerDefaults();
      final Resource directly = resourceManager.createDirectly(reportDefinitionURL, MasterReport.class);
      return (MasterReport) directly.getResource();
    }
    catch (ResourceException e)
    {
      e.printStackTrace();
    }
View Full Code Here

    if (o instanceof byte[])
    {
      try
      {
        final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
        final Resource resource = resManager.createDirectly(o, Image.class);
        return new DefaultImageReference(resource);
      }
      catch (ResourceException e)
      {
        if (ImageLoadFilter.logger.isDebugEnabled())
        {
          ImageLoadFilter.logger.debug("Error while loading the image from a blob", e);
        }
        else if (ImageLoadFilter.logger.isWarnEnabled())
        {
          ImageLoadFilter.logger.warn("Error while loading the image from a blob: " + e.getMessage());
        }
        return null;
      }
    }
    else if (o instanceof Blob)
    {
      try
      {
        final Blob b = (Blob) o;
        final byte[] data = IOUtils.getInstance().readBlob(b);
        final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
        final Resource resource = resManager.createDirectly(data, Image.class);
        return new DefaultImageReference(resource);
      }
      catch (Exception e)
      {
        if (ImageLoadFilter.logger.isDebugEnabled())
        {
          ImageLoadFilter.logger.debug("Error while loading the image from a blob", e);
        }
        else if (ImageLoadFilter.logger.isWarnEnabled())
        {
          ImageLoadFilter.logger.warn("Error while loading the image from a blob: " + e.getMessage());
        }
        return null;
      }
    }
    else if (o instanceof URL)
    {
      // a valid url is found, lookup the url in the cache, maybe the image is loaded and
      // still there.
      final URL url = (URL) o;
      final String urlText = String.valueOf(url);
      if (failureCache.contains(urlText))
      {
        return null;
      }
      try
      {
        final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
        final Resource resource = resManager.createDirectly(url, Image.class);
        return new DefaultImageReference(resource);
      }
      catch (ResourceException e)
      {
        if (ImageLoadFilter.logger.isDebugEnabled())
View Full Code Here

        continue;
      }
      try
      {
        final ResourceKey resourceKey = resourceManager.deriveKey(context, href);
        final Resource resource = resourceManager.create(resourceKey, null, GlobalMetaDefinition.class);
        globalMetaDefinition.merge((GlobalMetaDefinition) resource.getResource());
      }
      catch (ResourceException e)
      {
        logger.warn("Failed to parse included global definitions: " + getLocator(), e);
      }
View Full Code Here

    final ResourceManager resourceManager = getRootHandler().getResourceManager();
    final ResourceKey context = getRootHandler().getContext();
    try
    {
      final ResourceKey resourceKey = resourceManager.deriveKey(context, href);
      final Resource resource = resourceManager.create(resourceKey, null, GlobalMetaDefinition.class);
      result = (GlobalMetaDefinition) resource.getResource();
    }
    catch (ResourceException e)
    {
      throw new ParseException("Failed to parse included global definitions", e, getLocator());
    }
View Full Code Here

          .getResource("org/pentaho/reporting/engine/classic/samples/Sample1.prpt");

      // Parse the report file
      final ResourceManager resourceManager = new ResourceManager();
      resourceManager.registerDefaults();
      final Resource directly = resourceManager.createDirectly(reportDefinitionURL, MasterReport.class);
      return (MasterReport) directly.getResource();
    } catch (ResourceException e) {
      e.printStackTrace();
    }
    return null;
  }
View Full Code Here

TOP

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

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.