Mercurial > pub > Impl
diff Lib/Deployment/Batch/Generic.pm @ 49:16ada169ca75
migrating to the Eclipse IDE
author | wizard@linux-odin.local |
---|---|
date | Fri, 26 Feb 2010 10:49:21 +0300 |
parents | 03e58a454b20 |
children |
line wrap: on
line diff
--- a/Lib/Deployment/Batch/Generic.pm Fri Feb 26 01:43:42 2010 +0300 +++ b/Lib/Deployment/Batch/Generic.pm Fri Feb 26 10:49:21 2010 +0300 @@ -1,87 +1,87 @@ -use strict; -package Deployment::Batch; -our @history; - -package Deployment::Batch::Generic; -use Common; -use Time::HiRes; -our @ISA = qw(Object); - -BEGIN { - DeclareProperty isProcessed => ACCESS_READ; - DeclareProperty LastError => ACCESS_READ; - DeclareProperty LocalHistory => ACCESS_NONE; -} - -sub _Run { - my ($this) = @_; - - undef $@; - local @history = (); - my $t0 = [Time::HiRes::gettimeofday]; - eval { - $this->Run; - }; - $this->Log("completed in ",Time::HiRes::tv_interval($t0)," s"); - - if ($@) { - $this->{$LastError} = $@; - Deployment::Batch::Rollback; # rallback nested actions - return 0; - } - - $this->{$LocalHistory} = \@history; - $this->{$isProcessed} = 1; - - return 1; -} - -sub Name { - my $this = shift; - (my $mod = ref $this) =~ s/^(?:\w+\:\:)*(\w+)$/$1/; - return $mod; -} - -sub _Rollback { - my ($this) = @_; - - undef $@; - eval { - $this->Rollback; - }; - - if ($@) { - $this->{$LastError} = $@; - } - - $this->{$isProcessed} = 0; - - if ($this->{$LocalHistory}) { - local @history = @{$this->{$LocalHistory}}; - Deployment::Batch::Rollback; - } - - return 1; -} - -sub Context { - my $this = shift; - - return \%Deployment::Batch::Context; -} - -sub Log { - my $this = shift @_; - if ($this->Context->{LogOutput}) { - my $out = $this->Context->{LogOutput}; - print $out $this->Name,": ",@_,"\n"; - } -} - -sub Run { -} - -sub Rollback { -} - -1; \ No newline at end of file +use strict; +package Deployment::Batch; +our @history; + +package Deployment::Batch::Generic; +use Common; +use Time::HiRes; +our @ISA = qw(Object); + +BEGIN { + DeclareProperty isProcessed => ACCESS_READ; + DeclareProperty LastError => ACCESS_READ; + DeclareProperty LocalHistory => ACCESS_NONE; +} + +sub _Run { + my ($this) = @_; + + undef $@; + local @history = (); + my $t0 = [Time::HiRes::gettimeofday]; + eval { + $this->Run; + }; + $this->Log("completed in ",Time::HiRes::tv_interval($t0)," s"); + + if ($@) { + $this->{$LastError} = $@; + Deployment::Batch::Rollback(); # rallback nested actions + return 0; + } + + $this->{$LocalHistory} = \@history; + $this->{$isProcessed} = 1; + + return 1; +} + +sub Name { + my $this = shift; + (my $mod = ref $this) =~ s/^(?:\w+\:\:)*(\w+)$/$1/; + return $mod; +} + +sub _Rollback { + my ($this) = @_; + + undef $@; + eval { + $this->Rollback; + }; + + if ($@) { + $this->{$LastError} = $@; + } + + $this->{$isProcessed} = 0; + + if ($this->{$LocalHistory}) { + local @history = @{$this->{$LocalHistory}}; + Deployment::Batch::Rollback(); + } + + return 1; +} + +sub Context { + my $this = shift; + + return \%Deployment::Batch::Context; +} + +sub Log { + my $this = shift @_; + if ($this->Context->{LogOutput}) { + my $out = $this->Context->{LogOutput}; + print $out $this->Name,": ",@_,"\n"; + } +} + +sub Run { +} + +sub Rollback { +} + +1;