Interface IRuntimeRepositoryLookup

All Superinterfaces:
Serializable
All Known Implementing Classes:
IRuntimeRepositoryLookup.RuntimeRepositoryLookupByToC

public interface IRuntimeRepositoryLookup extends Serializable
An IRuntimeRepositoryLookup is an interface for a class that is able to provide a runtime repository. It is used to serialize and deserialize policy components especially the ProductConfiguration and enumeration contents.

An implementation needs to be serializable hence this interface already implements the Serializable interface. After serializing and deserializing an object of this type the method getRuntimeRepository() must return an IRuntimeRepository with the same content as before - when deserialized on the same machine, it must be the same instance, usually a singleton.

For a ClassloaderRuntimeRepository, its withLookup() method can be used to register it in a static lookup table that returns the same instance, identified by the path to the repository's table-of-contents file.

Alternatively, a ClassloaderRuntimeRepository can be created and registered all in one call to the byToC(String) factory method.

  • Method Details

    • getRuntimeRepository

      IRuntimeRepository getRuntimeRepository()
      Returns an instance of IRuntimeRepository that can be used to load the product component and generation of a serialized ProductConfiguration after deserialization.
      Returns:
      A IRuntimeRepository used to load product components and product component generations.
    • byToC

      static IRuntimeRepositoryLookup byToC(String tocPath)
      Creates a new ClassloaderRuntimeRepository for the given table-of-contents file path and returns an IRuntimeRepositoryLookup that will always return that repository on this machine and recreate it if necessary when deserialized on other machines.

      Be aware that referenced repositories must be set on the repository returned from getRuntimeRepository(), and each repository must have an IRuntimeRepositoryLookup. For deserialization to work with referenced repositories, the lookups need to be initialized prior to deserializing the first instance, as that would create a new repository without referenced repositories.

      Parameters:
      tocPath - Path to the resource containing the ToC file. E.g. "org/faktorips/sample/internal/faktorips-repository-toc.xml"
      Returns:
      an IRuntimeRepositoryLookup that will always return the same ClassloaderRuntimeRepository created from the given ToC path
      Since:
      25.7