PAS Custom Content Providers

When the PDF Automation Server has to read and write document files, it uses an interface called a Content Provider.  By default, the server is delivered with two Content Provider implementations, the File System Content Provider and the Alfresco Content Provider.

File System Content Provider

The File System Content Provider accesses files in a given folder in the local file system where the server is running.  By default, this folder is set to a folder named “storage” in the Program Data folder.  All files in the storage folder and subfolders will be accessible to any REST calls.  The location of the storage folder is stored in the settings file for the server, and can be accessed through the PAS Manager, in Preferences -> REST -> Storage Directory.

Alfresco Content Provider

The Alfresco Content Provider allows the server to work with documents stored in an Alfresco server.  The properties to access the server, such as the server URL and the base folder are stored in a file called alfresco.properties in the Program Data folder.

Additoinal information on setting up Alfresco can be found in Alfresco Setup

Custom Content Providers

In addition to the default Content Providers, PDF Automation Server has the ability to use custom Content Providers.  Custom made Content Providers allow the server to access documents that are stored in any system, local or remote, such as database systems, Amazon S3 buckets, etc.  To achieve this, the server defines two interfaces that need to be implemented in Java and then registered with the server, to do this follow these steps:

  1. Create a Java project with your favorite IDE.
  2. Add the QoppaPAS.jar file that comes with the server to the project’s classpath.
  3. Create a class that implements com.qoppa.spi.ContentProvider, and implements all of its methods.
  4. Create a class that implements com.qoppa.spi.Session, and implements all of its methods.
  5. Build a jar file from these classes and any dependencies, and include a services folder in the jar file’s META-INF, with an entry for com.qoppa.spi.ContentProvider.  This mechanism is the standard Java mechanism to register services with the JVM.
  6. Place your jar file in the lib folder under the PDF Automation Server installation folder.
  7. Restart the server

After restarting the server, you can verify that your custom Content Provider was registered correctly by opening PAS Manager, and navigating to Preference -> REST.  In this panel, there is s drop down called “Content provider” that will list all the Content Providers registered with the server.

You can download a sample Eclipse project that holds a sample implementation of a Content Provider from here: https://www.qoppa.com/files/pdfautomation/PAS-ContentProvider.zip

 

 


Qoppa Software's PDF Automation Server for Windows, Linux, Unix, and macOS

Automate PDF Document Workflows through RESTful Web Services & Folder Watching

Copyright © 2002-Present Qoppa Software. All rights reserved.