- From the STAF CD, unzip file
Part3\install\FSExtV302.zip to C:\STAF\services.
-
Edit the C:\STAF\bin\STAF.cfg file and add
the lines
service fsext library JSTAF execute C:/STAF/services/fsext/STAFFSExt.jar
Save the changes to the STAF.cfg file and restart STAF.
-
From a command prompt, type
staf local fsext filecontains file C:/STAF/bin/STAF.cfg string email
you should get back an empty result buffer, since
the STAF.cfg does contain the string "email".
-
From a command prompt, type
staf local fsext filecontains file C:/STAF/bin/STAF.cfg string emailXTZ
you should an RC 4006.
-
From a command prompt, type
staf local help service fsext error 4006
you should help for this return code. Note that
service-specific return codes are in the 4000+ range.
-
From a command prompt, type (substituting the
correct location for <STAFCD>)
staf local zip list zipfile <STAFCD>/Part2/install/STAXV345.zip
you should see the contents of the zip file.
-
We will need a static handle for the next several
services. From a command prompt, type
staf local handle create handle name MyHandle
you should get back a handle number (for our
examples we will use "33", but you should use the handle number you just
received)
set STAF_STATIC_HANDLE=33
-
From a command prompt, type
staf local monitor log message "We are doing Exercise 3.1"
-
From a command prompt, type (substitute your
handle for "33")
staf local monitor query machine {STAF/Config/MachineNickname} handle 33
you should get the status returned.
-
From a command prompt, type
staf local respool create pool exercise3.1 description "Respool for exercise 3.1"
this will create the resource pool.
-
From a command prompt, type
staf local respool add pool exercise3.1 entry abc1 entry abc2
this will add 2 entries to the resource pool.
-
From a command prompt, type
staf local respool request pool exercise3.1
staf local respool request pool exercise3.1
this will acquire the 2 entries in the resource pool.
-
From a command prompt, type
staf local respool request pool exercise3.1 timeout 10000
this will another entry from the resource pool, and
wait for a maximum of 10 seconds. You should see the request wait for 10 seconds
and then return an RC 37.
-
From a command prompt, type
staf local help error 37
-
From a command prompt, type
staf local respool query pool exercise3.1
this will display information about the resource
pool.
-
From a command prompt, type
staf local respool delete pool exercise3.1 confirm force
this will delete the resource pool.
-
From a command prompt, type
staf local sem request mutex myMutex
this will acquire the "myMutex" mutex semaphore.
-
From a new command prompt, type
staf local sem request mutex myMutex
notice that this hangs because the semaphore
is in use.
-
Back in the original command prompt, type
staf local sem release mutex myMutex
notice that this handle has released the semaphore
and the request in the new command prompt window should have returned since
the semaphore was available.
-
From a command prompt, type
staf local trust list
this will list all of the trust settings
on the machine.
-
From a command prompt, type
staf local service list
this will list all of the registered services
on the machine.
-
From a command prompt, type
staf local delay delay 10000
this will delay for 10 seconds.
-
From a command prompt, type
staf local misc whoami
this will delay information about who the machine
thinks you are.
-
From a command prompt, type
staf local lifecycle register phase Startup
machine local service process request "start command notepad"
This will register a request with the LifeCycle
service so that the Notepad process is started when STAFProc starts. Note
that the registration ID (1) is returned.
-
From a command prompt, type
staf local lifecycle list
This will list all of the requests currently
registered with the LifeCycle service.
-
From a command prompt, type
staf local lifecycle query id 1
This will query the information about the
request you previously registered.
-
Shutdown STAFProc and restart it. Verify that
during the startup the Notepad process is started.
-
From a command prompt, type
staf local lifecycle unregister id 1
This will unregister the request.
- From the STAF CD, unzip file
Part3\install\NamespaceV102.zip to C:\STAF\services.
- From the STAF CD, unzip file
Part3\install\CronV338.zip to C:\STAF\services.
- From the STAF CD, unzip file
Part3\install\EventManagerV338.zip to C:\STAF\services.
- From the STAF CD, unzip file
Part3\install\HTTPV302.zip to C:\STAF\services.
- From the STAF CD, unzip file
Part3\install\FTPV103.zip to C:\STAF\services.
-
Edit the C:\STAF\bin\STAF.cfg file and add
the lines
service cron library JSTAF execute C:/STAF/services/cron/STAFCron.jar
service eventmanager library JSTAF \
execute C:/STAF/services/eventmanager/STAFEventManager.jar
service namespace library JSTAF execute C:/STAF/services/namespace/Namespace.jar
service http library JSTAF execute C:/STAF/services/http/STAFHTTP.jar
service ftp library JSTAF execute C:/STAF/services/ftp/STAFFTP.jar
Save the changes to the STAF.cfg file and restart STAF.
-
From a command prompt, type
staf local namespace create namespace Part3Exercises description "Exercises for Part 3"
staf local namespace set var Exercise=3.2 namespace Part3Exercises
staf local namespace query namespace Part3Exercises
staf local namespace list namespace Part3Exercises
-
Now shutdown STAF and restart it. Run the
following commands and verify you get the same output as the previous step:
staf local namespace query namespace Part3Exercises
staf local namespace list namespace Part3Exercises
-
From a command prompt, type (substituting your
email address for <user>)
staf local email send to <user>@us.ibm.com subject "Test Message"
message "Hello and Welcome to STAF/STAX"
go to your Inbox and you should see the email.
-
From a command prompt, type
staf local eventmanager register machine local service process
request "start command notepad" type abc subtype xyz
this will register with the EventManager service so
that it will call the Process service to execute "Notepad" whenever an event
of type "abc" and subtype "xyz" is generated. Note that the registration ID
is returned.
-
From a command prompt, type
staf local event generate type abc subtype xyz
this will generate an event with type "abc" and
subtype "xyz". This should cause the notepad process to start on your machine.
-
From a command prompt, type (substituting the
correct registration ID, if it is not 1)
staf local eventmanager unregister id 1
-
From a command prompt, type
staf local cron register machine local service process
request "start command notepad" minute any
this will register with the Cron service so
that it will call the Process service to execute "Notepad" every minute.
Note that the registration ID is returned. Let several minutes pass by, and
you should see the notepad process started every time the minute changes.
-
From a command prompt, type (substituting the
correct registration ID, if it is not 1)
staf local cron unregister id 1
-
From a command prompt, type
staf local http open session
this will open a new session. Notice that the
session ID is returned in the result buffer.
-
From a command prompt, type
staf local HTTP DOGET URL http://money.cnn.com/quote/quote.html/?symb=IBM RETURNNOCONTENT SESSION 1
this will get the current IBM stock quote.
-
From a command prompt, type
staf local HTTP GET SESSION 1 CONTENT FILE c:/temp/ibmquote.html
this will store the current contents of a session
(1) in a file (c:/temp/ibmquote.html). The c:/temp/ibmquote.html file should be
an html file equivalent to acquiring the page in a browser.
-
Open a browser and navigate to the
c:/temp/ibmquote.html file, which should contain the current IBM stock
quote.
-
From a command prompt, type
staf local FTP HELP
this will display the help for the FTP service.
If you have access to an FTP site, try submitting some commands to the FTP
site via the STAF FTP service.