Documentation Center

IPublishPostProcessPlugin - DitaDeliveryDividePackage

Moves the files that need to be transported for Dynamic Delivery to multiple folders based on their type and a maximum size defined for the folder.

Plugin Input

Plugin configuration parameters
ParameterRequiredDefault valueAllowed valuesDescription
MaxUncompressedPagePackageSizeMbNo15The maximum capacity (in megabyte) for folders containing objects of type page before creating a new folder.
MaxUncompressedBinaryPackageSizeMbNo5The maximum capacity (in megabyte) for folders containing objects of type binary before creating a new folder.
Input expected in the context.Items collection
Item KeyRequiredDefault valueItem Value TypeDescription
TransportPackageRootDirectoryYesstringThe root transport package folder
ExtendedOverallPackageObjectFilePathYesstringFile path of the XML that contains an overview of all the files that need to be transported to Dynamic Delivery.
TransportPackageDirectoriesYesList<string>A list of folder paths were the Transport Packages content that needs to be sent can be found. Typically, when this plugin starts, the list only contains one value: The location of the ALL folder.

The files that need to go into the transport package should be present in the folders that are specified in the overview XML file with the files to transport.

Plugin Outcome

Changes made to the file system:
  • All files (and accompanying metadata files) that need to be send for Dynamic Delivery will be moved to numerical subfolders (of format 00000X) with the same subfolders as in the original folder structure like this:
    • Files of type binary are moved to a 000001 subfolder and if the size of the 000001 subfolder exceeds MaxUncompressedBinaryPackageSizeMb, a 000002 subfolder is created and the remainder of the binaries is moved in there until the folder size exceeds MaxUncompressedBinaryPackageSizeMb, then a 000003 folder is created etc.
    • Files of type page are moved to the next numeric subfolder and if the size of the 00000X subfolder exceeds MaxUncompressedPagePackageSizeMb, a 00000X+1 subfolder is created and the remainder of the pages is moved in there until the folder size exceeds etc.
    • Files of type index are moved to the next numeric subfolder. This type is never split into multiple folders.
    • Files of type toc or publication are moved to the next numeric subfolder. These types are never split.
  • A package.xml file is created in every numerical subfolder. That file contains a list of all the files that need to be sent.
  • The metadata schema file that is relevant for the type of object present in the subfolder is copied in every numerical subfolder.
  • A __packages.xml file is (re)created at the location of the ExtendedOverallPackageObjectFilePath parameter. The content of this file is similar to the package.xml, but holds some extra information on the files to send.
Values set in the context.Items collection as a result
Item KeyTypical ValueItem Value TypeDescription
TransportPackageDirectoriesA string list with multiple entries: Data\Publish\Data\[RANDOMFOLDERNAME]\work\TP\000001, Data\Publish\Data\[RANDOMFOLDERNAME]\work\TP\000002, Data\Publish\Data\[RANDOMFOLDERNAME]\work\TP\000003, etc.List<string>A list of Folder paths were the Transport Packages content that needs to be sent can be found. When this plugin has completed its process, the list only contains multiple values

plugin name="ISHDITADELIVERYDIVIDEPACKAGE" example


<plugin name="ISHDITADELIVERYDIVIDEPACKAGE" handler="DitaDeliveryDividePackage">
  <description>Moves the files that need to be transported for Dynamic Delivery to multiple folders based on their type
  and a maximum size defined for the folder.</description>
  <initialize>
    <parameters>
      <parameter name="MaxUncompressedPagePackageSizeMb">1</parameter>
      <parameter name="MaxUncompressedBinaryPackageSizeMb">1</parameter>
    </parameters>
  </initialize>
</plugin>

Example of a resulting __packages.xml file


<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Package Version="1.0">
  <Group Name="nav">
    <Object Id="ish:39137-100000000-512" Type="index" Content="39137-100000000-512.xml" SubFolderName="000004" />
    <Object Id="ish:39137-1-512" Type="toc" Content="39137-1-512.html" SubFolderName="000005" OriginalFile="toc.html" />
  </Group>
  <Group Name="pub">
    <Object Id="ish:39137-1-1" Type="publication" Metadata="39137-1-1.json" SubFolderName="000005" />
  </Group>
  <Group Name="bin">
    <Object Id="ish:39137-6902-16" Type="binary" Content="39137-6902-16.gif" Metadata="39137-6902-16.json" SubFolderName="000001" 
               LanguageCardId="6902" RevisionId="GUID-9A15D73D-E624-44AC-9CF3-60C4BBC09387" />
    <Object Id="ish:39137-6356-16" Type="binary" Content="39137-6356-16.jpg" Metadata="39137-6356-16.json" SubFolderName="000001" 
               LanguageCardId="6356" RevisionId="GUID-EF0BA5ED-B85C-410C-9E85-548875A1AD86" />
    <Object Id="ish:39137-6312-16" Type="binary" Content="39137-6312-16.jpg" Metadata="39137-6312-16.json" SubFolderName="000001" 
               LanguageCardId="6312" RevisionId="GUID-A4BCB0BD-325D-4804-BE75-724B2A7AA9CC" />
  </Group>
  <Group Name="schema">
    <Object Id="ish:39137-1-8" Type="publication_schema" Content="39137-1-8.json" SubFolderName="000005" />
    <Object Id="ish:39137-2-8" Type="page_schema" Content="39137-2-8.json" SubFolderName="000003" />
    <Object Id="ish:39137-2-8" Type="page_schema" Content="39137-2-8.json" SubFolderName="000002" />
    <Object Id="ish:39137-3-8" Type="binary_schema" Content="39137-3-8.json" SubFolderName="000001" />
  </Group>
  <Group Name="page">
    <Object Id="ish:39137-6229-16" Type="page" Content="39137-6229-16.html" Metadata="39137-6229-16.json" SubFolderName="000002" 
               LanguageCardId="6229" RevisionId="GUID-E17EDE47-A8D5-4072-9FB2-C79607D6C243" />
    <Object Id="ish:39137-6228-16" Type="page" Content="39137-6228-16.html" Metadata="39137-6228-16.json" SubFolderName="000003" 
               LanguageCardId="6228" RevisionId="GUID-CAB421B2-8759-4215-AACE-0B6A60C4896A" />
    <Object Id="ish:39137-6278-16" Type="page" Content="39137-6278-16.html" Metadata="39137-6278-16.json" SubFolderName="000003" 
               LanguageCardId="6278" RevisionId="GUID-0C5CB0DD-395B-48A9-A694-C6DD1A564B6A" />
  </Group>
</Package>

The package.xml files in the TP\00000X folder look similar, but do not have the SubFolderName, LanguageCardId and RevisionId attributes on Object and only contain the Object elements that are relevant for this subfolder structure.

Example of a resulting file structure having multiple subfolders with page files

Plugin flow

DitaDeliveryDividePackage does the following:
  • The plugin gets all the entries of the files from the overall package XML file from the location defined by the ExtendedOverallPackageObjectFilePath parameter.
  • It then divides them into
    • binary type entries and finds the binary_schema entry. It also limits the folder size to the value of the MaxUncompressedBinaryPackageSizeMb parameter.
    • page type entries and finds the page_schema entry. It also limits the folder size to the value of the MaxUncompressedPagePackageSizeMb parameter.
    • index type entries (which do not have a schema entry).
    • toc and publication type entries. It also finds the publication_schema entry.
  • In this order, for every of these types, numerical subfolders are created and the files of that type are moved to that folder. If the folder size would exceed the max folder size limit, a new numerical folder is created and the schema file for that type is copied if there is one. When moving the files the SubFolder property of the entries is updated to the numerical folder.
  • The values of the context.Items that need to be changed are set.