Altova FlowForce Server 2024 Advanced Edition

Altova Global Resources are aliases for file, folder, and database resources. Each alias can have multiple configurations, and each configuration maps to a single resource. Therefore, when you use a global resource, you can switch between its configurations. For example, you could create a database resource with two configurations: development and production. Depending on your goals, you can switch between these configurations. In FlowForce Server, you can retrieve data from the development or production database by supplying the desired configuration to the mapping function.

 

Global resources can be used across different Altova applications (see subsection below).

 

Global resources in other Altova products

When stored as global resources, files, folders, and database connection details become reusable across multiple Altova applications. For example, if you often need to open the same file in multiple Altova desktop applications, you can define this file as a global resource. If you need to change the file path, you will need to change it only in one place. Currently, global resources can be defined and used in the following Altova products:

 

Altova Authentic

DatabaseSpy

MobileTogether Designer

MapForce

StyleVision

XMLSpy

FlowForce Server

MapForce Server

RaptorXML Server/RaptorXML+XBRL Server

 

For more information about creating Global Resources, refer to the "Altova Global Resources" chapter of MapForce documentation.

 

Resources in FlowForce Server

In FlowForce Server, global resources are not stored in one XML file as in desktop applications. In FlowForce, each resource is a reusable object that may contain file or folder paths or database connection details. Resources can be copied, exported, and imported, and are subject to the same user access mechanism as other FlowForce Server objects. This means that any FlowForce user can use any resource in their mapping functions if they have the required permissions.

 

Once you have created a mapping with global resources in MapForce, you can deploy it to FlowForce Server. At deployment time, if you want your mapping to use global resources, select the Use Resources check box in the deployment dialog box. If you do not select the check box, any global resources used by the mapping will be resolved, based on the currently selected configuration. If you have selected the check box, the mapping function will require resources in FlowForce Server as well. The screenshot below is an example of a mapping function deployed to FlowForce that requires resources to run. Notice that the first parameter gets the default file path from a resource.

inc-resources-flowforce

In FlowForce Server, it is the mapping function that uses the global resources, not the job. The mapping function reads the path of the first input file from the resource. This means that all jobs using this function will use the same path unless you override the path from the job configuration page.

 

You can also deploy global resources to FlowForce Server as standalone objects. This means there is no need to deploy a mapping first in order to be able to deploy a global resource. For more information about deploying global resources to FlowForce Server, see the MapForce documentation.

 

 

Structure of resources

In all Altova desktop applications, global resources are maintained as XML files. The default file is called GlobalResources.xml; you can find it in the C:\Users\<username>\Documents\Altova directory on the computer where MapForce is installed. A Global Resource file may contain multiple resources, also known as "aliases". An alias is either a file path, or a directory path, or a group of database connection details. Aliases, in their turn, can have multiple configurations. As described previously, configurations enable you to switch paths or databases. This is best understood by looking at the structure of the following sample Global Resource file (note some data was omitted for simplicity):

 

<Resources>
    <Resource Alias="MyFile">
        <Configurations>
          <Configuration Location="C:\test.json" ContentKind="File" Configuration="Default"/>
          <Configuration Location="C:\production.json" ContentKind="File" Configuration="Production"/>
        </Configurations>
    </Resource>
    <Resource Alias="MyDirectory">
        <Configurations>
          <Configuration Location="C:\Test" ContentKind="Folder" Configuration="Default"/>
          <Configuration Location="C:\Production" ContentKind="Folder" Configuration="Production"/>
        </Configurations>
    </Resource>
    <Resource Alias="MyDatabase">
        <Configurations>
          <Configuration ContentKind="DataSource" Configuration="Default">
              <DatabaseContextInfo vendor="sqlite" connection="C:\Resources\Test.sqlite"/>
          </Configuration>
          <Configuration ContentKind="DataSource" Configuration="Production">
              <DatabaseContextInfo vendor="sqlite" connection="C:\Resources\Production.sqlite"/>
          </Configuration>
        </Configurations>
    </Resource>
</Resources>

 

The file above defines three resources (aliases): a file path called "MyFile", a directory path called "MyDirectory", and a SQLite database called "MyDatabase". Each alias has two configurations: a default configuration used for testing, and a production configuration.

 

In FlowForce Server, because of the specifics of the multi-user server environment, resources work slightly differently. Specifically, an XML resource file such as the one above becomes a resource object in FlowForce. Inside the resource object, there can be multiple aliases, just like in desktop applications. However, each alias has only one configuration, and that is the configuration that you've selected upon deploying the resource from MapForce to FlowForce Server.

 

Whenever you deploy Global Resources from MapForce to FlowForce Server, only one of the configurations is deployed at a time.

 

For example, if you deployed the global resource file above, either the "Default" or "Production" configuration will be deployed to the server (not both at the same time). If you choose the "Default" configuration, the resource object would look as follows in FlowForce Server:

fs_resources_01

In FlowForce, any mapping function can consume one specific configuration of a global resource. Therefore, in this example, if you need the "Production" configuration on the server, you should deploy the same resource file once again, this time selecting the configuration "Production" from the deployment dialog box in MapForce. Alternatively, you can create a resource directly on the server, as described below, and change the mapping function to point to it instead of the "Default" resource. Note, however, that the alternative approach is possible with file and directory resources, not with databases.

 

Changing the resource of a mapping function

In FlowForce, resource objects are identified by the fs_global_resource icon. Therefore, if you've deployed both the "Default" and the "Production" configurations from the example above, the corresponding resources in FlowForce Server may appear as follows:

fs_resources_02

To change the resource used by a mapping function:

1.Go to the container where the mapping function was deployed and click to open the function.

2.Under "Resources", select a new resource path. Selecting resources works in the same way as with other FlowForce objects such as functions, credentials, and so on.

fs_resources_03

If the mapping function does not have a "Resources" section, this mapping was not configured for Global Resources in MapForce (or the Use Resources check box was not selected on deployment).

 

Any mapping function can use any resource, if the following requirements are satisfied:

 

The resource kind is compatible with the function. For example, a "folder" resource is not suitable if the mapping function needs a "file" resource.

The resource alias name is the one required by the mapping function. You normally select the alias name at mapping design time, in MapForce, but you can also override it in FlowForce, as further described below.

 

Resources and job configuration

As stated before, resources are consumed at mapping function level, not at job configuration level. When a job runs, it consumes those global resources that are defined in the function called by the job. Therefore, when you edit a job from the job configuration page, you have only very minimal configuration options with respect to resources, like "Overriding the resource alias" (further described below).

 

In some cases, it may be possible to reference a resource (like a folder or file) directly from the job configuration page. Please note that this may not work in all contexts and should be generally avoided unless you have a very good reason to use such references.

 

Note:It is not supported to refer to a resource from the "Working Directory" parameter of an execution step. This is because processing of resources requires that the MapForce Server process be already started, whereas the working directory is set before MapForce Server starts.

 

Overriding the resource alias

Even if a file or folder resource can have multiple aliases, only one of them is used at job runtime. The alias used at runtime is the one selected in MapForce while designing the mapping. For example, the following MapForce component is configured to generate output.csv to a directory alias called "MyDirectory". If you deploy this mapping to FlowForce Server, the mapping function on the server must also point to a resource that contains the "MyDirectory" alias.

fs_resources_04

As an alternative to editing the mapping in MapForce whenever you need to change the alias, you can also override the alias in FlowForce Server, from the job configuration page. To override file or folder aliases in a job, use the following syntax, replacing MyFile or MyDirectory with the required alias name:

 

Resource kind

Example

File

altova://file_resource/MyFile

Directory

altova://folder_resource/MyDirectory

 

For example, in the job configuration below, the directory alias was changed to "TestDir".

fs_resources_05
Note:Overriding the alias as shown above is not supported for database resources. If you have multiple databases aliases, switch to the required database alias in MapForce before deploying the mapping to FlowForce Server.

 

Creating resources

You can create only file or folder resources in FlowForce Server. To create a global resource in FlowForce Server, open a container of choice and click Create | Create Resource.

fs_resources_06
Note:Creating database resources is not supported in a server environment. To create database resources, use the Global Resources editor of MapForce or any other Altova desktop application that supports Global Resources, and then deploy the resources from MapForce to FlowForce Server.

 

The resource alias should match the one required by the mapping function where you will use this resource. Otherwise, you will need to tweak jobs manually so that they point to the correct alias, as described above in "Overriding the resource alias".

 

Within the same resource object, you can create multiple aliases if required, by clicking the New File Resource or New Folder Resource buttons. This is optional, however. If you create multiple aliases, remember that you will need to modify jobs so as to indicate which alias it should use.

 

Editing resources

You can edit file or folder resources directly in FlowForce Server, as an alternative to doing this in MapForce and deploying them again. To edit a resource, click the respective record, update the paths (or the database connection details), and then click Save.

 

Note:In case of database resources, you can edit in FlowForce only certain fields such as the connection string or default database. It is, however, not possible to change the database vendor and connection method.

 

Updating a resource affects with immediate effect all of the following:

 

All the mapping functions referencing that resource

All the jobs that call the respective mapping functions.

© 2017-2023 Altova GmbH