How to configure

Sejda requires a configuration xml file to be present in the class path to instruct the library about which task implementation it should run. The configuration file name can be provided using the system property sejda.config.file or using standard file name sejda.xml, if none of these options is used the library will prompt an error saying it was unable to find a proper configuration.
The configuration file is by default validated against its XSD; starting from 1.0.0.M6, this feature can be switched off using the system property sejda.perform.schema.validation.

This is a sample configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<sejda validation="true" ignore_xml_config="false">
	<notification async="false" />
		<task parameters="org.sejda.model.parameter.DecryptParameters"
			task="org.sejda.impl.sambox.DecryptTask" />
		<task parameters="org.sejda.model.parameter.SetMetadataParameters"
			task="org.sejda.impl.sambox.SetMetadataTask" />
  • The validation attribute is a not mandatory attribute (default is false) telling the library if input parameters instances must be validated by the library, if false the library assumes they are already validated.
  • The ignore_xml_config attribute, starting from 1.0.0.M6, is a not mandatory attribute (default is true) telling the library to ignore a META-INF/validation.xml (see jsr-303).
  • The async attribute of the notification element tells the library if event notifications must be to sent asynchronously.
  • The tasks element contains a list of tasks telling the library which task implementation to use when a given parameter instance is submitted to the execution service.

Enabling the logger org.sejda.core at DEBUG level will print out the configured tasks:

class org.sejda.model.parameter.DecryptParameters executed by -> class org.sejda.impl.sambox.DecryptTask
class org.sejda.model.parameter.SetMetadataParameters executed by -> class org.sejda.impl.sambox.SetMetadataTask

A complete list of the available tasks implementations can be found here.