| perfSONAR_PS-Services-PingER documentation | view source | Contained in the perfSONAR_PS-Services-PingER distribution. |
Object representation of the metadata element.
Object fields are:
Scalar: metadataIdRef,
Scalar: id,
Object reference: subject => type ARRAY,
Object reference: parameters => type ARRAY,
Object reference: eventType => type ,
Object reference: key => type HASH,
The constructor accepts only single parameter, it could be a hashref to parameters hash or DOM with 'metadata' element
use perfSONAR_PS::Datatypes::v2_0::nmwg::Message::Metadata;
my $el = perfSONAR_PS::Datatypes::v2_0::nmwg::Message::Metadata->new($DOM_Obj);
creates object, accepts DOM with element tree or hashref to the list of
keyd parameters
metadataIdRef => undef,
id => undef,
subject => ARRAY,
parameters => ARRAY,
key => HASH,
accept parent DOM
return metadata object DOM, generated from object contents
if any of subelements can be an arrray then this method will provide
facility to add another element to the array and will return ref to such array
or just set the element to a new one
=cut
sub addSubject { my $self = shift; my $new = shift; my $logger = get_logger( $CLASSPATH );
$self->subject && ref($self->subject) eq 'ARRAY'?push @{$self->subject}, $new:$self->subject([$new]);
$logger->debug("Added new to subject");
$self->buildIdMap; ## rebuild index map
$self->buildRefIdMap; ## rebuild ref index map
return $self->subject;
}
remove specific element from the array of subject elements by id ( if id is supported by this element )
accepts single param - id - which is id attribute of the element
if there is no array then it will return undef and warninig
if it removed some id then $id will be returned
get specific element from the array of subject elements by id ( if id is supported by this element )
accepts single param - id
if there is no array then it will return just an object
if any of subelements can be an arrray then this method will provide
facility to add another element to the array and will return ref to such array
or just set the element to a new one
=cut
sub addParameters { my $self = shift; my $new = shift; my $logger = get_logger( $CLASSPATH );
$self->parameters && ref($self->parameters) eq 'ARRAY'?push @{$self->parameters}, $new:$self->parameters([$new]);
$logger->debug("Added new to parameters");
$self->buildIdMap; ## rebuild index map
$self->buildRefIdMap; ## rebuild ref index map
return $self->parameters;
}
remove specific element from the array of parameters elements by id ( if id is supported by this element )
accepts single param - id - which is id attribute of the element
if there is no array then it will return undef and warninig
if it removed some id then $id will be returned
get specific element from the array of parameters elements by id ( if id is supported by this element )
accepts single param - id
if there is no array then it will return just an object
depending on config it will return some hash ref to the initialized fields
for example querySQL ()
accepts one optional prameter - query hashref
will return:
{ ip_name_src => 'hepnrc1.hep.net' },}
merge with another metadata ( append + overwrite if exists )
we can do it differently
method #1:
convert to dom both objects and then get resulted object from combined dom
method #2 default:
through the introspection of the object
if any of subelements has id then get a map of it in form of
hashref to { element}{id} = index in array and store in the idmap field
will parse all subelements and register all namepspaces within the metadata namespace
Maxim Grigoriev (FNAL) 2007-2008, maxim@fnal.gov
| perfSONAR_PS-Services-PingER documentation | view source | Contained in the perfSONAR_PS-Services-PingER distribution. |