Fetch From Options Cache: Difference between revisions

From Sysgem Support
Jump to navigationJump to search
Created page with " #++++++++++++++++++++++++++++++++++ # | # Windows NT script (PERL). | # | #+++++++++++++..."
 
No edit summary
Line 1: Line 1:
'Tips for developers working within the Sysgem Enterprise Manager (SEM) environment'.
== Fetching Data from the Central Options cache using API calls to the SEM Authorization Server  ==
''Fetching Central Options Cache Data from a script running on the workstation''
'''An Example Task Script'''
Copy the script shown belowand paste it into the Windows script of a
     #++++++++++++++++++++++++++++++++++
     #++++++++++++++++++++++++++++++++++
     #                                |
     #                                |
Line 10: Line 22:
     #  - out of a sub-folder in the Central Options Cache  
     #  - out of a sub-folder in the Central Options Cache  
     #
     #
     use Sysgem;
     use Sysgem;
     #
     #
     #  the file path from the Options cache
     #  the file path from the Options cache
Line 19: Line 29:
     my $file      = "TestFile.txt";          # name of the file to read
     my $file      = "TestFile.txt";          # name of the file to read
     my $tempfile  = "";                      # for path to local temporary file
     my $tempfile  = "";                      # for path to local temporary file
     my $path = $directory . "\\" . $file;
     my $path = $directory . "\\" . $file;
     #
     #
     #  retrieve the file
     #  retrieve the file
     #
     #
     my $retval = Sysgem::SEMAuthSvrOptionsCacheFetch($path, $tempfile, $error);
     my $retval = Sysgem::SEMAuthSvrOptionsCacheFetch($path, $tempfile, $error);
     #
     #
     #  show the path to the local temporary file created
     #  show the path to the local temporary file created
     #
     #
     print "Path to temporary file : [$tempfile]\n\n";
     print "Path to temporary file : [$tempfile]\n\n";
     #
     #
     #  print the content of the file
     #  print the content of the file
Line 39: Line 45:
         my @lines = <TEMPFILE>;
         my @lines = <TEMPFILE>;
         close TEMPFILE;
         close TEMPFILE;
         print "-- <Start of temporary file> --\n";
         print "-- <Start of temporary file> --\n";
         foreach my $item (@lines)  
         foreach my $item (@lines)  
         {  
         {  
             print "$item";  
             print "$item";  
         }
         }
         print "-- <End of temporary file> --\n\n";
         print "-- <End of temporary file> --\n\n";
     }
     }
Line 53: Line 56:
         print "can't open temp file [$tempfile]\n";
         print "can't open temp file [$tempfile]\n";
     }
     }
     #
     #
     #  tidy up
     #  tidy up
Line 59: Line 61:
         unlink($tempfile);
         unlink($tempfile);
         print "Temporary file removed\n";
         print "Temporary file removed\n";
[[File:TaskFetchOptionsCache.jpr]]

Revision as of 17:03, 23 February 2011

'Tips for developers working within the Sysgem Enterprise Manager (SEM) environment'.

Fetching Data from the Central Options cache using API calls to the SEM Authorization Server

Fetching Central Options Cache Data from a script running on the workstation


An Example Task Script

Copy the script shown belowand paste it into the Windows script of a

   #++++++++++++++++++++++++++++++++++
   #                                 |
   #   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";


File:TaskFetchOptionsCache.jpr