Examples of ResourceKey


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

    }

    try
    {
      final ResourceManager resourceManager = getRootHandler().getResourceManager();
      final ResourceKey key = resourceManager.deriveKey(getRootHandler().getSource(), href);
      final Resource resource = resourceManager.create(key, null, MasterReport.class);
      report = (MasterReport) resource.getResource();
    }
    catch (ResourceException re)
    {
View Full Code Here

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

  private String computeReportName(final File reportFile)
  {
    try
    {
      final ResourceKey resourceKey = resourceManager.createKey(reportFile);
      final String reportName = computeNameFromMetadata(resourceManager, resourceKey);
      if (StringUtils.isEmpty(reportName))
      {
        return computeNameFromReport(resourceManager, resourceKey);
      }
View Full Code Here

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

  private AbstractReportDefinition loadDefinitionFromFile(final File filename)
  {
    try
    {
      final ResourceKey selectedFile = resourceManager.createKey(filename);
      final Resource directly = resourceManager.create(selectedFile, null, new Class[]{MasterReport.class});
      final MasterReport resource = (MasterReport) directly.getResource();
      final DocumentBundle bundle = resource.getBundle();
      if (bundle == null)
      {
View Full Code Here

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

    {
      throw new NullPointerException();
    }


    final ResourceKey contentBase = element.getContentBase();
    if (contentBase == null)
    {
      // treat all resources as linked resources ..
      AbstractElementWriteHandler.logger.debug("No content base, treating all content as linked.");
      return;
    }
    final ResourceKey defSource = element.getDefinitionSource();
    if (defSource == null)
    {
      // treat all resources as linked resources ..
      AbstractElementWriteHandler.logger.debug("No report definition source, treating all content as linked.");
      return;
    }

    if (ObjectUtilities.equal(contentBase.getParent(), defSource.getParent()) == false)
    {
      // treat all resources as linked resources ..
      AbstractElementWriteHandler.logger.debug(
          "Content base points to non-bundle location, treating all content as linked.");
      return;
    }

    final Object contentBasePathRaw = contentBase.getIdentifier();
    if (contentBasePathRaw instanceof String == false)
    {
      return;
    }

    final String contentBasePath = String.valueOf(contentBasePathRaw);
    final ResourceManager resourceManager = state.getMasterReport().getResourceManager();

    final ElementType type = element.getElementType();
    final ElementMetaData data = type.getMetaData();
    final AttributeMetaData[] datas = data.getAttributeDescriptions();
    for (int i = 0; i < datas.length; i++)
    {
      final AttributeMetaData attributeMetaData = datas[i];
      if (attributeMetaData.isTransient())
      {
        continue;
      }
      if (isFiltered(attributeMetaData))
      {
        continue;
      }

      final Object attValue = element.getAttribute(attributeMetaData.getNameSpace(), attributeMetaData.getName());
      if (attValue == null)
      {
        continue;
      }
      final ResourceReference[] referencedResources = attributeMetaData.getReferencedResources
          (element, state.getMasterReport().getResourceManager(), attValue);
      for (int j = 0; j < referencedResources.length; j++)
      {
        final ResourceReference reference = referencedResources[j];
        if (reference.isLinked())
        {
          AbstractElementWriteHandler.logger.debug("Linked Resource will not be copied into bundle: " + reference);
          continue;
        }

        final ResourceKey path = reference.getPath();
        final Object identifier = path.getIdentifier();
        if (identifier instanceof String == false)
        {
          AbstractElementWriteHandler.logger.warn("Resource-Bundle-Key has no parseable path: " + path);
          continue;
        }
View Full Code Here

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

          }
          else if (value instanceof ResourceKey)
          {
            try
            {
              final ResourceKey key = (ResourceKey) value;
              final ResourceManager resourceManager = bundle.getResourceManager();
              final ResourceKey bundleKey = bundle.getBundleKey().getParent();
              final String serializedKey = resourceManager.serialize(bundleKey, key);
              attList.setAttribute(AttributeNames.Core.NAMESPACE, "resource-type", "resource-key");
              writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
              writer.writeTextNormalized(serializedKey, true);
              writer.writeCloseTag();
View Full Code Here

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

      }
      else
      {
        final ExpressionRuntime expressionRuntime = getRuntime();
        final ProcessingContext context = expressionRuntime.getProcessingContext();
        final ResourceKey contentBase = context.getContentBase();
        final ResourceManager manager = context.getResourceManager();
        try
        {
          final ResourceKey key = createKeyFromString(manager, contentBase, backgroundImage);
          final Resource resource = manager.create(key, null, Image.class);
          final Image image = (Image) resource.getResource();
          plot.setBackgroundImage(image);
          plotImageCache = image;
        }
View Full Code Here

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

    // we have a HREF given, ...
    if (href != null)
    {
      // load ..

      final ResourceKey key = getRootHandler().getSource();
      final ResourceManager manager = getRootHandler().getResourceManager();
      try
      {
        final ResourceKey derivedKey = manager.deriveKey(key, href);
        final Resource resource = manager.create(derivedKey, null, DataFactory.class);
        getRootHandler().getDependencyCollector().add(resource);
        dataFactory = (DataFactory) resource.getResource();
      }
      catch (ResourceKeyCreationException e)
View Full Code Here

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

    {
      throw new NullPointerException();
    }

    final AbstractReportDefinition report = state.getReport();
    final ResourceKey contentBase = report.getContentBase();
    if (contentBase == null)
    {
      // treat all resources as linked resources ..
      return;
    }
    final ResourceKey defSource = report.getDefinitionSource();
    if (defSource == null)
    {
      // treat all resources as linked resources ..
      return;
    }

    if (ObjectUtilities.equal(contentBase.getParent(), defSource.getParent()) == false)
    {
      // treat all resources as linked resources ..
      return;
    }

    final Object contentBasePathRaw = contentBase.getIdentifier();
    if (contentBasePathRaw instanceof String == false)
    {
      return;
    }

    final String contentBasePath = String.valueOf(contentBasePathRaw);
    final ResourceManager resourceManager = state.getMasterReport().getResourceManager();

    for (int i = 0; i < datas.length; i++)
    {
      final ExpressionPropertyMetaData attributeMetaData = datas[i];
      final Object attValue = beanUtility.getProperty(attributeMetaData.getName());
      if (attValue == null)
      {
        continue;
      }
      final ResourceReference[] referencedResources = attributeMetaData.getReferencedResources
          (expression, attValue, report, resourceManager);
      for (int j = 0; j < referencedResources.length; j++)
      {
        final ResourceReference reference = referencedResources[j];
        if (reference.isLinked())
        {
          continue;
        }

        final ResourceKey path = reference.getPath();
        final Object identifier = path.getIdentifier();
        if (identifier instanceof String == false)
        {
          continue;
        }
View Full Code Here

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

          return;
        }
        if ("resource-key".equals(type))
        {
          final ResourceManager resourceManager = getRootHandler().getResourceManager();
          final ResourceKey key = getRootHandler().getContext();
          final ResourceKey parent = key.getParent();
          final ResourceKey valueKey = resourceManager.deserialize(parent, attributeValue);

          // make local ..
          final ResourceKey resourceKey = localizeKey(resourceManager, valueKey);
          element.setAttribute(namespace, name, resourceKey);
          return;
        }
        element.setAttribute(namespace, name, attributeValue);
        return;
View Full Code Here

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

  {
  }

  public static File getContextAsFile(final AbstractReportDefinition reportDefinition)
  {
    final ResourceKey key = getContextKey(reportDefinition);
    return getContextAsFile(key);
  }
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.