Examples of ResourceCreationException


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

      final XMLReader reader = parser.getXMLReader();
      final XmlFactoryModule[] rootHandlers = getModules();
      if (rootHandlers.length == 0)
      {
        throw new ResourceCreationException("There are no root-handlers registered for the factory for type " + getFactoryType());
      }

      final ResourceDataInputSource input = new ResourceDataInputSource(data, manager);

      final ResourceKey contextKey;
      final long version;
      final ResourceKey targetKey = data.getKey();
      if (context == null)
      {
        contextKey = targetKey;
        version = data.getVersion(manager);
      }
      else
      {
        contextKey = context;
        version = -1;
      }

      final MultiplexRootElementHandler handler =
          new MultiplexRootElementHandler(manager, targetKey,
              contextKey, version, rootHandlers);

      final DefaultConfiguration parserConfiguration = handler.getParserConfiguration();
      final URL value = manager.toURL(contextKey);
      if (value != null)
      {
        parserConfiguration.setConfigProperty(CONTENTBASE_KEY, value.toExternalForm());
      }

      configureReader(reader, handler);
      reader.setContentHandler(handler);
      reader.setDTDHandler(handler);
      reader.setEntityResolver(handler.getEntityResolver());
      reader.setErrorHandler(getErrorHandler());

      final Map parameters = targetKey.getFactoryParameters();
      final Iterator it = parameters.keySet().iterator();
      while (it.hasNext())
      {
        final Object o = it.next();
        if (o instanceof FactoryParameterKey)
        {
          final FactoryParameterKey fpk = (FactoryParameterKey) o;
          handler.setHelperObject(fpk.getName(), parameters.get(fpk));
        }
      }

      reader.parse(input);

      final Object createdProduct = finishResult
          (handler.getResult(), manager, data, contextKey);
      handler.getDependencyCollector().add(targetKey, data.getVersion(manager));
      return createResource(targetKey, handler, createdProduct);
    }
    catch (ParserConfigurationException e)
    {
      throw new ResourceCreationException
          ("Unable to initialize the XML-Parser", e);
    }
    catch (SAXException e)
    {
      throw new ResourceCreationException("Unable to parse the document: " + data.getKey(), e);
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Unable to read the stream from document: " + data.getKey(), e);
    }
View Full Code Here

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

      return finishResult(handler.getResult(), manager, new RawResourceData(targetKey), contextKey);
    }
    catch (ParserConfigurationException e)
    {
      throw new ResourceCreationException
          ("Unable to initialize the XML-Parser", e);
    }
    catch (SAXException e)
    {
      throw new ResourceCreationException("Unable to parse the document", e);
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Unable to read the stream", e);
    }
View Full Code Here

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

    {
      throw e;
    }
    catch (Exception e)
    {
      throw new ResourceCreationException("Failed to load or check content", e);
    }
  }
View Full Code Here

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

  public Resource create(final ResourceManager caller, final ResourceData data, final ResourceKey context) throws ResourceCreationException, ResourceLoadingException
  {
    if (parent == null)
    {
      throw new ResourceCreationException("Cannot create resource: Pixie library is not available.");
    }
    return parent.create(caller, data, context);
  }
View Full Code Here

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

    {
      image = createImage(resource);
    }
    catch (IOException e)
    {
      throw new ResourceCreationException("Failed to load the image.", e);
    }
   
    if (image == null)
    {
      throw new ResourceCreationException("Failed to load the image. ImageIO#read returned null");
    }

    return new SimpleResource(data.getKey(), image, version);
  }
View Full Code Here

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

  public Resource create(final ResourceManager caller, final ResourceData data, final ResourceKey context) throws ResourceCreationException, ResourceLoadingException
  {
    if (parent == null)
    {
      throw new ResourceCreationException("Cannot create resource: Pixie library is not available.");
    }
    return parent.create(caller, data, context);
  }
View Full Code Here

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

  public Resource create(final ResourceManager caller, final ResourceData data, final ResourceKey context) throws ResourceCreationException, ResourceLoadingException
  {
    if (parent == null)
    {
      throw new ResourceCreationException("Cannot create resource: Batik libraries are not available.");
    }
    return parent.create(caller, data, context);
  }
View Full Code Here

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

  public Resource create(final ResourceManager caller, final ResourceData data, final ResourceKey context) throws ResourceCreationException, ResourceLoadingException
  {
    if (parent == null)
    {
      throw new ResourceCreationException("Cannot create resource: Batik libraries are not available.");
    }
    return parent.create(caller, data, context);
  }
View Full Code Here

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

              (data.getKey(), dependencies, handler.getStyleSheet());
      return cr;
    }
    catch (CSSParserInstantiationException e)
    {
      throw new ResourceCreationException("Failed to parse the stylesheet.");
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Failed to load the stylesheet.");
    }
View Full Code Here

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

      CSSParserContext.getContext().destroy();

      final CSSDeclarationRule styleRule = handler.getStyleRule();
      if (styleRule == null)
      {
        throw new ResourceCreationException("Damn, the style rule is null");
      }
      return new CompoundResource
              (data.getKey(), dependencies, styleRule);
    }
    catch (CSSParserInstantiationException e)
    {
      throw new ResourceCreationException("Failed to parse the stylesheet.");
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Failed to load the stylesheet.");
    }
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.