How to retrieve your .bar, forms, bdm and other resources from a running Bonita platform?

marielle.spiteri's picture
marielle.spiteri
Blog Categories: 

Component: Portal Resources | Version: 7.+

Purpose of this article

Starting with version 7.0 and with all the following versions, more and more resources are available to a user with the Administrator profile to download from the Resources Menu in the Bonita Portal.
As the documentation explains, it's pretty straight forward, just select the resource that you want to export, and click on the Export button. You can't do simpler than that: https://documentation.bonitasoft.com/bonita/7.10/resource-management

However, even if the forms installed at the tenant level are available to download, the forms that are specific to a unique process and installed with your .bar aren't.
You may also want to retrieve the process .bar file itself, but this one isn't downloadable from the portal either.
And what about the bdm.zip deployed for your business data?

Well, in this article, I'll give you a few tips to retrieve some of these resources directly from your platform.

Two methods to export my process forms

1. Use the page download service in HTTP with the pageID (where YOUR_HOSTNAME is your hostname and YOUR_PORT is your port):

http://YOUR_HOSTNAME:YOUR_PORT/bonita/portal/pageDownload?id=pageID

You can get the page ID of your form by looking at the response of the request sent to API/portal/page when you display the process forms section.

2. Retrieve the file content with this Engine API call: https://documentation.bonitasoft.com/javadoc/api/7.10/org/bonitasoft/engine/api/PageAPI.html#getPageContent-long- byte[] getPageContent(long pageId) throws PageNotFoundException

The idea is to use this Engine API call to retrieve each form file content in turn and save the content in new zip files on the disk.

Export my process .bar

The bar file content can be retrieved with this Engine API call:
https://documentation.bonitasoft.com/javadoc/api/7.10/org/bonitasoft/engine/api/ProcessManagementAPI.html#exportBarProcessContentUnderHome-long- byte[] exportBarProcessContentUnderHome(long processDefinitionId) throws ProcessExportException

The idea is to use this Engine API call to retrieve each bar file content in turn and save the content in new bar files on the disk.

Two methods to retrieve the BDM deployed in the engine

1. From the file system:

  • Go to: \/bonitaengine\@\/platform/classloaders/local/TENANT/\/\/BDR.jar**__**__**_.jar\\\\\
  • Note: JAVA_IO_TMP_DIRECTORY, by default, will vary depending on the application server used:
    • Tomcat:
      • Before 7.4.x: /temp/
      • 7.4.x and after: /server/temp/
    • JBoss/Wildfly:
      • Linux: /tmp or /var/tmp/
      • Windows: it will take the value of %TEMP% environment variable)
  • Unzip the file: BDR.jar**__**__**_.jar
  • You will retrieve the bom.xml, which is in fact the content of any bdm.zip

2. From the Database: (Warning: Querying the database directly should be done under the supervision of a Database administrator).

  • Run the following SQL query in your engine's database:

SELECT content FROM tenant_resource WHERE (tenantid = <tenant_id> AND name = 'client-bdm.zip');

  • Retrieve and unzip the file: client-bdm.zip
  • You will find a bom.zip, which you can rename as bdm.zip

That's it for now! Congrats, you have retrieved some hidden resources from your platform...

Notifications