Deployment Extension
Introduction
The Deployment extension enhances the out-of-the-box FNZ Studio deployment capabilities. It provides functions to deploy extensions, Business Objects, or Packages using script language instructions.
The Deployment extension contains twelve functions enabling you to:
- Import or export Business Objects
- Import or export FNZ Studio Users
- Import or export Packages
- Import or export the System Configuration
- Import or export Process Message Queues
- Import an Extension
- Update the configuration of an Extension
The Deployment extension also contains a customizable HTTP-based interface which can perform similar operations as the functions.
An alternative to using the Deployment extension is using the deployment and export features available directly in FNZ Studio. See the Export and Deployment Procedures and Packages sections for details.
Deployment via Function Calls
The following functions can be called in the Deployment extension:
ImportExtension()ImportExtensionConfig()ImportContent()ImportUsers()ImportProcessMessageQueues()ImportPackages()ImportSystemConfiguration()ExportContent()ExportUsers()ExportProcessMessageQueues()ExportPackages()ExportSystemConfiguration()
ImportExtension()
The ImportExtension() function imports any extension into the current FNZ Studio installation, given the path to the *.jar file containing it. On multi-node installations, all cluster nodes are aligned automatically. It is possible to specify whether to restart the imported extension upon deployment, and whether to deploy its configuration file at the same time.
ImportExtension($path)
The available parameters are:
$path(String) – Fully qualified path of the .jar file for the extension to be imported. nExample:/tmp/FunctionsExtension.jar$autoRestart(Boolean, optional) – Set totrueto automatically start the extension after importing it (or restart it if it already existed before importing).$importConfig(Boolean, optional) – Set totrueto import the extension's configuration file (a *.cfg file with the same name as the extension, in the same location). If the configuration file exists, it is deployed together with the extension, overwriting any previously existing version.
The return value is:
- String – Result of the import operation, for example: 'Import Successful'.
Example:
ImportExtension('/tmp/MailExtension.jar', true, true)
ImportExtensionConfig()
The ImportExtensionConfig() function imports an extension's configuration into the current FNZ Studio installation, given the path to the *.jar.cfg file containing it. On multi-node installations, all cluster nodes are aligned automatically. It is possible to specify whether to restart the corresponding extension upon deployment in order to take over the newly imported configuration immediately.
ImportExtensionConfig($path)
The available parameters are:
$path(String) – Fully qualified path of the extension configuration file to be imported. Example:/tmp/MailExtension.jar.cfg$autoRestart(Boolean, optional) – Set totrueto automatically restart the extension after importing its configuration file
The return value is:
- String – Result of the import operation, for example: 'Import Successful'.
Example:
ImportExtensionConfig('/tmp/MailExtension.jar.cfg', true)
ImportContent() (Import Business Objects)
The ImportContent() function imports an export file into the current FNZ Studio installation. You can only import into the 'Base' Package with this function, meaning you can only import Business Objects that were exported from the 'Base' Package. It imports all Business Objects in the file, overwriting existing Business Objects with the same ID even if their modification date is more recent. This operation is equivalent to importing an *.awexport file through Solution Design > Base > Maintenance > Business Objects > Import and Export in the Studio, and selecting all Business Objects in the list.
ImportContent($path)
The available parameters are:
$path(String) – Path to the export file to be imported. If it starts with '/' it is considered as an absolute path, otherwise it is a relative path from the{DATA_HOME}folder. If the path contains{DATA_HOME}, it is replaced with the absolute path to the data home folder. Example:/tmp/test.awexport$shouldCommit(Boolean, optional) – Set totrueto commit the imported Business Objects after importing. Default value:false$comment(String, optional) – The commit comment.$deleteOthers(Boolean, optional) – Set totrueto delete all other objects not included in the export file you are importing (except custom lists). Default value:false
$importReportFile(String, optional) – Defines the path to the output file containing a report of all imported objects. Relative paths are interpreted relative to the data home, use{DATA_HOME}to refer to the FNZ Studio data home location. Default value:nullExample:'{DATA_HOME}/work/tmp/report.txt'
The return value is:
- String – '0' for success, '-99' in case of error and '-1' if the file was not found. If successful, the number of Business Objects imported and deleted is displayed. In case of error, the error message is displayed.
Example:
0Import SuccessfulImported objects: 10Deleted objects: 1Total objects: 11
Example:
ImportContent('/tmp/test.awexport', true, 'Fix for defect 1234', true)
ImportUsers()
The ImportUsers() function imports a ZIP file generated by the ExportUsers function into the current installation. The function imports all FNZ Studio Users contained in the export file, overwriting existing Users with the same User ID and creating new Users if they do not exist. All User attributes are imported, including Groups, Roles and preferences.
Note that, with the introduction of Virtual Groups in FNZ Studio 2023.x.x, it may be the case that the function tries to add a User to a Virtual Group (instead of a Physical Group), which is incorrect. In this case, the User is not added to the Group and an error message is returned.
The available parameters are:
$path(String) – The path to the import file. Relative paths are interpreted relative to the data home, use{DATA_HOME}to refer to the FNZ Studio data home location. Example:/tmp/userExport.zip
The return value is:
- String – Result of the import operation. Example: 'Import Successful'.
Example:
ImportUsers('/tmp/userExport.zip')
ImportProcessMessageQueues()
The ImportProcessMessageQueues() function imports a ZIP file generated by the ExportProcessMessageQueues function into the current FNZ Studio installation. Importing overwrites existing process message queues of the same name or creates process message queues in the target environment.
The available parameters are:
$path(String) – The path to the import file. Relative paths are interpreted relative to the data home, use{DATA_HOME}to refer to the FNZ Studio data home location. Example:/tmp/messageQueuesExport.zip
The return value is:
- String – Result of the import operation. Example: 'Import Successful'.
Example:
ImportProcessMessageQueues('/tmp/messageQueuesExport.zip')
ImportPackages()
Imports Packages from an AWDEPLOYMENT file into FNZ Studio. This operation is equivalent to importing an AWDEPLOYMENT file through Solution Design > Packages > Import. For more details on importing Packages, see the dedicated section on Importing and Exporting Packages.
The available parameters are:
$path(String) – The relative path to the AWDEPLOYMENT file. Example:/work/tmp/uploads/myPackages.awdeployment$comment(String, Optional) – Import comment, stored on the message board. Example: Sprint Release.$packages(Named Boolean, Optional) – Named Collection of Strings mapped to Boolean. The first parameter is the ID of the Package, the second parameter is a flag that indicates if the Package configuration should be imported. If null, all Packages and Package configurations are imported. Example:{'myPackage'=true}:Boolean
The return value is:
- String – Import success or error message.
Example:
0Imported Objects: 10Deleted Objects: 10File Path to report: /work/tmp/export.csv (Can be downloaded from the message board)
Example:
ImportPackages('work/tmp/uploads/myPackages.awdeployment', 'Sprint 10')
ImportSystemConfiguration()
Imports the system configuration (server, content, license). This operation overwrites the existing configuration.
The available parameters are:
$path(String) – The absolute path (starting with '/') or the relative path from the data directory pointing to the ZIP file containing the configuration properties. The ZIP file must end with .zip. Note that onlyconf.properties,content.properties, andlicense.propertiesin the root directory are considered. All other files and folders are ignored. Moreover, note that such configuration files must be encoded in ISO-8859-1. Example:mnt/share/appway/work/tmp/uploads/conf.zip
The return value is:
- String – Import success or error message.
Example:
0Thu Aug 10 12:42:48 CEST 2017 : Import Successful Properties files imported: conf.properties
ExportContent() (Export Business Objects)
The ExportContent() function exports the whole set of Business Objects available in the 'Base' Package. This operation is equivalent to exporting an *.awexport file through Solution Design > Base > Maintenance > Business Objects > Import and Export in the Studio, and selecting all Business Objects in the list.
It is possible to export a subset of the Business Objects in the system by specifying the name of a Custom List or a list of valid file types to be exported.
ExportContent($path)
The available parameters are:
$path(String) – The path where the export file is saved. Relative paths are interpreted relative to the data home, use{DATA_HOME}to refer to the FNZ Studio data home location. The file name must end with .awexport or .zip and the target directory must be writable. Example:/tmp/test.awexport$headFlag(Boolean, optional) – Set totrueto export the head version of the Business Objects (committed or uncommited, always the newest version), or tofalseto export their "LatestCommitted" version. Default value:false(= LatestCommitted)$customListFilter(String, optional) – Defines the name of a Custom List to be exported. By default, all Business Objects in the specified Package are exported. If a valid Custom List is specified, the *.awexport or *.zip file that is created only contains the Business Objects in that Custom List (including its sub-lists). The custom list must be part of the 'Base' Package. Example: 'Uncommitted'$includeDeleted(Boolean, optional) – Whentrue, includes deleted items both committed and head when$headFlagistrue, and only returns deleted committed items when$headFlagisfalse. If a custom list was selected, this also includes deleted and/or committed Business Objects not in the custom list but within the 'Base' Package. Use for targeted cleanup. Default value:false$objectTypes(Indexed String, optional) – A collection of Business Object types that are exported. Valid values are the ones returned by theCONTEXT().getBusinessObjectService().getTypeNames()function. Simply ignore this parameter if you want to include all Business Objects. Selecting 'Package' or 'PackageConfiguration' is ignored. If all types are wrong, the method returns an error. Example:['Workflow', 'Screen']:StringDefault value:[]:String
The return value is:
- String – Result of the export operation, for example 'Export Successful', with the status '0' for success and '-99' in case of error.
Example:
ExportContent('/tmp/test.awexport', true, 'Uncommitted', true, ['Screen']:String)
ExportUsers()
The ExportUsers() function exports Users from the current FNZ Studio installation. The resulting export file is in the ZIP format (containing a file in the JSON format).
It is possible to export a subset of the Users in the system by specifying the User type (whether local or remote Users), User Group(s), or User Role(s). Dynamic Groups can also be included if required.
ExportUsers($path)
The available parameters are:
$path(String) – The path to the export file. Relative paths are interpreted relative to the data home, use{DATA_HOME}to refer to the FNZ Studio data home location. Example:/tmp/userExport.zip$localOnly(Boolean, optional) – Exports only local Users if set totrue. Default value:false$roles(Indexed String, optional) – Exports only Users belonging to the specified Roles. To export all User Roles, omit this parameter. Example:[‘Administrator’]:String$groups(Indexed String, optional) – Exports only Users belonging to the specified Groups. To export all User Groups, omit this parameter. Default value:[‘Compliance’]:String$includeDynamicGroups(Boolean, Optional) – Set totrueto also export Dynamic Groups. Default value:false
The return value is:
- String – Result of the export operation, for example 'Export Successful'.
Example:
ExportUsers('/tmp/userExport.zip', true, ['Administrator']:String, ['Compliance']:String)
ExportProcessMessageQueues()
The ExportProcessMessageQueues() function exports process message queues in the current FNZ Studio installation. The resulting export file is in the ZIP format. This function does not export the “Default” process message queue.
ExportProcessMessageQueues($path)
The available parameters are:
$path(String) – The path to the generated export file. Relative paths are interpreted relative to the data home, use{DATA_HOME}to refer to the FNZ Studio data home location. Example:/tmp/messageQueuesExport.zip
The return value is:
- String – Result of the export operation, for example 'Export Successful'.
Example:
ExportProcessMessageQueues('/tmp/messageQueuesExport.zip')
ExportPackages()
Exports Packages to an AWDEPLOYMENT file with the provided file path. Only Packages that have not been deleted can be exported. This operation is equivalent to exporting an AWDEPLOYMENT file through Solution Design > Packages > Export. For more details on exporting Packages, see the dedicated section on Importing and Exporting Packages.
Note: You cannot export the 'Base' Package with this function, use ExportContent() instead.
The available parameters are:
$path(String) – The relative path to the AWDEPLOYMENT file. Example:work/tmp/myExport.awdeployment$packages(Named Boolean, Optional) – Named Collection of Strings mapped to Boolean. The first parameter is the ID of the Package, the second parameter is a flag that indicates if the Package configuration should be exported. If null or empty collection, all Packages and Package configurations are exported with the exception of the 'Base' Package. Only not-deleted Packages can be selected. Example:{'myPackage'=true}:Boolean$includeLocalModifications(Boolean, Optional) – If set totrue, the Package and all local modifications are exported. Iffalse, only the latest Package version is exported. Default value:false
The return value is:
- String – Export success or error message. '0' for success, '-99' for any error.
Example:
0Thu Aug 10 12:42:48 CEST 2017 : Export SuccessfulFile path to export: /Users/[Username]/Documents/Development/Projects/Appway/data/work/tmp/exp.awdeployment
Example:
ExportPackages('work/tmp/exp.awdeployment', {'myPackage'=true}:Boolean, true)
ExportSystemConfiguration()
This function exports server and content configuration keys. The target file of the export must be a ZIP file. If the target file already exists, it is overwritten.
The available parameters are:
$path(String) – The path to the ZIP file created with the exported system configuration. If the path starts with '/', it is interpreted as an absolute path, otherwise as a relative path starting in the data home folder. Example:mnt/share/appway/work/tmp/uploads/conf.zip$exportContentConfig(Boolean, Optional) – If set totrue, the content configuration properties are exported. Default:true.$exportServerConfig(Boolean, Optional) – If this is set totrue, the server configuration properties are exported. Default:true.
The return value is:
- String – Export success or error message.
Example:
0Thu Aug 10 12:42:48 CEST 2017 : Export SuccessfulFile path to export: work/tmp/exports/config.zip
Deployment via HTTP Requests
There are eight Script Functions that can be invoked through an HTTP request to do HTTP-based deployments/exports. These Script Functions provide a similar interface to that of the functions described in the previous chapter, except that the location of the files to be deployed must be configured first for security reasons.
Note: Package import and export is not supported for HTTP requests.
When the Deployment extension is started for the first time on an FNZ Studio installation, it automatically creates the following Script Functions which can be edited to fit your particular infrastructure set-up and deployment procedures.
DeployExtensionDeployExtensionConfigDeployContentDeployUsersDeployProcessMessageQueuesDownloadContentDownloadUsersDownloadProcessMessageQueues
The DeploymentService Access Policy is also created. It allows calls to these Script Functions via an HTTP interface and lets you manage security constraints.
These Business Objects are created only if they do not exist yet. Your modifications will therefore not be overridden upon restarting the Deployment extension, unless the corresponding object has been deleted.
File Path Configuration
Before calling the deployment Script Functions, it is necessary to configure the base path to the import or export files. This is to avoid exposing a file path specifier on the HTTP interface, leaving it open to manipulation.
Set the properties below under System Configuration > Configuration Properties > Edit Server Configuration.
The available properties are:
deployment.filePath– Location of the folder containing the AWEXPORT or ZIP files to be imported or exported. This is the base path to which the file name passed to theDeployContent,DeployUsers,DeployProcessMessageQueues,DownloadContent,DownloadUsers, andDownloadProcessMessageQueuesScript Functions is appended. The file path must contain "/" at the end. For example:deployment.filePath = /tmp/deployment.extension.filePath– Location of the folder containing the *.jar or *.jar.cfg files to be imported. This is the base path to which the file name passed to aDeployExtensionorDeployExtensionConfigScript Function is appended. The file path must contain "/" at the end. For example:deployment.extension.filePath = /tmp/
'DeploymentService' Access Policy
The DeploymentService Access Policy is a sample Business Object containing the Script Functions DeployExtension, DeployExtensionConfig, DeployContent, DeployUsers, DeployProcessMessageQueues, DownloadContent, DownloadUsers and DownloadProcessMessageQueues.
By default, this Access Policy merely checks whether the property remote.deployment.enabled is set to true. It is recommended to change this default expression to implement the specific security constraints relevant to your installation. See Access Policies for more information.
A second default property of the access policy allows the IT administrator to configure a list of IP addresses from which the HTTP can be made. The property is called remote.deployment.ip.list and it can contain any number of pipe (|) separated addresses. Only IPs in that list can call the deployment APIs via HTTP, unless the remote.deployment.enabled property is set to true (in that case anybody can call the APIs).
'DeployExtension' Script Function
The DeployExtension Script Function imports any extension into the current FNZ Studio installation, given the name of the *.jar file containing it. The path to this file must be set as a server configuration property (see File Path Configuration).
The available parameters are:
$fileName(String) – Name of the file. Example:MailExtension.jar$autoRestart(Boolean, optional) – Set totrueto automatically start the extension after importing it (or restart it if it already existed before importing).$importConfig(Boolean, optional) – Set totrueto import the extension's configuration file (a *.cfg file with the same name as the extension, in the same location). If the configuration file exists, it is deployed together with the extension, overwriting any previously existing version.
The return value is:
- String – Result of the import operation, for example: 'Import Successful'.
Example HTTP request for the Script Function DeployExtension:
CONTEXT_PATH/script/DeployExtension?fileName=MailExtension.jar&autoRestart=true&importConfig=true
'DeployExtensionConfig' Script Function
The DeployExtensionConfig Script Function imports an extension's configuration into the current FNZ Studio installation, given the name of the *.jar.cfg file containing it. The path to this file must be set as a server configuration property (see File Path Configuration).
The available parameters are:
$fileName(String) – Name of the file. Example:MailExtension.jar.cfg$autoRestart(Boolean, optional) – Set totrueto automatically restart the extension after importing its configuration file.
The return value is:
- String – Result of the import operation. Example: 'Imported objects: 4 Deleted objects: 12 Total objects: 23'
Example HTTP request for the Script Function DeployExtensionConfig:
CONTEXT_PATH/script/DeployExtensionConfig?fileName=MailExtension.jar.cfg&autoRestart=true
'DeployContent' Script Function
The DeployContent() Script Function imports an *.awexport file into the 'Base' Package of the current FNZ Studio installation (imported objects must have been exported from the 'Base' Package). The path to this file must be set as a server configuration property (see File Path Configuration). All Business Objects in the *.awexport file are imported, overwriting existing Business Objects with the same ID even if their modification date is more recent. This operation is equivalent to loading an *.awexport file through Solution Design > Base > Maintenance > Business Objects > Import and Export in the Studio, and selecting all Business Objects in the list.
You can define arbitrary operations that must be executed after importing the *.awexport file. To do this, include a Script Function with the ID Deploy_ExecuteAfterImport in the *.awexport file to be imported.
The available parameters are:
$fileName(String) – Name of the *.awexport file to be imported. nExample:test.awexport$commit(Boolean, optional) – Set totrueto commit the imported Business Objects.$comment– The commit comment.$deleteOthers(Boolean, optional) – Set totrueto delete all other objects not included in the content. Default:false$reportFile(String, optional) – Defines the name of the output file containing a report of all imported objects. nBy default, the file is placed to/tmp. To define a custom path, create thedeployment.filePathconfiguration property for the extension and specify the custom path there. See File Path Configuration for details.
The return value is:
- String – Result of the import operation, for example: 'Import Successful'
Example HTTP request for the Script Function DeployContent:
CONTEXT_PATH/script/DeployContent?fileName=test.awexport&commit=true
'DeployUsers' Script Function
The DeployUsers() Script Function imports a ZIP file generated by the ExportUsers function into the current FNZ Studio installation. Set the path to this file as a server configuration property (see File Path Configuration). It imports all FNZ Studio Users contained in the export file, overwriting existing Users with the same User ID and creating new Users if they do not exist. Everything regarding User attributes is imported, including Groups, Roles and preferences.
The available parameters are:
$fileName(String) – Name of the file to be imported. Example:userExport.zip
The return value is:
- String – Result of the import operation, for example: 'Import Successful'.
Example HTTP request for the Script Function DeployUsers:
CONTEXT_PATH/script/DeployUsers?fileName=userExport.zip
'DeployProcessMessageQueues' Script Function
The DeployProcessMessageQueues() Script Function imports a ZIP file generated by the ExportProcessMessageQueues function into the current FNZ Studio installation. Set the path to this file as a server configuration property (see File Path Configuration). This Script Function imports all process message queues contained in the exported file, overwriting existing ones and creating new queues if they do not exist.
The available parameters are:
$fileName(String) – Name of the file to be imported. Example:queues.zip
The return value is:
- String – Result of the import operation, for example: 'Import Successful'.
Example HTTP request for the Script Function DeployProcessMessageQueues:
CONTEXT_PATH/script/DeployProcessMessageQueues?fileName=queues.zip
'DownloadContent' Script Function
The DownloadContent Script Function exports the whole set of Business Objects in the 'Base' Package. This operation is equivalent to exporting a *.awexport file through Solution Design > Base > Maintenance > Business Objects > Import and Export in the Studio, and selecting all Business Objects in the list.
It is possible to export a subset of the Business Objects in the system by specifying the name of a Custom List to be exported. In this case, only the Business Objects contained in that Custom List (or in any nested Custom List contained in it) are included in the *.awexport file.
The path to the location where the exported *.awexport file is saved must be set as a server configuration property (see File Path Configuration).
The available parameters are:
-
$fileName(String) – Name of *.awexport file to be created. n Example:test.awexport -
$headFlag(Boolean, optional) – Set totrueto export the head version of the Business Objects, or to false to export their "LatestCommitted" version. Default value:false(= LatestCommitted) -
$customListFilter(String, optional) – Name of a Custom List to be exported. By default, all Business Objects in the Platform are exported. If a valid Custom List is specified, the *.awexport file that is created only contains the Business Objects in that Custom List (including its sub-lists). Example: 'Uncommitted' -
$includeDeleted(Boolean, optional) – Set totrueto include deleted items both committed and head (if headFlag istrue). Only includes deleted items that are committed if headFlag isfalse. -
$objectTypes(String, optional) – A comma-separated list of business object types to export. Valid values are the ones returned by theCONTEXT().getBusinessObjectService().getTypeNames()function. Omit this parameter to include all business objects.Note: If a value for the `$customListFilter` parameter is specified, the function first tries to find the defined custom list. Then the function creates an *.awexport file containing only the Business Objects that are part of that custom list and of the type defined here.nIf no value for `$customListFilter` is specified or the value is empty, the function exports all the Business Objects of the defined type available on the platform.
Example: Workflow,Screen
The return value is:
$path– Result of the export operation, for example 'Export Successful'
Example HTTP request for the Script Function DownloadContent:
CONTEXT_PATH/script/DownloadContent?fileName=test.awexport&headFlag=true&customList=Project
'DownloadUsers' Script Function
The DownloadUsers Script Function exports Users in the current FNZ Studio installation.
It is possible to export a subset of the Users in the system by specifying the User type (whether local or remote Users), User Group(s), or User Role(s). The path to the location where the exported file is saved must be set as a server configuration property (see File Path Configuration).
The available parameters are:
$fileName(String) – Name of the export file to be created. Example:users.zip$localOnly(Boolean, optional) – Exports only local Users if set totrue. Default value:false$roles(String, optional) – Exports only Users belonging to the specified User Role. For multiple Roles, separate each Role name with a comma. Omit this parameter to export all Roles. Example: 'Administrator,Approvers'$groups(String, optional) – Exports only Users belonging to the specified User Group. For multiple Groups, separate each Group name with a comma. Omit this parameter to export all Groups. Example: 'Front Office,Compliance'
The return value is:
$path– Result of the export operation, for example 'Export Successful'.
Example HTTP request for the Script Function DownloadUsers:
CONTEXT_PATH/script/DownloadUsers?fileName=users.zip&localOnly=true&roles=Administrator,Approvers&groups=Compliance
'DownloadProcessMessageQueues' Script Function
The DownloadProcessMessageQueues Script Function exports process message queues in the current FNZ Studio installation, excluding the “Default” process message queue. The path to the location where the exported file is saved must be set as a server configuration property (see File Path Configuration).
The available parameters are:
$fileName(String) – Name of the export file to be created. Example:queues.zip
The return value is:
$path– Result of the export operation, for example 'Export Successful'
Example HTTP request for the Script Function DownloadProcessMessageQueues:
CONTEXT_PATH/script/DownloadProcessMessageQueues?fileName=queues.zip