Package org.pentaho.reporting.libraries.resourceloader

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


      final ClassLoader classloader = this.getClass().getClassLoader();
      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();
    }
    return null;
View Full Code Here


          element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NULL_VALUE));
    }

    try
    {
      final ResourceManager resourceManager = runtime.getProcessingContext().getResourceManager();
      final ResourceKey chartKey;
      if (value instanceof String)
      {
        chartKey = resourceManager.deriveKey(runtime.getProcessingContext().getContentBase(), (String) value);
      }
      else
      {
        chartKey = resourceManager.createKey(value);
      }
     
      return null;
    }
    catch (ResourceException e)
View Full Code Here

      throw new ReportDefinitionException("ReportDefinition Source is invalid");
    }

    try
    {
      ResourceManager manager = new ResourceManager();
      manager.registerDefaults();
      Resource res = manager.createDirectly(reportFile, MasterReport.class);
      return (MasterReport) res.getResource();
    }
    catch (Exception e)
    {
      throw new ReportDefinitionException("Parsing failed", e);
View Full Code Here

      throw new ReportDefinitionException("ReportDefinition Source is invalid");
    }

    try
    {
      ResourceManager manager = new ResourceManager();
      manager.registerDefaults();
      Resource res = manager.createDirectly(in, MasterReport.class);
      return (MasterReport) res.getResource();
    }
    catch (Exception e)
    {
      throw new ReportDefinitionException("Parsing failed", e);
View Full Code Here

      throw new ReportDefinitionException("ReportDefinition Source is invalid");
    }

    try
    {
      ResourceManager manager = new ResourceManager();
      manager.registerDefaults();
      Resource res = manager.createDirectly(in, MasterReport.class);
      return (MasterReport) res.getResource();
    }
    catch (Exception e)
    {
      throw new ReportDefinitionException("Parsing failed", e);
View Full Code Here

  public MasterReport createReport() throws ReportDefinitionException
  {
    try
    {
      final ResourceManager resourceManager = new ResourceManager();
      resourceManager.registerDefaults();
      final Resource directly = resourceManager.createDirectly(getReportDefinitionSource(), MasterReport.class);
      return (MasterReport) directly.getResource();
    }
    catch (Exception rde)
    {
      throw new ReportDefinitionException("Failed", rde);
View Full Code Here

  public MasterReport createReport() throws ReportDefinitionException
  {
    try
    {
      final ResourceManager resourceManager = new ResourceManager();
      resourceManager.registerDefaults();
      final Resource directly = resourceManager.createDirectly(getReportDefinitionSource(), MasterReport.class);
      return (MasterReport) directly.getResource();
    }
    catch (Exception rde)
    {
      throw new ReportDefinitionException("Failed", rde);
View Full Code Here

    }

    try
    {
      final ResourceKey contentBase = runtime.getProcessingContext().getContentBase();
      final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
      final ResourceKey key;
      if (value instanceof ResourceKey)
      {
        key = (ResourceKey) value;
      }
      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 != null)
        {
          final ResourceKey baseKey = resManager.createKey(baseURL);
          key = resManager.deriveKey(baseKey, (String) value);
        }
        else
        {
          key = resManager.deriveKey(contentBase, (String) value);
        }
      }
      else
      {
        key = resManager.createKey(value);
      }
      if (key == null)
      {
        return null;
      }

      Class target;
      Object targetRaw = element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.TARGET_TYPE);
      if (targetRaw instanceof String)
      {
        final ClassLoader loader = ObjectUtilities.getClassLoader(ExternalElementType.class);
        target = Class.forName((String) targetRaw, false, loader);

        if (target == null)
        {
          return null;
        }
      }
      else
      {
        target = SubReport.class;
      }

      final Resource resource = resManager.create(key, contentBase, target);
      final Object resourceContent = resource.getResource();
      if (resourceContent instanceof Element)
      {
        return resourceContent;
      }
View Full Code Here

      return bundle;
    }

    if (manager == null)
    {
      manager = new ResourceManager();
      manager.registerDefaults();
    }

    if (baseKey != null)
    {
View Full Code Here

        resource = ContentType.class.getResource
            ("/org/pentaho/reporting/engine/classic/core/metadata/icons/image_50.png");
      }
      if (resource != null)
      {
        final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
        final Resource loadedResource = resManager.createDirectly(resource, Image.class);
        final Image image = (Image) loadedResource.getResource();
        return new ReportDrawableImage(image);
      }
    }
    catch (Exception e)
View Full Code Here

TOP

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

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.