Examples of ResourceManager


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

    }

    try
    {
      final RootXmlReadHandler rootHandler = getRootHandler();
      final ResourceManager resourceManager = rootHandler.getResourceManager();
      final ResourceKey source = rootHandler.getSource();

      final HashMap map = new HashMap();
      final String[] names = rootHandler.getHelperObjectNames();
      for (int i = 0; i < names.length; i++)
      {
        final String name = names[i];
        final FactoryParameterKey key = new FactoryParameterKey(name);
        map.put(key, rootHandler.getHelperObject(name));
      }
      map.put(new FactoryParameterKey(ReportParserUtil.INCLUDE_PARSING_KEY), ReportParserUtil.INCLUDE_PARSING_VALUE);

      final ResourceKey target = resourceManager.deriveKey(source, file, map);
      final DependencyCollector dc = rootHandler.getDependencyCollector();

      final Object maybeReport = getRootHandler().getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);
      if (maybeReport == null)
      {
        throw new ParseException("Illegal State: No valid report", getRootHandler().getDocumentLocator());
      }

      final Class targetType;
      if (maybeReport instanceof SubReport)
      {
        targetType = SubReport.class;
      }
      else if (maybeReport instanceof MasterReport)
      {
        targetType = MasterReport.class;
      }
      else
      {
        throw new ParseException("Illegal State: No valid report", getRootHandler().getDocumentLocator());
      }

      final Resource resource = resourceManager.create(target, rootHandler.getContext(), targetType);
      dc.add(resource);

    }
    catch (ResourceKeyCreationException e)
    {
View Full Code Here

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

      report.setAttribute(AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.FILEFORMAT, "unified-fileformat");

      final ResourceKey key = getRootHandler().getSource();
      if (key.getParent() != null)
      {
        final ResourceManager resourceManager = getRootHandler().getResourceManager();
        try
        {
          final Resource bundleData = resourceManager.create(key.getParent(), null, DocumentBundle.class);
          report.setBundle((DocumentBundle) bundleData.getResource());
        }
        catch (ResourceException e)
        {
          getRootHandler().warning(new SAXParseException
View Full Code Here

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

    this(configuration, outputStream, PdfOutputProcessor.createResourceManager());
  }

  private static ResourceManager createResourceManager()
  {
    final ResourceManager resourceManager = new ResourceManager();
    resourceManager.registerDefaults();
    return resourceManager;

  }
View Full Code Here

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

   */
  public ResourceManager getResourceManager()
  {
    if (resourceManager == null)
    {
      resourceManager = new ResourceManager();
      resourceManager.registerDefaults();
      updateResourceBundleFactory();
    }
    return resourceManager;
  }
View Full Code Here

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

        {
          // Insert the DocumentBundle's ResourceManager as the MasterReports resource manager
          log.debug("DocumentBundle change detected - changing the ResourceManager for the MasterReport");
          final MasterReport report = (MasterReport) event.getElement();
          final DocumentBundle newDocumentBundle = (DocumentBundle) value;
          final ResourceManager resourceManager = newDocumentBundle.getResourceManager();
          report.setResourceManager(resourceManager);
        }
        else
        {
          log.warn("Could not replace the ResourceKey on a DocumentBundle change - the element is not a MasterReport");
View Full Code Here

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

    {
      throw new NullPointerException("Error: Could not find the report-preprocessor meta-data description file");
    }
    try
    {
      final ResourceManager resourceManager = new ResourceManager();
      resourceManager.registerDefaults();
      final Resource resource = resourceManager.createDirectly(expressionMetaSource,
          ReportPreProcessorMetaDataCollection.class);
      final ReportPreProcessorMetaDataCollection typeCollection = (ReportPreProcessorMetaDataCollection) resource.getResource();
      final ReportPreProcessorMetaData[] types = typeCollection.getReportPreProcessorMetaData();
      for (int i = 0; i < types.length; i++)
      {
View Full Code Here

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

    this(reportSchemaDefinition, context, createDefaultResourceManager());
  }

  private static ResourceManager createDefaultResourceManager()
  {
    final ResourceManager resourceManager = new ResourceManager();
    resourceManager.registerDefaults();
    return resourceManager;
  }
View Full Code Here

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

    if (metaDataSource == null)
    {
      throw new NullPointerException("Error: Could not find the element meta-data description file");
    }

    final ResourceManager resourceManager = new ResourceManager();
    resourceManager.registerDefaults();
    try
    {
      final Resource resource = resourceManager.createDirectly(metaDataSource, ElementTypeCollection.class);
      final ElementTypeCollection typeCollection = (ElementTypeCollection) resource.getResource();
      final ElementMetaData[] types = typeCollection.getElementTypes();
      for (int i = 0; i < types.length; i++)
      {
        final ElementMetaData metaData = types[i];
View Full Code Here

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

    {
      throw new NullPointerException("Error: Could not find the expression meta-data description file");
    }
    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++)
      {
View Full Code Here

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

      {
        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
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.