Package org.digidoc4j

Class CompositeContainerBuilder

java.lang.Object
org.digidoc4j.CompositeContainerBuilder

public class CompositeContainerBuilder extends Object
A builder for creating CompositeContainers by nesting an existing container into another container. A nested inner container becomes a data file for the nesting outer container.

The builder can be created from either:

The builder currently supports creating:

See Also:
  • Method Details

    • fromContainer

      public static CompositeContainerBuilder fromContainer(Container container, String containerFileName)
      Creates an instance of a composite container builder from an existing Container object. The specified container will be nested as a data file into a nesting composite container. The name of the data file will be specified by containerFileName parameter.

      NB:

      Parameters:
      container - an existing container object to be nested
      containerFileName - file name of the to-be-nested container
      Returns:
      builder for creating a composite container
    • fromContainerFile

      public static CompositeContainerBuilder fromContainerFile(String containerFilePath)
      Creates an instance of a composite container builder from an existing container file. The specified container will be nested as a data file into a nesting composite container. The name of the data file will be determined from the specified file path.
      Parameters:
      containerFilePath - path to an existing container file to be nested
      Returns:
      builder for creating a composite container
    • fromContainerStream

      public static CompositeContainerBuilder fromContainerStream(InputStream containerInputStream, String containerFileName)
      Creates an instance of a composite container builder from the input stream of an existing container. The specified container will be nested as a data file into a nesting composite container. The name of the data file will be specified by containerFileName parameter.
      Parameters:
      containerInputStream - input stream of an existing container to be nested
      containerFileName - file name of the to-be-nested container
      Returns:
      builder for creating a composite container
    • buildTimestamped

      public CompositeContainer buildTimestamped(Consumer<TimestampBuilder> timestampBuilderConfigurator)
      Builds a timestamped composite container. The resulting composite container will contain the initially specified container as its data file, which will be covered by a freshly taken timestamp token. The type of the resulting container will be ASiC-S.

      NB: The specified timestamp builder configurator should not call TimestampBuilder.invokeTimestamping() directly!

      Parameters:
      timestampBuilderConfigurator - callback for configuring the timestamp builder used for creating a timestamp
      Returns:
      timestamped composite container
      See Also:
    • withConfiguration

      public CompositeContainerBuilder withConfiguration(Configuration configuration)
      Specifies the configuration to be used by the container being built.
      Parameters:
      configuration - configuration to use for building the container
      Returns:
      this builder