You could submit a feature request to be able to import signal handlers 
from a file.

To open a new feature request, from http://staf.sourceforge.net select 
"Request New Feature" under the "Feedback" section on the navigation panel 
on the left.

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313

----- Forwarded by Sharon Lucas/Austin/IBM on 06/10/2013 11:34 AM -----

From:   Sharon Lucas/Austin/IBM@IBMUS
To:     Luca Robusto <lucarobu...@gmail.com>, 
Cc:     "staf-users@lists.sourceforge.net" 
<staf-users@lists.sourceforge.net>
Date:   06/10/2013 11:00 AM
Subject:        Re: [staf-users] signal handlers on a separate file



The import element (and the function-import element) only import functions 
(<function>...</function.) from other STAX XML files, not signal handlers 
(<signalhandler>...</signalhandler>) as described in the description of 
the import element in the STAX User's Guide.  So, this is why what you 
tried did not work. 

To have only one STAX xml file that contains all signal handlers for your 
STAX jobs, you would need to define them all in your main.xml file.  To 
then have separate files for each of the STAX jobs that you want to run 
that use these signal handlers, in addition to defining your signal 
handlers in your main.xml file, you could also define a starting function 
for each of your STAX jobs that use these signal handlers in your main.xml 
file.  Each starting function can simply import a separate STAX xml file 
that contains what you want that STAX job to do and then call its starting 
function (e.g. health_monitor_main) and it will be able to raise these 
signal handlers that were defined in your main.xml file.  If using the 
STAX Monitor to kick off your STAX job, specify the main.xml file and then 
use the "Functions" tab to specify the starting function (e.g. 
health_monitor), and then click on the "Start Job" button to start the 
job.  Or, use the "Job Wizard" button so you can be shown a list of the 
functions in the main.xml file and select the starting function, e.g . 
health_monitor, and click on the "Save" button to save the  job options 
specified via the job wizard and then click on the "Start Job" button to 
start the job.  Or, if starting the job via the command line, specify the 
starting function using the FUNCTION option on your STAX EXECUTE request 
(e.g. STAF local STAX EXECUTE FILE C:/stax/main.xml FUNCTION 
health_monitor JOBNAME "Health Monitor"). 

Here's an example: 

Contents of file main.xml: 

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!DOCTYPE stax SYSTEM "stax.dtd"> 

<stax> 

<!-- Define all signal handlers --> 

<signalhandler signal="'health_monitor_end'"> 
  <sequence> 
    <message>'signalhandler health_monitor_end ends the monitor'</message> 

    <terminate block="'main.Health_Monitor'"/> 
  </sequence> 
</signalhandler> 

<!-- Define all starting functions --> 

<function name="health_monitor" scope="local"> 
  <sequence> 
    <import file="'health_monitor.xml'"/> 
    <call function="'health_monitor_main'"/> 
  </sequence> 
</function> 

</stax> 

Contents of file health_monitor.xml: 

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!DOCTYPE stax SYSTEM "stax.dtd"> 

<stax> 

<function name="health_monitor_main" scope="local"> 
  <block name="'Health_Monitor'"> 
    <sequence> 
      <message>'Beginning of Health_Monitor block'</message> 
      <raise signal="'health_monitor_end'"/> 
      <message>'End of Health_Monitor block'</message> 
    </sequence> 
  </block> 
</function> 

</stax> 

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:        Luca Robusto <lucarobu...@gmail.com> 
To:        "staf-users@lists.sourceforge.net" 
<staf-users@lists.sourceforge.net>, 
Date:        06/10/2013 09:12 AM 
Subject:        [staf-users] signal handlers on a separate file 



I would like to write a STAX File containing all the signal handlers I 
need. 
In the STAX syntax I cannot import this file if not in a STAX function, is 
it right? 
If I import it in a function my thread doesn't see the signal handler 
created. 

My example is the following: 

main xml: 

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!DOCTYPE stax SYSTEM "stax.dtd"> 

<stax> 

<defaultcall function="defaultcall"/> 

<function name="defaultcall" scope="local"> 
<function-prolog> 
This is the function called to start the test 
</function-prolog> 

<sequence> 
<import file="'signal_handlers.xml'"/> 
...... 
..... 
..... 
..... 
</sequence></function></stax> 


signal_handlers.xml: 

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!DOCTYPE stax SYSTEM "stax.dtd"> 

<stax> 

<signalhandler signal="'health_monitor_end'"> 
<sequence> 
<message>'signalhandler health_monitor_end ends the monitor'</message> 
<terminate block="'main.Healt_Monitor'"/> 
</sequence> 
</signalhandler> 


</stax> 

why signal handler is not handled and I get error: 
"No signal handler exists associated with element raise" ? 

Regards. 

Luca.
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to