Examples of ResourceKey


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

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

    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

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

  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

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

  {
    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

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

      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

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

  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

Examples of org.richfaces.resource.ResourceKey

        Map<Class<?>, LibraryFunction> parseConfig = ClientServiceConfigParser.parseConfig("csv.xml");
        assertEquals(2, parseConfig.size());
        assertTrue(parseConfig.containsKey(String.class));
        LibraryFunction libraryFunction = parseConfig.get(String.class);
        assertEquals("stringConverter", libraryFunction.getName());
        ResourceKey resource = Iterables.getOnlyElement(libraryFunction.getResources());
        assertEquals("csv.js", resource.getResourceName());
        assertEquals("org.richfaces", resource.getLibraryName());
    }
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.