Class ClassloaderRuntimeRepository

All Implemented Interfaces:
IRuntimeRepository

public class ClassloaderRuntimeRepository extends AbstractClassLoadingRuntimeRepository
A runtime repository that loads the resources by calling ClassLoader.getResourceAsStream(String)
Author:
Jan Ortmann
  • Field Details

    • REPOSITORY_XML_ELEMENT

      public static final String REPOSITORY_XML_ELEMENT
      Name of the xml element representing the product component registry.
      See Also:
    • TABLE_OF_CONTENTS_FILE

      public static final String TABLE_OF_CONTENTS_FILE
      The default name of the file describing the registry's contents.
      See Also:
  • Constructor Details

    • ClassloaderRuntimeRepository

      public ClassloaderRuntimeRepository(ClassLoader cl, String basePackage)
      Creates a new repository that loads its contents from the given classloader and the given package. Uses the default toc resource name. Uses the default document builder available via DocumentBuilderFactory.newInstance() to parse the xml files.
      Throws:
      NullPointerException - if cl or basePackage are null.
      IllegalArgumentException - if the basePackage does not contain the table of contents file.
      RuntimeException - if the registry's table of contents file can't be read.
      See Also:
    • ClassloaderRuntimeRepository

      public ClassloaderRuntimeRepository(ClassLoader cl, String basePackage, String pathToToc)
      Creates a new repository that loads its contents from the given classloader and the given package and toc resource using the default document builder.
      Parameters:
      cl - The classloader to use.
      basePackage - The name of the base package that contains the data.
      pathToToc - Path from the base package to the resource containing the toc, e.g. "faktorips-repository-toc.xml" or "motor/motor-repository-toc.xml"
      Throws:
      NullPointerException - if any argument is null.
      IllegalArgumentException - if the basePackage does not contain the table of contents file.
      RuntimeException - if the registry's table of contents file can't be read.
    • ClassloaderRuntimeRepository

      public ClassloaderRuntimeRepository(ClassLoader cl, String basePackage, String pathToToc, ICacheFactory cacheFactory)
      Creates a new repository that loads its contents from the given classloader and the given package using the given xml document builder.
      Parameters:
      cl - The classloader to use.
      basePackage - The name of the base package that contains the data.
      pathToToc - Path from the base package to the resource containing the toc, e.g. "faktorips-repository-toc.xml" or "motor/motor-repository-toc.xml"
      Throws:
      NullPointerException - if any argument is null.
      IllegalArgumentException - if the basePackage does not contain the table of contents file.
      RuntimeException - if the registry's table of contents file can't be read.
  • Method Details