PNX Extensions Loader Tool

General Purpose

Primo allows you to import (load) PNX extensions by using the following methods:

  •   File splitter plug-ins (such as the XML, HTML, or user-defined file splitters that allow you load extensions) –
    This method is meant to be used while you are loading source records into Primo.
    It allows you to load source records and add extensions at the same time, using the IFileSplitter interface.
  •   PNX Extensions Loader tool –
    This is a new method, which is described in this document.
    This method allows you to add extensions after you have already loaded your source records into Primo.
    It is much faster than the Import PNX Extensions tool and utilizes the IFileSplitter interface,
    which is more intuitive to implement than the PNXExtensionPlugin interface.

Each of the above methods has its own advantages and should be used in cases where it best fits the application.
For more information on the file splitter and Import PNX Extensions Tool methods, refer to the following pages, respectively:

  •   File Splitter Plug-In
  •   PNX Extension Plug-In


In order to use this tool, you must be aware of the following restrictions:

  • The extensions must be imported after the PNX records have been loaded.
  • Your file splitter plug-in must know the Primo record ID in order to load its associated PNX extensions into Primo.
    Note that the Primo record ID is the concatenation of the Primo data source code and the unique identifier of the source record.

Implementing the File Splitter Plug-In

Before you can use PNX Extensions Loader tool, you must first implement the IFileSplitter interface, which requires knowledge of the Java language.
This section describes what needs to be implemented for this application of a file splitter plug-in.
If you need detailed information on how to implement and integrate file splitter interfaces, refer to the following page:

File Splitter Plug-In

Parse() Method

For each file that contains your extensions in the source directory, the PNX Extensions Loader tool will call your file splitter plug-in. Your plug-in should parse the file,
create an empty RecordData object per PNX record, add all of the extensions associated with the record to the RecordData object, and then save the RecordData object.

The following pseudo code example assumes that the input file has two columns: the record ID and its extension data (which is of type FULLTEXT).

public void parse(InputStream is, File file, IRecordSaver saver)
                throws Exception {
        for each extension in file {
            RecordData rd = new RecordData(id, "", false);
            rd.addExtension(new ExtensionData(“FULLTEXT”, extensionData));

In the above example, only one extension is loaded and associated with a record. You may associate more than one extension to each record.
This requires you to find all of the extensions belonging to a record and then add them to the RecordData object.
The following code example assumes that the input file has three columns: the record ID and two extension data columns of type FULLTEXT.

RecordData rd = new RecordData(id, "", false);
rd.addExtension(new ExtensionData(“FULLTEXT”, extensionData1));
rd.addExtension(new ExtensionData(“FULLTEXT”, extensionData2, false));;

RecordData Constructor Parameters

The RecordData constructor contains the following parameters:
1) id – The Primo record ID of the record to which you want to save the extensions.

2) “” – The empty string indicates to the system that you are only saving extensions
and not changing anything in the source record table.

3) false – This value indicates that the record is not being deleted.
Note that the system will delete the source record if this parameter is
set to true.

ExtensionData Constructor Parameters

The ExtensionData constructor contains the following parameters:

1) String type – The type of the extension
(any string you wish which exists and mapped in the PNX_EXTENSION_MAPPING mapping table)

2) String value – The extensions value

3) Override – By default, this field is set to false. If set to false, the system will add the current
extension to any already existing extension for this record. If set to true,
the system will delete any previously existing extensions of this type prior to loading
the new extensions.

Deleting Extensions

In order to delete the extensions, you can either implement a second file splitter that performs the delete functionality,
or use the File Splitter Params mapping table to pass a parameter to your file splitter plug-in to indicate that it should perform deletions.
To perform a deletion, you must set the second parameter to null and third parameter to true in the
constructor of the ExtensionData object, as shown in the following example:

RecordData rd = new RecordData(id, "", false);
rd.addExtension(new ExtensionData(“FULLTEXT”, null, true));;

NOTE: Currently, the system will not delete the rows in the P_PNX_EXTENIONS table that are holding the extensions,
but it will remove the extensions from the Search Engine’s index.
This means that the extensions will have no effect in the system, but will remain in the database.
This will be fixed in Primo version 4.

Using the PNX Extensions Loader Tool

After registering the file splitter in the File Splitters mapping table, you can use the PNX Extensions Loader tool to import the extensions from the data files into Primo.

Figure 1. PNX Extensions Loader Tool

To configure this tool, enter the following fields:

  • Name – Any name you wish to describe your import tool
  • Harvesting method – The options are Copy/FTP/SFTP
  • Source Directory – The directory holding the files you wish to harvest.
    (Note – only the directory name is needed, and not the file names).
  • File format – A regular expression describing the file you wish to harvest.
    All files matching the expression will be harvested.
  • File Splitter – Your implementation of the file splitter. This list displays the entire file splitters available in the “file splitters” mapping table.
  • Email – an email to send a confirmation the process has ended (either successfully or on failure).
    You can enter more than one email by using the “;” delimiter.

After you have created the tool, you can execute the tool from the Tools List page in the Back Office by clicking its Execute button.

NOTE: When the tool is executed, it will parse only the files that meet the following criteria:
• The file name matches the regular expression configured in the File format field.
• The file has been added or updated since the last time the tool was executed.