perfSONAR_PS::Datatypes::v2_0::nmwg::Message::Data::CommonTime - A base class, implements 'commonTime' element from the perfSONAR_PS RelaxNG schema


perfSONAR_PS-Services-PingER documentation  | view source Contained in the perfSONAR_PS-Services-PingER distribution.

Index


DESCRIPTION

Top

   Object representation of the commonTime element.
   Object fields are:
    Scalar:     inclusive, 
    Scalar:     value, 
    Scalar:     duration, 
    Scalar:     type, 
    Object reference:   start => type HASH,
    Object reference:   end => type HASH,
    Object reference:   datum => type ARRAY,

   The constructor accepts only single parameter, it could be a hashref to parameters hash  or DOM with  'commonTime' element 

    


SYNOPSIS

Top

              use perfSONAR_PS::Datatypes::v2_0::nmwg::Message::Data::CommonTime;

          my $el =  perfSONAR_PS::Datatypes::v2_0::nmwg::Message::Data::CommonTime->new($DOM_Obj);

METHODS

Top

new( )

      creates   object, accepts DOM with  element tree or hashref to the list of
      keyd parameters
         inclusive   => undef, 
         value   => undef, 
         duration   => undef, 
         type   => undef, 
         start => HASH,
         end => HASH,
         datum => ARRAY,

getDOM ($)

       accept parent DOM
       return commonTime object DOM, generated from object contents 

adddatum()

    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 addDatum { my $self = shift; my $new = shift; my $logger = get_logger( $CLASSPATH );

    $self->datum && ref($self->datum) eq 'ARRAY'?push @{$self->datum}, $new:$self->datum([$new]); 
    $logger->debug("Added new to datum"); 
    $self->buildIdMap; ## rebuild index map 
    $self->buildRefIdMap; ## rebuild ref index map  
    return $self->datum;
}

removeDatumById()

     remove specific element from the array of datum 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

getDatumById()

     get specific element from the array of datum 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

querySQL ()

      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

      merge with another commonTime ( 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

buildIdMap()

    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

registerNamespaces ()

   will parse all subelements and register all namepspaces within the commonTime namespace

AUTHORS

Top

   Maxim Grigoriev (FNAL)  2007-2008, maxim@fnal.gov


perfSONAR_PS-Services-PingER documentation  | view source Contained in the perfSONAR_PS-Services-PingER distribution.