line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Copyright (c) 2002 Paul Winkeler. All Rights Reserved. |
3
|
|
|
|
|
|
|
# This program is free software; you may redistribute it and/or modify it under |
4
|
|
|
|
|
|
|
# the same terms as Perl itself. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package NBU::Schedule; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
9
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
85
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
1
|
|
|
1
|
|
53
|
use Exporter (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
13
|
1
|
|
|
1
|
|
5
|
use AutoLoader qw(AUTOLOAD); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
14
|
1
|
|
|
1
|
|
42
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
161
|
|
15
|
1
|
|
|
1
|
|
2
|
$VERSION = do { my @r=(q$Revision: 1.15 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r }; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
12
|
|
16
|
1
|
|
|
|
|
13
|
@ISA = qw(); |
17
|
1
|
|
|
|
|
4
|
@EXPORT = qw(); |
18
|
1
|
|
|
|
|
3
|
@EXPORT_OK = qw(); |
19
|
1
|
|
|
|
|
880
|
%EXPORT_TAGS = qw(); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
# The parent class, name and type of the schedule MUST be |
24
|
|
|
|
|
|
|
# provided. Next comes an optional IO stream from which to read the |
25
|
|
|
|
|
|
|
# window, residence and pool data, followed by any additional attributes |
26
|
|
|
|
|
|
|
# for the schedule itself. |
27
|
|
|
|
|
|
|
sub new { |
28
|
0
|
|
|
0
|
0
|
|
my $proto = shift; |
29
|
0
|
|
|
|
|
|
my $schedule = { |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
bless $schedule, $proto; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if (@_) { |
35
|
0
|
|
|
|
|
|
$schedule->{CLASS} = shift; |
36
|
0
|
|
|
|
|
|
$schedule->{NAME} = shift; |
37
|
0
|
|
|
|
|
|
$schedule->{TYPE} = shift; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
0
|
|
|
|
|
if (defined(my $pipe = shift)) { |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# |
43
|
|
|
|
|
|
|
# Read in one line with 7 pairs of window start and length numbers; record them as a 7 |
44
|
|
|
|
|
|
|
# element array of arrays. |
45
|
0
|
|
|
|
|
|
$_ = <$pipe>; |
46
|
0
|
|
|
|
|
|
while (/^SCHEDCAL/) { |
47
|
0
|
|
|
|
|
|
$_ = <$pipe>; |
48
|
|
|
|
|
|
|
} |
49
|
0
|
0
|
|
|
|
|
return undef if (!/^SCHEDWIN/); |
50
|
0
|
|
|
|
|
|
my @times = split; |
51
|
0
|
|
|
|
|
|
my @windows; |
52
|
0
|
|
|
|
|
|
for my $d (0..6) { |
53
|
0
|
|
|
|
|
|
$windows[$d] = [ shift @times, shift @times ]; |
54
|
|
|
|
|
|
|
} |
55
|
0
|
|
|
|
|
|
$schedule->{WINDOWS} = \@windows; |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
$_ = <$pipe>; return undef if (!/^SCHEDRES/); |
|
0
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my (@residences) = split; |
59
|
0
|
0
|
|
|
|
|
$schedule->{STUNIT} = NBU::StorageUnit->byLabel($residences[1]) if ($residences[1] ne "*NULL*"); |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
$_ = <$pipe>; return undef if (!/^SCHEDPOOL/); |
|
0
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my (@pools) = split; |
63
|
0
|
0
|
|
|
|
|
$schedule->{POOL} = NBU::Pool->byName($pools[0]) unless ($pools[0] eq "*NULL*"); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$schedule->{MAXMPX} = shift; |
66
|
0
|
|
|
|
|
|
$schedule->{FREQUENCY} = shift; |
67
|
0
|
|
|
|
|
|
my $retentionLevel = shift; |
68
|
0
|
|
|
|
|
|
$schedule->{RETENTION} = NBU::Retention->byLevel($retentionLevel); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# |
71
|
|
|
|
|
|
|
# Triggered by presence of the Fail On Error (FOE) tag in the Schedule definition |
72
|
0
|
0
|
|
|
|
|
if ($_[8]) { |
73
|
0
|
0
|
|
|
|
|
$_ = <$pipe>; return undef if (!/^SCHEDRL/); |
|
0
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
$_ = <$pipe>; return undef if (!/^SCHEDFOE/); |
|
0
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
return $schedule; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub name { |
82
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
return $self->{NAME}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub policy { |
88
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
return $self->{CLASS}; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub class { |
94
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
return $self->{CLASS}; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my %scheduleTypes = ( |
100
|
|
|
|
|
|
|
0 => "FULL", |
101
|
|
|
|
|
|
|
1 => "INCR", |
102
|
|
|
|
|
|
|
2 => "UBAK", |
103
|
|
|
|
|
|
|
3 => "UARC", |
104
|
|
|
|
|
|
|
4 => "CINC", |
105
|
|
|
|
|
|
|
); |
106
|
|
|
|
|
|
|
sub type { |
107
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
return $scheduleTypes{$self->{TYPE}}; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub frequency { |
113
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
return $self->{FREQUENCY}; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub maximumMPX { |
119
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
return $self->{MAXMPX}; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub retention { |
125
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
return $self->{RETENTION}; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub pool { |
131
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
132
|
|
|
|
|
|
|
|
133
|
0
|
0
|
|
|
|
|
return defined($self->{POOL}) ? $self->{POOL} : $self->class->pool; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub residence { |
137
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
138
|
|
|
|
|
|
|
|
139
|
0
|
0
|
|
|
|
|
return defined($self->{STUNIT}) ? $self->{STUNIT} : $self->class->storageUnit; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub storageUnit { |
143
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
return $self->residence(@_); |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
1; |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
__END__ |