Package org.pentaho.reporting.libraries.resourceloader

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


    if (file.isDirectory())
    {
      throw new IOException("File is not a directory.");
    }
    final File contentBase = file.getCanonicalFile().getParentFile();
    final ResourceManager resourceManager = new ResourceManager();
    resourceManager.registerDefaults();

    final ResourceKey contextKey = resourceManager.createKey(contentBase);

    // Build the main key. That key also contains all context/parse-time
    // parameters as they will influence the resulting report. It is not
    // wise to keep caching independent from that.
    final HashMap map = new HashMap();
    final Iterator it = this.helperObjects.keySet().iterator();
    while (it.hasNext())
    {
      final String name = (String) it.next();
      map.put(new FactoryParameterKey(name), helperObjects.get(name));
    }

    final ResourceKey key = resourceManager.createKey(file, map);
    final Resource resource = resourceManager.create(key, contextKey, MasterReport.class);
    return (MasterReport) resource.getResource();
  }
View Full Code Here


      return parseReportDirectly(input, contentBase);
    }

    final byte[] bytes = extractData(input);
    final ResourceManager resourceManager = new ResourceManager();
    resourceManager.registerDefaults();

    final ResourceKey contextKey;
    if (contentBase != null)
    {
      contextKey = resourceManager.createKey(contentBase);
    }
    else
    {
      contextKey = null;
    }
    final HashMap map = new HashMap();

    final Iterator it = this.helperObjects.keySet().iterator();
    while (it.hasNext())
    {
      final String name = (String) it.next();
      map.put(new FactoryParameterKey(name), helperObjects.get(name));
    }

    final ResourceKey key = resourceManager.createKey(bytes, map);
    final Resource resource = resourceManager.create(key, contextKey, MasterReport.class);
    return (MasterReport) resource.getResource();
  }
View Full Code Here

  }

  private MasterReport parseReportDirectly(final InputSource input, final URL contentBase)
      throws ResourceKeyCreationException, ResourceCreationException, ResourceLoadingException
  {
    final ResourceManager manager = new ResourceManager();
    manager.registerDefaults();

    final HashMap map = new HashMap();

    final Iterator it = this.helperObjects.keySet().iterator();
    while (it.hasNext())
    {
      final String name = (String) it.next();
      map.put(new FactoryParameterKey(name), helperObjects.get(name));
    }

    final MasterReportXmlResourceFactory resourceFactory = new MasterReportXmlResourceFactory();
    resourceFactory.initializeDefaults();
    if (contentBase != null)
    {
      return (MasterReport) resourceFactory.parseDirectly(manager, input, manager.createKey(contentBase), map);
    }
    else
    {
      return (MasterReport) resourceFactory.parseDirectly(manager, input, null, map);
    }
View Full Code Here

                                  final ResourceKey contextKey)
      throws ResourceException
  {
    if (manager == null)
    {
      manager = new ResourceManager();
      manager.registerDefaults();
    }

    final HashMap map = new HashMap(input.getFactoryParameters());
    final Iterator it = this.helperObjects.keySet().iterator();
View Full Code Here

    }

    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

      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

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

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

  }
View Full Code Here

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

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

    {
      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

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.