Altova Global Resources are portable references to files, folders, or databases. When stored as Global Resources, paths and database connection details become reusable and available across multiple Altova applications. For example, if you frequently need to open the same file in multiple Altova desktop applications, you may find it convenient to define it as a Global Resource. This way, you don't even need to remember the file path because you can select the respective Global Resource from the "Open File" dialog box instead. This also has the advantage that, if the file path ever changes, you will change it in one place only.
A typical usage of Global Resources is to define a database connection once and reuse it across all Altova applications that support Global Resources. For example, you can create a database connection on the machine where a MapForce mapping was designed and then reuse the same connection on the machine where MapForce Server runs the mapping (this may require, in some cases, that both machines have the same database client software installed).
Optionally, you can create multiple variations of the same Global Resource (known as "configurations"). This lets you easily switch file or folder paths (or even databases) depending on your needs. For example, you could create a "database" resource with two configurations: "development" and "production". Taking FlowForce Server as example, you could then easily retrieve data from either the development or production database, by supplying the desired configuration to the mapping function.
You can create Global Resources from the following Altova desktop applications: Altova Authentic, DatabaseSpy, MobileTogether Designer, MapForce, StyleVision, and XMLSpy. On the server side, Global Resources can be consumed by the following Altova server applications: 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.
From the FlowForce Server perspective, Global Resources cease to be "global" to some extent, because they 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 may be copied, exported, and imported, and are subject to the same user access mechanism like other FlowForce Server objects. In other words, any FlowForce user could 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, you can choose whether the mapping should use Global Resources, by selecting the Use Resources check box on 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 selected the check box, the mapping function will require resources in FlowForce Server as well. The following 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):
As illustrated above, in FlowForce Server, it is the mapping function that consumes Global Resources, not the job. The exact meaning of the verb "consumes" depends on how exactly the mapping was designed with respect to Global Resources. For example, the mapping may have been configured to read from or write to a path, in case of files or folders. In the example above, 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. In other words, 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, refer to MapForce documentation (https://www.altova.com/documentation).
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):
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:
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.
In FlowForce, resource objects are identified by the 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:
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.
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.
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.
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:
For example, in the job configuration below, the directory alias was changed to "TestDir".
|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.|
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.
|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.
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.