Package org.pentaho.reporting.libraries.resourceloader

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


      return valueKey;
    }

    try
    {
      final ResourceData resourceData = resourceManager.load(valueKey);
      final byte[] resource = resourceData.getResource(resourceManager);
      return resourceManager.createKey(resource, valueKey.getFactoryParameters());
    }
    catch (ResourceException e)
    {
      if (logger.isDebugEnabled())
View Full Code Here


      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

            {
              instance = (com.lowagie.text.Image) maybeImage;
            }
            else
            {
              final ResourceData data = resourceManager.load(resource);
              instance = com.lowagie.text.Image.getInstance(data.getResource(resourceManager));
              imageCache.put(resource, instance);
            }

            final Resource imageWrapped = resourceManager.create(resource, null, Image.class);
            final Image image = (Image) imageWrapped.getResource();
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 (ResourceException re)
          {
            ExcelPrinter.logger.info("Failed to load image from URL " + url, re);
          }
View Full Code Here

      final String pfbFileName = fontType.substring
          (0, fontType.length() - 4) + ".pfb";
      try
      {
        final ResourceKey pfbKey = manager.deriveKey(key, pfbFileName);
        final ResourceData res = manager.load(pfbKey);
        pfb = res.getResource(manager);
        dc.add(pfbKey, res.getVersion(manager));
      }
      catch (ResourceException e)
      {
        // ignore ..
      }
View Full Code Here

          return cached;
        }

        try
        {
          final ResourceData resourceData = resourceManager.load(url);
          final byte[] data = resourceData.getResource(resourceManager);
          final Image itextimage = Image.getInstance(data);
          cachedImages.put(identity, itextimage);
          return itextimage;
        }
        catch (ResourceException re)
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

    if (contextKey != null)
    {
      try
      {
        final ResourceKey resourceKey = manager.deriveKey(contextKey, xmiFile);
        final ResourceData data = manager.load(resourceKey);
        return data.getResourceAsStream(manager);
      }
      catch (ResourceException re)
      {
        // ignore, lets go on to the direct parsing as a local file
      }
    }

    final ResourceKey resourceKey = manager.createKey(new File(xmiFile));
    final ResourceData data = manager.load(resourceKey);
    return data.getResourceAsStream(manager);
  }
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.