The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

perfSONAR_PS::RequestHandler - A module that provides an object to register event and message handlers for a perfSONAR Service.

DESCRIPTION

This module is used by the daemon in the pS-PS Daemon architecture. The daemon creates a Handler object and passes it to each of the modules who, in turn, register which message types or event types they are interested in.

API

new($) This function allocates a new Handler object.

addFullMessageHandler($self, $messageType, $service) This function is used by a pS service to specify that it would like to handle the complete processing for messages of the specified type. If called, the service must have a handleMessage function. This function will be called when a message of the specified type is received. The handleMessage function is then responsible for all handling of the message.

addMessageHandler($self, $messageType, $service) This function is used by a pS service to specify that it would like to be informed of all the metadata/data pairs for a given message. The handler will also inform the module when a new message of the specified type is received as well as when it has finished processing for the message. If a message handler is registered, the following functions must be defined in the $service specified: handleMessageBegin, handleMessageEnd and handleEvent. handleMessageBegin will be called when a new message of the specified type is received. handleEvent will be called each time a metadata/data pair is found in the message. handleMessageEnd will be called when all the metadata/data pairs have been handled.

addEventHandler($self, $messageType, $eventType, $service) This function is used to tell which events a pS service is interested in. If added, there must be a 'handleEvent' function defined in the service module. The 'handleEvent' function in the specified service will be called for each metadata/data pair with an event type of the specified type found in a message of the specified type.

addEventHandler_Regex($self, $messageType, $eventRegex, $service) This function is used to tell which events a pS service is interested in. If added, there must be a 'handleEvent' function defined in the service module. The 'handleEvent' function in the specified service will be called for each metadata/data pair with an event type matching the specified regular expression found in a message of the specified type.

__handleMessage ($self, $doc, $messageType, $message, $request); The __handleMessage function is called when a message is encountered that has a full message handler.

__handleMessageBegin ($self, $ret_message, $messageId, $messageType, $msgParams, $request, $retMessageType, $retMessageNamespaces); The __handleMessageBegin function is called when a new message is encountered that has a message handler.

__handleMessageEnd ($self, $ret_message, $messageId, $messageType); The __handleMessageEnd function is called when all the metadata/data pairs in a message have been handled.

handleEvent ($self, $doc, $messageId, $messageType, $message_parameters, $eventType, $md, $d, $raw_request); The handleEvent function is called when a metadata/data pair is found in a message. $doc contains the response document that being constructed. $messageId contains the identifier for the message. $messageType contains the type of the message. $message_parameters is a reference to a hash containing the message parameters. $eventType contains the event type (if it exists). $md contains the metadata. $d contains the data. $raw_request contains the raw request element.

isValidMessageType($self, $messageType); The isValidMessageType function can be used to check if a specific message type can be handled by either a full message handler, a message handler or an event type handler for events in that type of message. It returns 0 if it's invalid and non-zero if it's valid.

isValidEventType($self, $messageType, $eventType); The isValidEventType function can be used to check if a specific event type found in a specific message type can be handled. It returns 0 if it's invalid and non-zero if it's valid.

hasFullMessageHandler($self, $messageType); The hasFullMessageHandler checks if there is a full message handler for the specified message type.

hasMessageHandler($self, $messageType); The hasMessageHandler checks if there is a message handler for the specified message type.

handleRequest($self, $request); The handleRequest function takes a perfSONAR_PS::Request element containing an incoming SOAP request and handles that request by parsing it, checking the message type, and either calling a full message handler, or iterating through the message calling the handler for each event type. This function sets the response for the request.

SEE ALSO

Log::Log4perl, perfSONAR_PS::XML::Document_string perfSONAR_PS::Common, perfSONAR_PS::Messages

To join the 'perfSONAR-PS' mailing list, please visit:

https://mail.internet2.edu/wws/info/i2-perfsonar

The perfSONAR-PS subversion repository is located at:

https://svn.internet2.edu/svn/perfSONAR-PS

Questions and comments can be directed to the author, or the mailing list. Bugs, feature requests, and improvements can be directed here:

https://bugs.internet2.edu/jira/browse/PSPS

VERSION

$Id:$

AUTHOR

Aaron Brown, aaron@internet2.edu, Jason Zurawski, zurawski@internet2.edu

LICENSE

You should have received a copy of the Internet2 Intellectual Property Framework along with this software. If not, see <http://www.internet2.edu/membership/ip.html>

COPYRIGHT

Copyright (c) 2004-2007, Internet2 and the University of Delaware

All rights reserved.