Prime Radiant Import and Export

For legacy interface, see Import Application and Export Application

NSF-2019.5 release brings a new interface for PrimeRadiant data interchange.

Usage

For most elements of Prime Radiant, you can use <element>ExportRunner and <element>ImportRunner to export and import data from/to PrimeRadiant.

Note that every Runner provides a help when invoked with --help option.

Examples are invoked through a hypothetical run-io script. See further for necessary classpath/environment setup.

Exporting

Basic synopsis:

<exportClass> <format> <outputDirectory> <finder> <finderArguments>
# Find a Component with the given name and version,
# and print the result to standard output (the console window).
run-io \
  net.democritus.elements.ComponentExportRunner \
  --print \
  --findByNameEq_VersionEq testRefComp2 2018.test

# Export as a single file (including children such as dataElements)
# to ./fileOutputDir/testRefComp2-2018.test.xml.
run-io \
  net.democritus.elements.ComponentExportRunner \
  --file \
  --outputDirectory ./fileOutputDir \
  --findByNameEq_VersionEq testRefComp2 2018.test

# Export Component as directory. This will produce:
# ./outputDir/testRefComp1.xml,
# ./outputDir/dataElements/SomeElement.xml, etc.
run-io \
  net.democritus.elements.ComponentExportRunner \
  --directory \
  --outputDirectory ./outputDir \
  --findByNameEq testRefComp1

# Find _all_ finder options, and export them as a single `./outputDir/finderOptions.xml` _groupFile_.
# --all exports all found elements, otherwise the export would stop after the first one
run-io \
  net.democritus.elements.FinderOptionExportRunner \
  --groupFile \
  --outputDirectory ./outputDir \
  --findAllFinderOptions \
  --all


# Find _all_ finder options and export them as individual files, e.g.
# ./outputDir/isCustomFinder.xml,
# ./outputDir/hasTranslation.xml, etc.
# --all exports all found elements, otherwise the export would stop after the first one
run-io \
  net.democritus.elements.FinderOptionExportRunner \
  --file \
  --outputDirectory ./outputDir \
  --findAllFinderOptions \
  --all

Importing

Basic synopsis:

<importClass> <format> <inputSource>

To import document(s), point the importer to the root file or directory.

NOTE Unlike export, elements that have composite parents cannot be easily imported. E.g. it is currently not possible to import orphaned DataElement, because the XML file does not contain a reference to the enclosing Component.

<!-- saved as useComposite.xml -->
<componentOptionType name="useComposite">
  <description>Expand Composites for this component.</description>
</componentOptionType>
# Import "useComposite" ComponentOptionType from a file
run-io \
  net.democritus.elements.ComponentOptionTypeImportRunner \
  --file \
  --inputFile ./useComposite.xml

# Import a Component from a directory
run-io \
  net.democritus.elements.ComponentImportRunner \
  --directory \
  --inputFile ./outputDir/testRefComp1.xml

# Import all technical infrastructure files found in the directory, e.g.
# technicalInfrastructure/3_0_default.xml,
# technicalInfrastructure/3_2_jee_7.xml, etc.
run-io \
  net.democritus.settings.TechnicalInfrastructure \
  --file \
  --inputDirectory ./technicalInfrastructure

Classpath Setup

The classpath needs to include the following jars:

<NSF_ROOT>/infrastructure/jonas-full-5.1.4/lib/client.jar
<NSF_ROOT>/repositories/nsx/prime/nsx-prime-<NSX_PRIME_VERSION>.jar
<NSF_ROOT>/repositories/nsx/elements-ioxml/elements-io-rmi-<ELEMENTS_VERSION>.jar
<NSF_ROOT>/repositories/nsx/ext/log4j-<ANY_VERSION>.jar

client.jar

This jar contains all classes necessary to connect with the Prime Radiant through RMI. Needed when importing, exporting or expanding and harvesting from the Prime radiant. This library is not needed when expanding or harvesting from XML.

JNDI_PROPS_URI environment variable

In order for communication with the Prime Radiant to work, the JNDI_PROPS_URI environment variable must be configured correctly to point towards the jndi conf folder of the server where the Prime Radiant is installed:

JNDI_PROPS_URI=file://<NSF_ROOT>/infrastructure/jonas-full-5.1.4/BASE/conf/jndi/*