Retrieving the current configuration for a device
The retrieving the current configuration for a device example shows how to retrieve the current configuration for a device.
Once a device configuration has been successfully imported, it can be retrieved in either the native format or XML format from the corresponding NetworkResource.
ApiSession session;
ResourceManager rMgr;
NetworkResourceKey nrKey;
.
.
.
//it is assumed the session has been established
rMgr = session. resourceManager ();
.
.
.
//it is assumed that nrKey has been set
//(perhaps from an earlier create)
//we will need the NetworkResource object;
//to get it we need the descriptor
ResourceContentDescriptor nrRCD =
(ResourceContentDescriptor)rMgr.getResourceDescriptor(nrKey);
//now we can get the NetworkResource
NetworkResource nr = (NetworkResource)rMgr.getResource(nrRCD);
//next we get the key of the current configuration
ConfigurationKey cfgKey = nr.getCurrentConfigurationKey();
//with the key we can get the descriptor
ResourceContentDescriptor cfgRCD =
(ResourceContentDescriptor)rMgr.getResourceDescriptor(cfgKey);
//and from the descriptor we can get the Configuration object
Configuration config = (Configuration)rMgr.getResource(cfgRCD);
//finally we can get the configuration content
String nativeConfig = config. getGlobalConfigurationVersionBlob();
String xmlConfig = config.getXmlString();