This document explains how to programmatically get the GAM Repository Connection information in XML format, using the GAM API. The resulting XML is suitable for copy & paste in a connection.gam file, so it includes all the information needed to connect to a GAM Repository.
This is useful when the GAM Manager Repository administrator creates a new GAM Repository and later needs to create a connection.gam file, to give it to the administrator of the new Repository so as to connect to it. See HowTo: Creating New Repositories for more information about this scenario.
So, given a Repository GUID and a GAM Repository Connection name, the GAM API provides a method that allows getting the XML needed to include in connection.gam file so as to connect to this Repository using the connection name provided.
The method used for this purpose is GetConnectionsFile (a method of GAM external object).
It receives as parameter a collection of GAMRepositoryConnectionFileFilter (an SDT that has the Repository GUID and the Repository Connection name). So, this method can receive many Repositories as filter and return an XML file with the connection information of all of them.
It also receives as parameter the user name and user password of GAM Manager Repository user.
See the example below:
Define a variable named &GAMRepositoryConnectionFileFilter based on GAMRepositoryConnectionFileFilter data type, and a variable &GAMRepositoryConnectionFileFilters which is a collection of GAMRepositoryConnectionFileFilter data type. These data types are part of GAM library.
Code the following in order to get the connection.gam information into a string variable (&TextXML):
&GAMRepositoryConnectionFileFilter.GUID = &GUID // &GUID of the Repository
&GAMRepositoryConnectionFileFilter.Name = &ConnectionName // &ConnectionName of the Repository Connection
GAM.GetConnectionsFile(&gamadminuser,&gamadminpwd,&GAMRepositoryConnectionFileFilters,&TextXML,&Errors) //set the information of the connection into &TextXML variable
//process the errors
for &Error in &Errors
msg(&Error..Message + !"(GAM" + &Error.Code.ToString().Trim() + !")")
A connection file with the information obtained above is created as shown below:
In order to get the information from the connection.gam file directly you need to use the GAM GetConnections method.