NAME
perfSONAR_PS::Datatypes::Message - this is a message handler object
DESCRIPTION
new will return undef in case of wrong parameters ( will return Error object in the future )
it accepts only one parameter - reference, thats it
the reference might be of type:
hashref to the hash with named parameters which can be used to initialize this object
or
DOM object
or
hashref with single key { xml => <xmlString>}, where xmlString ,must be valid Message xml element or document
it extends:
use perfSONAR_PS::Datatypes::v2_0::nmwg::Message;
Namespaces will be added dynamically from the underlying data and metadata
SYNOPSIS
use perfSONAR_PS::Datatypes::Message ;
my ($DOM) = $requestMessage->getElementsByTag('message');
my $message = new perfSONAR_PS::Datatypes::Message($DOM);
$message = new perfSONAR_PS::Datatypes::Message({id => '2345',
type = 'SetupdataResponse',
metadata => {'id1' => <obj>},
data=> {'id1' => <obj>}});
####### add data element, namespaces will be added from this object to Message object namespace declaration
$message->addPartById('id1', 'data', new perfSONAR_PS::Datatypes::Message::data({id=> 'id1', metadataIdRef => 'metaid1' }));
########add metadata element, namespaces will be added from this object to Message object namespace declaration
$message->addPartById('id1', 'metadata', new perfSONAR_PS::Datatypes::Message::metadata({id=> 'id1' });
my $dom = $message->getDOM(); # get as DOM
print $message->asString(); # print the whole message
METHODS
new( )
creates message object, accepts parameter in form of:
DOM with nmwg:message element tree or hashref to the list of
type => <string>, id => <string> , namespace => {}, metadata => {}, ..., data => { } ,
or DOM object or hashref with single key { xml => <xmlString>}
it extends:
use perfSONAR_PS::Datatypes::v2_0::nmwg::Message
All parameters will be passed first to superclass
filters
add another filter object ( md ) or return array of filters
filters
set filters array or return it
eventTypes
set or return eventType
DBO
set or return DB object
mdID
set id number for metadata element
if no argument supplied then just return the current one
add_mdID
increment id number for metadata element
add_dataID
increment id number for data element
dataID
set id number for data element
if no argument supplied then just return the current one
getDom()
accepts parent DOM object as argument
returns newly created DOM with all namespaces acquired from underlying elements
getChain
accept current metadata and chain this metadata with every reffered metadata,
clone it, merge it with chained metadata and return new metadata
eventType must be the same or eventTypes->ops->select
addIDMetadata
add supplied metadata, set id and set supplied eventtype
arguments: $md, $eventType
md id will be set as "meta$someid"
then metaId counter will be increased
returns: set metadata id
addResultData
add data with result datum only to the message
arguments: hashref with keys - {metadataIdRef => $metaidkey, message => $message, eventType => $eventType})
returns: set data id
addResultResponse
add md with eventype and data with result datum, where contents of the datum is some message
arguments: hashref - {md => $md, message => $message, eventType => $eventType})
if $md is not supplied then new will be created and
returns: $self
MetadataKeyRequest
this is abstract handler method for MetadataKey request, accepts response Message object
returns filled response message object or error message
SetupDataRequest
this is abstract handler method forSetupData request, accepts response Message object
returns filled response message object or error message
MeasurementArchiveStoreRequest
this is abstract method for MeasurementArchiveStore request, must be implemented by the tool
returns filled response message object or error message
buildQuery
build query for sql specific operation: ['lt', 'gt','eq','ge','le','ne']
arguments: operation and element object to run querySQL on
returns: hashref to the found parameters and query as arrayref of form [ entryname1 => {'operator' => 'value1'}, entryname2 => {'operator' => 'value2'}, .... ]
the whole structure will look as:
{ 'query_<tablename>' => [ <query> ], '<tablename>' => { sql_entry1 => value1, sql_entry2 => value2, ...} }
processTime
finds set time range from any element in the Message objects tree which is able to contain nmtm parameter with
startTime/endTime selects or timestamp
returns: hashref suitable for SQL query in form of - { gt => <unix epoch time>, lt => <unix epoch time>} or { eq => <unix epoch time>}
$timequery->{eq|gt|lt} = unix_time
arguments: hashref - {element => <element object with time inside>, timehash => <timehash in form of {'start' => <>, 'end' =>'', duration => ''}>}
AUTHORS
Maxim Grigoriev (FNAL) 2007
COPYRIGHT AND LICENSE
Copyright (C) 2007 by Internet2 Copyright (C) 2007 by Fermitools, Fermilab
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.