Altova MobileTogether Designer

Create a Server Action Library

Home Prev Top Next

A server action library is created in the same way as you create a solution. It is essentially used for processing Action Groups. You can define page source trees so that the server action library can use data from these trees. However, since a server action library is intended to run on the server (and so with no user interface), all controls and the addition of new pages are disabled. Additionally, since a server action library can only execute server-side actions, such as sending an email from the server or updating a node in one of its page sources, it is only these kinds of actions that are enabled in a server action library; other actions are disabled.

 

For a higher-level description of server action libraries, see the topic server action libraries

 

Create a new server action library

To create a new server action library, do the following:

 

1.Click File | New server action library to open a design file for the server action library. On clicking the command, a new server action library design is created. The MobileTogether Designer interface will look similar to that for a solution, but a number of features will be disabled (see first paragraph of topic).

2.In the Main Window, click the Action Groups button to create an Action Group.

3.In the Action Groups dialog that appears (screenshot below), click the Add a Group button of the Action Groups pane (button circled red in the screenshot).

Click to expand/collapse

4.Create an Action Group as described in the section Action Groups. Note that you can define parameters for your action group. Parameters are useful if you want to pass data from the main (calling) solution to the Action Group in the server action library. Remember that the server action library does not have access to data from the calling solution. So if you want to pass data from the main solution to the Action Group in the server action library, you wil need to use parameters to do so.

5.Save the server action library with the File | Save command.

6.Deploy the server action library with the File | Deploy to MobileTogether Server command. Note that the server action library must be deployed to the same MobileTogether Server as the calling solution and the server must be the Advanced Edition. The location on the server where the server action library is saved is system-defined and will be automatically entered when you use the deploy command; it cannot be changed. (On each MobileTogether Server, all server action libraries are saved inside a single dedicated folder.)

 

Important points

Note the following points about server action libraries:

 

Deployment is to MobileTogether Server Advanced Edition.

A server action library can call other server action libraries.

If you modify a server action library, you must redeploy it for the changes to be accessible to calling solutions.

How to access a server action library is described in the topic Use a server action library.

 

Example

The example server action library described in this topic is ServerLibrary.mtd, which is located in the ServerActionLibraries folder of the Tutorials folder. You can open this server-library file and click the Action Groups button to go to the definition of the Action Group named ScanFolder (screenshot below).

 

In the definition of the Action Group's Read Folder action, you must define paths to actual folders on your system for simulations to work. Afterward you can simulate the calling solution, MainSolution.mtd. For an overview of how the two example files, MainSolution.mtd and ServerLibrary.mtd, work together, see the description of the example in the topic server action libraries.

Click to expand/collapse

Note the following points:

 

The server action library contains one Action Group, named ScanFolder, the definition of which is shown in the screenshot above.

One parameter, named $FolderToScan, has been declared for the Action Group. Its value in the Action Group will be passed in from the calling solution (see server action libraries and Use a server action library).

When the Read Folder action is added to the Action Group, a page source named $MT_FILEINFO is automatically created in the server action library to hold the data obtained by the Read Folder action.

The folder to read is specified in the Folder setting of the Read Folder action (circled green in the screenshot above). In our example, it is set via an XPath expression to read a different folder for each selection (Books, Films, and Music). Note that the conditions in the XPath expression (see screenshot below) use the $FolderToScan variable—which contains the user selection (Books, Films, or Music) sent from the calling solution.

MTDServerLibsCreateSLib03ExXPath

Each folder path is built by concatenating the different parts of the respective path. It is in this XPath expression that you can modify the paths of the three folders to scan. If you want to simulate with real folders, set the three paths here to real folders on your system.

The Reset action is used to reset the $MT_FILEINFO page source before the Read Folder action is executed.

The concluding action of the Action Group, carried out by the Return action, is to return the $MT_FILEINFO tree as the result of the Action Group. The tree will be passed to the calling solution—to the $FolderReadout variable in the Let action that calls the Action Group (see server action libraries and Use a server action library).

 

Note:For simulations of MainSolution.mtd to work, you must define paths to actual folders on your system . These definitions are stored in the Folder setting of the Read Folder action.

 

© 2017-2023 Altova GmbH