perfSONAR_PS::Datatypes::EventTypes::Status - a container for various perfSONAR http://schemas.perfsonar.net/status/ eventtypes


perfSONAR_PS-Services-PingER documentation Contained in the perfSONAR_PS-Services-PingER distribution.

Index


Code Index:

NAME

Top

    perfSONAR_PS::Datatypes::EventTypes::Status -  a container for various perfSONAR http://schemas.perfsonar.net/status/ eventtypes 

DESCRIPTION

Top

The purpose of this module is to create OO interface for status eventtypes and therefore add the layer of abstraction for any status eventtypes related operation ( mostly for perfSONAR response). All perfSONAR-PS classes should work with the instance of this class and avoid using explicit eventtype declarations.

SYNSTATUSIS

Top

    use perfSONAR_PS::Datatypes::EventTypes::Status; 

    # create Status eventtype object with default URIs
    my $sd_status = perfSONAR_PS::Datatypes::EventTypes::Status->new('setupdata');

    print  $sd_status->success
    # will print: "http://schemas.perfsonar.net/status/success/setupdata/1.0/"
    # overwrite only specific Namesapce   with  custom URI 

    


Methods

Top

There is accessor mutator for every defined status

new('operationName')

Creates a new object, accepts scalar operation name, if missed then default is 'echo'

operation('operationName')

Resets current operation or returns it if argument is missed

Supported Status:

  success / failure 




SEE ALSO

Top

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.

AUTHOR

Top

Maxim Grigoriev, <maxim@fnal.gov>, 2007

COPYRIGHT AND LICENSE

Top


perfSONAR_PS-Services-PingER documentation Contained in the perfSONAR_PS-Services-PingER distribution.
package perfSONAR_PS::Datatypes::EventTypes::Status;

use strict;
use warnings;
use version; our $VERSION = 0.09; 
use Log::Log4perl qw(get_logger);
use Class::Accessor;
use Class::Fields;
use base qw(Class::Accessor Class::Fields);
use fields qw( success failure operation);
perfSONAR_PS::Datatypes::EventTypes::Status->mk_accessors(perfSONAR_PS::Datatypes::EventTypes::Status->show_fields('Public'));

use constant { 
              CLASSPATH => "perfSONAR_PS::Datatypes::EventTypes::Status",
              STATUS  => "http://schemas.perfsonar.net/status",
              RELEASE => "1.0"
	      };
	      
       
sub new {
    my $that = shift;
    my $operation  = shift;
  
    my $logger  = get_logger( CLASSPATH ); 
 
    if($operation && !ref($operation))   {
        $logger->error("ONLY single scalar parameter accepted" . $operation ); 
        return undef;
    }
    my $class = ref($that) || $that;
    my $self =  fields::new( $class );  
    $operation = 'echo' unless $operation;
    $self->_init($operation);
    return $self;

}

#
#   initialize status types with operation
#

sub _init {
    my $self = shift;
    my $operation = shift;
    foreach my $tool (qw/success failure/) {
        $self->{$tool} = STATUS . "/$tool/$operation/" . RELEASE . "/";
    } 

}
sub operation {
    my $self = shift;
    my $operation  = shift; 
    if($operation) {
        $self->_init($operation);
    } else {
        return $self->{operation};
    }
}
 
1;

 
__END__