Fetch From Options Cache: Difference between revisions
No edit summary |
No edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
'Tips for developers working within the Sysgem Enterprise Manager (SEM) environment'. | 'Tips for developers working within the Sysgem Enterprise Manager (SEM) environment'. | ||
---- | |||
''Fetching Central Options Cache Data | ''Fetching Central Options Cache Data into a script running on the SEM user's workstation'' | ||
'''Sysgem::SEMAuthSvrOptionsCacheFetch()''' | |||
Perl scripts running on the SEM user's workstation can fetch data from a file held in the "Central Options Cache" on the SEM Authorization Server by using the following SEM API command: | |||
use Sysgem; | |||
my $directory = "TestFolder"; # name of the subdirectory in the options cache | |||
my $file = "TestFile.txt"; # name of the file to read | |||
my $tempfile = ""; # for path to local temporary file | |||
my $path = $directory . "\\" . $file; | |||
# | |||
# retrieve the file | |||
# | |||
my $retval = Sysgem::SEMAuthSvrOptionsCacheFetch($path, $tempfile, $error); | |||
The Central Options cache folder is located: | |||
\Program Files\Sysgem\SEM OptionsCache | |||
'''An Example Task Script''' | '''An Example Task Script''' | ||
You can create a test SEM Task using this API by copying the script shown below and pasting it into the "Agent - Windows NT" script of a new SEM Task. | |||
Run the SEM Task after first creating a test folder and a test file under the Central Options Cache on the Authorization Server. | |||
The test folder and file to be created is: | |||
\Program Files\Sysgem\SEM OptionsCache\TestFolder\TestFile.txt. | |||
The content of this test file will be printed by the following example SEM Task script: | |||
#++++++++++++++++++++++++++++++++++ | #++++++++++++++++++++++++++++++++++ | ||
| Line 59: | Line 90: | ||
# tidy up | # tidy up | ||
# | # | ||
unlink($tempfile); | |||
print "Temporary file removed\n"; | |||
'''SEM Task Output:''' | |||
The output from the above example task script is shown below: | |||
[[File:TaskFetchOptionsCache. | [[File:TaskFetchOptionsCache.jpg]] | ||
Latest revision as of 10:26, 24 February 2011
'Tips for developers working within the Sysgem Enterprise Manager (SEM) environment'.
Fetching Central Options Cache Data into a script running on the SEM user's workstation
Sysgem::SEMAuthSvrOptionsCacheFetch()
Perl scripts running on the SEM user's workstation can fetch data from a file held in the "Central Options Cache" on the SEM Authorization Server by using the following SEM API command:
use Sysgem; my $directory = "TestFolder"; # name of the subdirectory in the options cache my $file = "TestFile.txt"; # name of the file to read my $tempfile = ""; # for path to local temporary file my $path = $directory . "\\" . $file; # # retrieve the file # my $retval = Sysgem::SEMAuthSvrOptionsCacheFetch($path, $tempfile, $error);
The Central Options cache folder is located:
\Program Files\Sysgem\SEM OptionsCache
An Example Task Script
You can create a test SEM Task using this API by copying the script shown below and pasting it into the "Agent - Windows NT" script of a new SEM Task.
Run the SEM Task after first creating a test folder and a test file under the Central Options Cache on the Authorization Server.
The test folder and file to be created is:
\Program Files\Sysgem\SEM OptionsCache\TestFolder\TestFile.txt.
The content of this test file will be printed by the following example SEM Task script:
#++++++++++++++++++++++++++++++++++
# |
# Windows NT script (PERL). |
# |
#++++++++++++++++++++++++++++++++++
#
#
#
# fetch the content of file directly from the Central AuthServer to a local file
# - out of a sub-folder in the Central Options Cache
#
use Sysgem;
#
# the file path from the Options cache
#
my $directory = "TestFolder"; # name of the subdirectory in the options cache
my $file = "TestFile.txt"; # name of the file to read
my $tempfile = ""; # for path to local temporary file
my $path = $directory . "\\" . $file;
#
# retrieve the file
#
my $retval = Sysgem::SEMAuthSvrOptionsCacheFetch($path, $tempfile, $error);
#
# show the path to the local temporary file created
#
print "Path to temporary file : [$tempfile]\n\n";
#
# print the content of the file
#
if (open TEMPFILE, "< $tempfile")
{
my @lines = <TEMPFILE>;
close TEMPFILE;
print "-- <Start of temporary file> --\n";
foreach my $item (@lines)
{
print "$item";
}
print "-- <End of temporary file> --\n\n";
}
else
{
print "can't open temp file [$tempfile]\n";
}
#
# tidy up
#
unlink($tempfile);
print "Temporary file removed\n";
SEM Task Output:
The output from the above example task script is shown below:
