Package org.pentaho.reporting.libraries.resourceloader

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


        final AttributeMetaData data = getMetaData().getAttributeDescription(nameSpace, name);
        if (data != null && (data.isTransient() == false))
        {
          if (attribute instanceof ResourceKey)
          {
            final ResourceKey key = (ResourceKey) attribute;
            final ResourceKey parent = key.getParent();
            if (AttributeNames.Core.NAMESPACE.equals(nameSpace) &&
                (AttributeNames.Core.CONTENT_BASE.equals(name) || AttributeNames.Core.SOURCE.equals(name)))
            {
              if (parent != null)
              {
                // unwrap the content base attribute. After deserialization, the report assumes the bundle-location
                // as content base, as the bundle will be gone.
                if (isKeySerializable(parent))
                {
                  stream.writeByte(0);
                  SerializerHelper.getInstance().writeObject(parent, stream);
                }
                else
                {
                  stream.writeByte(1);
                }
              }
              else
              {
                // great, the report was never part of a bundle. That makes life easier and the key should be
                // safely serializable too.

                if (isKeySerializable(key))
                {
                  stream.writeByte(0);
                  SerializerHelper.getInstance().writeObject(key, stream);
                }
                else
                {
                  stream.writeByte(1);
                }
              }
            }
            else
            {
              if ("Resource".equals(data.getValueRole()) || parent != null)
              {
                stream.writeByte(0);
                // todo: Convert into a byte-array key;
                try
                {
                  final ResourceKey resourceKey =
                      ResourceKeyUtils.embedResourceInKey(locateResourceManager(), key, key.getFactoryParameters());
                  SerializerHelper.getInstance().writeObject(resourceKey, stream);
                }
                catch (ResourceException e)
                {
View Full Code Here


    final Object o = imageResource.getResource();
    if (o instanceof Image == false)
    {
      throw new ResourceException("ImageResource does not contain a java.awt.Image object.");
    }
    final ResourceKey resKey = imageResource.getSource();
    final Object identifier = resKey.getIdentifier();
    if (identifier instanceof URL)
    {
      this.url = (URL) identifier;
    }
    this.resourceKey = resKey;
View Full Code Here

  protected void startParsing(final Attributes attrs) throws SAXException
  {
    super.startParsing(attrs);

    final ResourceManager resourceManager = getRootHandler().getResourceManager();
    final ResourceKey context = getRootHandler().getContext();

    final Configuration configuration = ClassicEngineBoot.getInstance().getGlobalConfig();
    final Iterator keys = configuration.findPropertyKeys(ElementMetaDataParser.GLOBAL_INCLUDES_PREFIX);
    while (keys.hasNext())
    {
      final String key = (String) keys.next();
      final String href = configuration.getConfigProperty(key);
      if (StringUtils.isEmpty(href, true))
      {
        continue;
      }
      try
      {
        final ResourceKey resourceKey = resourceManager.deriveKey(context, href);
        final Resource resource = resourceManager.create(resourceKey, null, GlobalMetaDefinition.class);
        globalMetaDefinition.merge((GlobalMetaDefinition) resource.getResource());
      }
      catch (ResourceException e)
      {
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

      return new TransMeta(transformationFile, repository);
    }

    try
    {
      final ResourceKey resourceKey = createKey(resourceManager, contextKey);
      final Resource resource = resourceManager.create(resourceKey, contextKey, Document.class);
      final Document document = (Document) resource.getResource();
      final Node node = XMLHandler.getSubNode(document, TransMeta.XML_TAG);
      final TransMeta meta = new TransMeta();
      meta.loadXML(node, repository, true, null, null);
View Full Code Here

  private ResourceData load() throws ResourceException
  {
    try
    {
      final ResourceKey resourceKey;
      if (contextKey != null)
      {
        resourceKey = resourceManager.deriveKey(contextKey, getXqueryDataFile());
        return resourceManager.load(resourceKey);
      }
    }
    catch (ResourceException re)
    {
      // failed to load from context
      logger.debug("Failed to load datasource as derived path: " + re);
    }

    try
    {
      final ResourceKey resourceKey;
      resourceKey = resourceManager.createKey(new URL(getXqueryDataFile()));
      return resourceManager.load(resourceKey);
    }
    catch (ResourceException re)
    {
      logger.debug("Failed to load datasource as URL: " + re);
    }
    catch (MalformedURLException e)
    {
      //
    }

    try
    {
      final ResourceKey resourceKey;
      resourceKey = resourceManager.createKey(new File(getXqueryDataFile()));
      return resourceManager.load(resourceKey);
    }
    catch (ResourceException re)
    {
View Full Code Here

    }
  }

  private CSSPageAreaRule parsePageRule(PageAreaType areaType, String atRule)
  {
    final ResourceKey source = this.source;
    final CSSPageAreaRule areaRule =
        new CSSPageAreaRule(styleSheet, styleRule, areaType);
    final int firstBrace = atRule.indexOf('{');
    final int lastBrace = atRule.indexOf('}');
    if (firstBrace < 0 || lastBrace < firstBrace)
View Full Code Here

      return;
    }
    try
    {
      CSSParserContext.getContext().setDefaultNamespace(defaultNamespaceURI);
      final ResourceKey key;
      if (source == null)
      {
        key = manager.createKey(uri);
      }
      else
View Full Code Here

        setDocumentLocation(DocumentLocation.LINK);
      }
      else if (object instanceof ResourceKey)
      {
        // Is the resource key an embedded resource key?
        final ResourceKey resourceKey = (ResourceKey) object;
        final Object originalValue =
            resourceKey.getFactoryParameters().get(ClassicEngineFactoryParameters.ORIGINAL_VALUE);
        if (originalValue != null)
        {
          sourceTextField.setText(String.valueOf(originalValue));
          setDocumentLocation(DocumentLocation.EMBED);
        }
        else
        {
          sourceTextField.setText(resourceKey.getIdentifierAsString());
          setDocumentLocation(DocumentLocation.LINK);
        }
      }
      else
      {
View Full Code Here

      return new HashMap();
    }
    final File ttfCache = new File(location, "samples-cache.ser");// NON-NLS
    try
    {
      final ResourceKey resourceKey = resourceManager.createKey(ttfCache);
      final ResourceData data = resourceManager.load(resourceKey);
      final InputStream stream = data.getResourceAsStream(resourceManager);

      final HashMap cachedSeenFiles;
View Full Code Here

TOP

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

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.