RTMP/E

 getConfig2(key:String, scope:String) : Object

HTTP

 http://www.example.com:1111/admin/getConfig2?auser=username&apswd=password&key=configkeyname&scope=scope

Gets the value of a configuration parameter in a specified configuration file. Adobe Media Server has six server configuration files from which you can retrieve information: Users.xml, Logger.xml, Server.xml, Adaptor.xml, Vhost.xml, and Application.xml. For a description of the XML configuration files, see Adobe Media Server Configuration and Administration Guide.

Virtual host administrators can view configuration parameters in the Vhost.xml file and Application.xml files for their own virtual hosts. You must be a server administrator to view most of the configuration parameters for the Server.xml and Adaptor.xml files.

Note:

It is possible to have more than one XML tag with the same name at the same level in the XML tree. In the configuration file, you should distinguish such tags by using a name attribute in the XML tag (for example, if you have more than one VirtualHost tag: <VirtualHost name="www.redpin.com"></VirtualHost>). When you call the getConfig() method and specify the configuration subkeys, you can indicate which tag you want by specifying the tag name, followed by a colon and the correct name attribute, for example, Admin/Adaptor:_defaultRoot_/VirtualHost:www.redpin.com.

Availability

Flash Media Server 2.0.

Parameters

key

A String indicating the configuration parameter for which information is retrieved.

A key is specified as a list of subkeys that are delimited by slashes (/). The first subkey specifies the XML configuration file that contains the desired configuration key. Subsequent subkeys correspond to tags that are relative to the XML configuration file; the hierarchy and names of the subkeys match the tags in the XML file. If multiple tags exist with the same name and same parent, they can be distinguished by specifying a name attribute and appending the name attribute to the tag name separated by a colon in the key parameter. If the specified tag is a leaf node, then its tag data is returned. If the specified tag is not a leaf node, the whole tag is returned as an XML string.

scope

A String indicating which configuration file to search for the configuration tag specified in the key parameter.

Adobe Media Server has six server configuration files: Server.xml, Users.xml, Logger.xml, Adaptor.xml, Vhost.xml, and Application.xml. Depending on your permissions, you can get configuration keys for all these files, as described in the following list:

  • / specifies Server.xml.

  • Users specifies Users.xml for server administrators.

  • Logger specifies Logger.xml.

  • Adaptor:<adaptor_name> specifies Adaptor.xml. Specify the adaptor name in place of the <adaptor_name> placeholder. You must have server administrator privileges to access the Adaptor.xml file. If <adaptor_name> is not the name of the adaptor the caller is connected to, the call fails.

  • Adaptor:<adaptor_name>/VHost:<vhost_name> specifies VHost.xml. Specify the virtual host name in place of the <vhost_name> placeholder. If <adaptor_name> is not the name of the adaptor the caller is connected to, or <vhost_name> is not the name of the virtual host that the caller is connected to, the call fails.

  • Adaptor:<adaptor_name>/VHost:<vhost_name>/Users.xml specifies Users.xml for virtual host administrators.

  • Adaptor:<adaptor_name>/VHost:<vhost_name>/App[:<app_name>] specifies Application.xml. If no <app_name> is specified, the default Application.xml file is assumed. Otherwise, the application-specific Application.xml for the specified application is used. If the specified application is not defined, or the application does not have an application-specific Application.xml file, the call fails.

Note: To determine the adaptor or virtual host to which you’re connected, call the getAdminContext() method.

auser

A String indicating the user name of the administrator.

apswd

A String indicating the password of the administrator.

Returns

RTMP/E

If the call succeeds, the server sends a reply information object with a level property of status, a code property of NetConnection.Call.Success, and a data object whose properties contain information about the specified tag.

If the specified tag is a leaf node, the call returns the tag data. Otherwise, the call returns the tag itself. For example, if the desired tag is <foo>bar</foo>, the call returns "bar". However, if the desired tag contains child tags such as <foo><bar>foobar</bar></foo>, the call returns "<foo><bar>foobar</bar></foo>".

If the call fails (that is, if the specified configuration key isn’t found), the server returns an empty string.

HTTP

If the call succeeds, it returns XML with the following structure:

 <result>   <level></level>   <code></code>   <timestamp></timestamp>   <data></data>  </result>

Nested in the data element are elements for each property of the data object listed in the RTMP/E section.

If the call fails, it returns XML with the following structure:

 <result>   <level></level>   <code></code>   <description></description>   <timestamp></timestamp>  </result>

The XML elements contain the same information as the Object properties returned in an RTMP/E call.

Note: The timestamp response over HTTP is formatted differently on Windows (9/23/2007 6:16:40 PM) and Linux (Sun 23 Sep 2007 06:16:40 PM IST).

Examples

The following examples get XML data from various configuration files:

 tSocket = new NetConnection(); 
 tSocket.connect("rtmp://localhost/admin", "user", "password"); 
  
 // find key in Server.xml 
 key = "Server/LicenseInfo"; 
 tSocket.call("getConfig2", new onGetConfig(), key, "/"); 
  
 // find key in Adaptor.xml 
 key = "HostPortList/HostPort"; 
 scope = "Adaptor:_defaultRoot_"; 
 tSocket.call("getConfig2", new onGetConfig(), key, scope); 
  
 // find key in Vhost.xml 
 key = "AppsDir"; 
 scope = "Adaptor:_defaultRoot_/VHost:_defaultVHost_"; 
 tSocket.call("getConfig2", new onGetConfig(), key, scope); 
  
 // find key in Application.xml for app "foo" 
 key = "Process/Scope"; 
 scope = "Adaptor:_defaultRoot_/VHost:_defaultVHost_/App:foo"; 
 tSocket.call("getConfig2", new onGetConfig(), key, scope); 
  
 // find key in default Application.xml 
 key = "Process/Scope"; 
 scope = "Adaptor:_defaultRoot_/VHost:_defaultVHost_/App"; 
 tSocket.call("getConfig2", new onGetConfig(), key, scope); 
  
 // return the whole Vhost.xml 
 key = ""; 
 scope = "Adaptor:_defaultRoot_/VHost:_defaultVHost_"; 
 tSocket.call("getConfig2", new onGetConfig(), key, scope);

See also

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy