Previous Topic: Export Realm Objects

Next Topic: Modify a Password Policy

Import Realm Objects

Some points to note about importing realm objects:

Example:

use Netegrity::PolicyMgtAPI;

$policyapi = Netegrity::PolicyMgtAPI‑>New();
$session = $policyapi‑>CreateSession("adminsouth", "adminpwd");
$datamgr = $session‑>CreateDataManager("Data.smdif",NorthEnv.cfg);
die "FATAL: Data manager creation failed.\n" unless($datamgr!=undef);

print "\nData manager creation was successful.";
$domain = $session‑>GetDomain("Acme North Domain");
$result=$datamgr‑>Import("SouthEnv.cfg",$domain);
print "\nResult of import: " . $result . "\n";

When importing objects from multiple data files, you need a PolicyMgtDataMgr object for each file.

Example:

The following script imports realm objects to the policy store at a company's South site from two other sites—a North site and a West site. At the South site, the data and configuration files generated from each export are placed in the same directory as the import script. The South-site configuration file is also located there:

use Netegrity::PolicyMgtAPI;

$policyapi = Netegrity::PolicyMgtAPI‑>New();
$session = $policyapi‑>CreateSession("adminsouth", "adminpwd");

$domain = $session‑>GetDomain("Acme South Domain");

#create data manager for North site file
$mNorth=$session‑>CreateDataManager("DataNorth.smdif","NorthEnv.cfg");
if ($mNorth == undef) {
   print "\nData manager creation for North site file failed.\n";
}
else {
   print "\nData manager creation for North site file successful.\n";
   #Import realms from North site file
   $result=$mNorth‑>Import("SouthEnv.cfg",$domain);
   print "\nResult of import of North site realms: ".$result."\n";
}

#create data manager for West site file
$mWest=$session‑>CreateDataManager("DataWest.smdif","WestEnv.cfg");
if ($mWest == undef) {
   print "\nData manager creation for West site file failed.\n";
}
else {
   print "\nData manager creation for West site file successful.\n";
   #Import realms from West site file
   $result=$mWest‑>Import("SouthEnv.cfg",$domain);
   print "\nResult of import of West site realms: ".$result."\n";
}


Copyright © 2010 CA. All rights reserved. Email CA about this topic