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
| Parameter | Required | Default value | Allowed values | Description |
|---|---|---|---|---|
| MaxUncompressedPagePackageSizeMb | No | 15 | The maximum capacity (in megabyte) for folders containing objects of type page before creating a new folder. | |
| MaxUncompressedBinaryPackageSizeMb | No | 5 | The maximum capacity (in megabyte) for folders containing objects of type binary before creating a new folder. |
context.Items collection
| Item Key | Required | Default value | Item Value Type | Description |
|---|---|---|---|---|
| TransportPackageRootDirectory | Yes | string | The root transport package folder | |
| ExtendedOverallPackageObjectFilePath | Yes | string | File path of the XML that contains an overview of all the files that need to be transported to Dynamic Delivery. | |
| TransportPackageDirectories | Yes | List<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
- 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
binaryare moved to a000001subfolder and if the size of the000001subfolder exceedsMaxUncompressedBinaryPackageSizeMb, a000002subfolder is created and the remainder of the binaries is moved in there until the folder size exceedsMaxUncompressedBinaryPackageSizeMb, then a000003folder is created etc. - Files of type
pageare moved to the next numeric subfolder and if the size of the 00000X subfolder exceedsMaxUncompressedPagePackageSizeMb, 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
indexare moved to the next numeric subfolder. This type is never split into multiple folders. - Files of type
tocorpublicationare moved to the next numeric subfolder. These types are never split.
- Files of type
- 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
ExtendedOverallPackageObjectFilePathparameter. The content of this file is similar to thepackage.xml, but holds some extra information on the files to send.
context.Items collection as a result
| Item Key | Typical Value | Item Value Type | Description |
|---|---|---|---|
| TransportPackageDirectories | A 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
ExtendedOverallPackageObjectFilePathparameter. - It then divides them into
binarytype entries and finds thebinary_schemaentry. It also limits the folder size to the value of theMaxUncompressedBinaryPackageSizeMbparameter.pagetype entries and finds thepage_schemaentry. It also limits the folder size to the value of theMaxUncompressedPagePackageSizeMbparameter.indextype entries (which do not have a schema entry).tocandpublicationtype entries. It also finds thepublication_schemaentry.
- 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
SubFolderproperty of the entries is updated to the numerical folder. - The values of the
context.Itemsthat need to be changed are set.