Package org.pentaho.reporting.libraries.resourceloader

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


      return null;
    }

    try
    {
      final ResourceData resourceData = resourceManager.load(source);
      final String mimeType = queryMimeType(resourceData);
      if (isValidImage(mimeType))
      {
        // lets do some voodo ..
        final ContentItem item = dataLocation.createItem
            (dataNameGenerator.generateName(extractFilename(resourceData), mimeType));
        if (item.isWriteable())
        {
          item.setAttribute(LibRepositoryBoot.REPOSITORY_DOMAIN, LibRepositoryBoot.CONTENT_TYPE, mimeType);

          // write it out ..
          final InputStream stream = new BufferedInputStream(resourceData.getResourceAsStream(resourceManager));
          try
          {
            final OutputStream outputStream = new BufferedOutputStream(item.getOutputStream());
            try
            {
View Full Code Here


      {
        if (urlImage.isLoadable() && isSupportedImageFormat(url))
        {
          try
          {
            final ResourceData data = resourceManager.load(url);
            final byte[] imageData = data.getResource(resourceManager);
            final String mimeType = queryMimeType(imageData);
            final URL maybeRealURL = resourceManager.toURL(url);
            if (maybeRealURL != null)
            {
              final String originalFileName = IOUtils.getInstance().getFileName(maybeRealURL);
View Full Code Here

      // Embed the key into the document bundle
      String mimeType = (String) factoryParameters.get(ClassicEngineFactoryParameters.MIME_TYPE);
      final String originalValue = (String) factoryParameters.get(ClassicEngineFactoryParameters.ORIGINAL_VALUE);
      if (mimeType == null)
      {
        final ResourceData resourceData = report.getResourceManager().load(resourceKey);
        final Object originalMimeType = resourceData.getAttribute(ResourceData.CONTENT_TYPE);
        if (originalMimeType instanceof String)
        {
          mimeType = (String) originalMimeType;
        }
        else
View Full Code Here

        }
        else
        {
          try
          {
            final ResourceData data = resourceManager.load(url);
            // create the image
            return workbook.addPicture(data.getResource(resourceManager), format);
          }
          catch (final ResourceException re)
          {
            logger.info("Failed to load image from URL " + url, re)// NON-NLS
          }
View Full Code Here

      {
        throw new ScriptException("Unable to load script");
      }
      try
      {
        final ResourceData loadedResource = resourceManager.load(resourceKey);
        final byte[] resource = loadedResource.getResource(resourceManager);
        return eval(new String(resource, encoding), defaultScriptLanguage);
      }
      catch (ResourceLoadingException e)
      {
        throw new ScriptException(e);
View Full Code Here

    if (baseKey != null)
    {
      try
      {
        final ResourceKey resourceKey = manager.deriveKey(baseKey, propsName);
        final ResourceData resource = manager.load(resourceKey);

        final InputStream instream = resource.getResourceAsStream(manager);
        try
        {
          final LibLoaderResourceBundle resourceBundle = new LibLoaderResourceBundle(instream);
          successfulLoads.put(propsName, resourceBundle);
          return resourceBundle;
        }
        finally
        {
          instream.close();
        }
      }
      catch (Exception e)
      {
        // silently ignore ..
      }
    }

    try
    {
      // try to load the bundle via classpath ...
      final ResourceKey resourceKey = manager.createKey("res://" + propsName); // NON-NLS
      final ResourceData resource = manager.load(resourceKey);

      final InputStream instream = resource.getResourceAsStream(manager);
      try
      {
        final LibLoaderResourceBundle resourceBundle = new LibLoaderResourceBundle(instream);
        successfulLoads.put(propsName, resourceBundle);
        return resourceBundle;
View Full Code Here

      {
        instance = maybeImage;
      }
      else
      {
        final ResourceData data = resourceManager.load(resource);
        instance = com.lowagie.text.Image.getInstance(data.getResource(resourceManager));
        imageCache.put(resource, instance);
      }
      return instance;
    }
    catch (InvalidReportStateException re)
View Full Code Here

    }

    try
    {
      final ResourceManager resourceManager = getResourceManager();
      final ResourceData resource = load();
      if (xpath.isLegacyQuery())
      {
        return new LegacyXPathTableModel(resource, resourceManager, xpath.getXpathExpression(), parameters, queryLimitVal);
      }
      return new XPathTableModel(resource, resourceManager, xpath.getXpathExpression(), parameters, queryLimitVal);
View Full Code Here

  public InputStream getResourceAsStream(final ResourceManager caller) throws ResourceLoadingException
  {
    // again, this is going to hurt the performance.
    final ResourceKey parentKey = key.getParent();
    final ResourceData data = caller.load(parentKey);

    final ZipInputStream zin = new ZipInputStream(data.getResourceAsStream(caller));
    try
    {
      try
      {
        ZipEntry zipEntry = zin.getNextEntry();
View Full Code Here

  public long getVersion(final ResourceManager caller)
          throws ResourceLoadingException
  {
    final ResourceKey parentKey = key.getParent();
    final ResourceData data = caller.load(parentKey);
    return data.getVersion(caller);
  }
View Full Code Here

TOP

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

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.