Examples of ResourceKeyCreationException


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

    final ResourceKey bundleKey = getBundleMainKey().getParent();
    final ResourceBundleLoader o = (ResourceBundleLoader)
        bundleKey.getFactoryParameters().get(new FactoryParameterKey("repository-loader"));
    if (o == null)
    {
      throw new ResourceKeyCreationException("Unable to create a inner-bundle key, no loader available.");
    }
    return o.deriveKey(getBundleMainKey(), entryName, factoryParameters);
  }
View Full Code Here

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

      throw new NullPointerException();
    }

    if (isSupportedKey(parent) == false)
    {
      throw new ResourceKeyCreationException("Assertation: Unsupported parent key type");
    }

    final String entry;
    final String identifier = (String) parent.getIdentifier();
    if (path != null)
    {
      if (path.length() > 0 && path.charAt(0) == '/')
      {
        entry = LoaderUtils.stripLeadingSlashes(path);
      }
      else
      {
        entry = LoaderUtils.mergePaths(identifier, path);
      }
    }
    else
    {
      entry = identifier;
    }

    final Map<ParameterKey, Object> map;
    if (factoryKeys != null)
    {
      map = new HashMap<ParameterKey, Object>();
      map.putAll(parent.getFactoryParameters());
      map.putAll(factoryKeys);
    }
    else
    {
      map = parent.getFactoryParameters();
    }

    if ("true".equals(LibDocBundleBoot.getInstance().getGlobalConfig().getConfigProperty
        ("org.pentaho.reporting.libraries.docbundle.bundleloader.repository.StrictKeyCheck", "true")))
    {
      try
      {
        final String[] name = RepositoryUtilities.split(entry, "/");
        if (RepositoryUtilities.isExistsEntity(repository, name) == false)
        {
          throw new ResourceKeyCreationException("The derived entry does not exist in this bundle.");
        }
      }
      catch (ContentIOException e)
      {
        throw new ResourceKeyCreationException("Error checking whether the derived entry exists in the bundle.");
      }
    }

    return new ResourceKey(parent.getParent(), parent.getSchema(), entry, map);
  }
View Full Code Here

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

    final ResourceKeyData resourceKeyData = ResourceKeyUtils.parse(stringKey);

    // Validate the data
    if (INNER_SCHEMA.equals(resourceKeyData.getSchema()) == false)
    {
      throw new ResourceKeyCreationException("Serialized version of key does not contain correct schema");
    }

    return new ResourceKey(bundleKey, resourceKeyData.getSchema(),
        resourceKeyData.getIdentifier(), resourceKeyData.getFactoryParameters());
  }
View Full Code Here

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

                               final String path,
                               final Map factoryKeys) throws ResourceKeyCreationException
  {
    if (isSupportedKey(parent) == false)
    {
      throw new ResourceKeyCreationException();
    }
    final RepositoryResourceBundleLoader o = (RepositoryResourceBundleLoader)
        parent.getFactoryParameters().get(new FactoryParameterKey("repository-loader"));

    if ("true".equals(LibDocBundleBoot.getInstance().getGlobalConfig().getConfigProperty
        ("org.pentaho.reporting.libraries.docbundle.bundleloader.memory.StrictKeyCheck", "true")))
    {
      try
      {
        final Repository repository = (Repository) parent.getFactoryParameters().get(new FactoryParameterKey("repository"));
        if (RepositoryUtilities.isExistsEntity(repository, RepositoryUtilities.split(path, "/")) == false)
        {
          throw new ResourceKeyCreationException("The key does not exist: " + path);
        }
      }
      catch (ContentIOException e)
      {
        throw new ResourceKeyCreationException("Failed to check for existing key", e);
      }
    }

    return o.deriveKey(parent, path, factoryKeys);
  }
View Full Code Here

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

            final Map factoryKeys)
            throws ResourceKeyCreationException
    {
        if (!isSupportedKey(parent))
        {
            throw new ResourceKeyCreationException("Assertation: Unsupported parent key type");
        }

        final InputResourceKey parentKey = (InputResourceKey) parent.getIdentifier();
        final String resource;
        if (path.startsWith("sun:oo://"))
View Full Code Here

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

  public ResourceKey deriveKey(final ResourceKey parent, final String path, final Map factoryKeys)
      throws ResourceKeyCreationException
  {
    if (isSupportedKey(parent) == false)
    {
      throw new ResourceKeyCreationException("Assertation: Unsupported parent key type");
    }

    final String entry;
    if (path != null)
    {
View Full Code Here

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

  }

  public ResourceKey deserialize(final ResourceKey bundleKey, String stringKey) throws ResourceKeyCreationException
  {
    // For now, we are just going to have to pass on this one
    throw new ResourceKeyCreationException("Can not deserialize a ZipResourceKey");
  }
View Full Code Here

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

  public ResourceKey deriveKey(final ResourceKey parent, final String path, final Map factoryKeys)
      throws ResourceKeyCreationException
  {
    if (isSupportedKey(parent) == false)
    {
      throw new ResourceKeyCreationException("Assertation: Unsupported parent key type");
    }

    try
    {
      final File target;
      if (path != null)
      {
        final File parentResource = (File) parent.getIdentifier();
        final File parentFile = parentResource.getCanonicalFile().getParentFile();
        if (parentFile == null)
        {
          throw new FileNotFoundException("Parent file does not exist");
        }
        target = new File(parentFile, path);
        if (target.exists() == false || target.isFile() == false)
        {
          throw new ResourceKeyCreationException("Malformed value: " + path + " (" + target + "): File does not exist.");
        }

      }
      else
      {
        target = (File) parent.getIdentifier();
      }

      final Map map;
      if (factoryKeys != null)
      {
        map = new HashMap();
        map.putAll(parent.getFactoryParameters());
        map.putAll(factoryKeys);
      }
      else
      {
        map = parent.getFactoryParameters();
      }
      return new ResourceKey(parent.getSchema(), target, map);
    }
    catch (IOException ioe)
    {
      throw new ResourceKeyCreationException("Failed to create key", ioe);
    }
  }
View Full Code Here

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

    final ResourceKeyData keyData = ResourceKeyUtils.parse(stringKey);

    // Validate the data
    if (SCHEMA_NAME.equals(keyData.getSchema()) == false)
    {
      throw new ResourceKeyCreationException("Serialized version of key does not contain correct schema");
    }

    // Create a new file based on the path provided
    final File file = new File(keyData.getIdentifier());
    return new ResourceKey(SCHEMA_NAME, file, keyData.getFactoryParameters());
View Full Code Here

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

  public ResourceKey deriveKey(final ResourceKey parent, final String path, final Map factoryKeys)
      throws ResourceKeyCreationException
  {
    if (path != null)
    {
      throw new ResourceKeyCreationException("Unable to derive key for new path.");
    }
    if (isSupportedKey(parent) == false)
    {
      throw new ResourceKeyCreationException("Assertation: Unsupported parent key type");
    }

    if (factoryKeys == null)
    {
      return parent;
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.