File Coverage

blib/lib/Siebel/Srvrmgr/ListParser/Output/ListComp/Comp.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Siebel::Srvrmgr::ListParser::Output::ListComp::Comp;
2              
3             =pod
4              
5             =head1 NAME
6              
7             Siebel::Srvrmgr::ListParser::Output::ListComp::Comp - class that represents a Siebel component
8              
9             =cut
10              
11 13     13   21794 use Moose;
  13         474556  
  13         92  
12 13     13   93775 use MooseX::FollowPBP;
  13         81052  
  13         93  
13 13     13   84918 use namespace::autoclean;
  13         8450  
  13         124  
14              
15             with 'Siebel::Srvrmgr::ListParser::Output::Duration';
16             with 'Siebel::Srvrmgr::ListParser::Output::ToString';
17              
18             =pod
19              
20             =head1 SYNOPSIS
21              
22             use Siebel::Srvrmgr::ListParser::Output::ListComp::Comp;
23              
24             # see Siebel::Srvrmgr::ListParser::Output::ListComp::Server for more details
25             my $comp = Siebel::Srvrmgr::ListParser::Output::ListComp::Comp->new( {
26             alias => $data_ref->{CC_ALIAS},
27             name => $data_ref->{CC_NAME},
28             ct_alias => $data_ref->{CT_ALIAS},
29             cg_alias => $data_ref->{CG_ALIAS},
30             run_mode => $data_ref->{CC_RUNMODE},
31             disp_run_state => $data_ref->{CP_DISP_RUN_STATE},
32             num_run_tasks => $data_ref->{CP_NUM_RUN_TASKS},
33             max_tasks => $data_ref->{CP_MAX_TASKS},
34             actv_mts_procs => $data_ref->{CP_ACTV_MTS_PROCS},
35             max_mts_procs => $data_ref->{CP_MAX_MTS_PROCS},
36             start_datetime => $data_ref->{CP_START_TIME},
37             end_datetime => $data_ref->{CP_END_TIME},
38             status => $data_ref->{CP_STATUS},
39             incarn_no => $data_ref->{CC_INCARN_NO},
40             desc_text => $data_ref->{CC_DESC_TEXT}
41              
42             } );
43              
44             print 'NAME = ', $comp->get_name(), "\n";
45              
46             =head1 DESCRIPTION
47              
48             This class is meant to be used together with L<Siebel::Srvrmgr::ListParser::Output::Server> since a component is always associated with a Siebel server. This class is intended to make it
49             easier to access and modify components as desired (for example, to export all components from one server to another changing some of their parameters).
50              
51             This class uses the roles L<Siebel::Srvrmgr::ListParser::Output::Duration> and L<Siebel::Srvrmgr::ListParser::Output::ToString>.
52              
53             =head1 ATTRIBUTES
54              
55             Beware that some of the attributes of the component may reflect only the current state when the component data was recovered and are, by nature, dynamic. Some example are
56             the number of running tasks and state of the component.
57              
58             =head2 alias
59              
60             A string of the alias of the component.
61              
62             This is a required attribute during object creation.
63              
64             This attribute is read/write.
65              
66             =cut
67              
68             has alias => ( isa => 'Str', is => 'rw', required => 1 );
69              
70             =pod
71              
72             =head2 name
73              
74             A string of the name of the component.
75              
76             This attribute is read/write.
77              
78             =cut
79              
80             has name => ( isa => 'Str', is => 'rw', required => 1 );
81              
82             =pod
83              
84             =head2 ct_alias
85              
86             A string of the component type alias.
87              
88             This attribute is read/write.
89              
90             =cut
91              
92             has ct_alias => ( isa => 'Str', is => 'rw', required => 1 );
93              
94             =pod
95              
96             =head2 cg_alias
97              
98             A string of the component group alias.
99              
100             This attribute is read/write.
101              
102             =cut
103              
104             has cg_alias => ( isa => 'Str', is => 'rw', required => 1 );
105              
106             =pod
107              
108             =head2 run_mode
109              
110             A string of the component run mode.
111              
112             This attribute is read/write.
113              
114             =cut
115              
116             has run_mode => ( isa => 'Str', is => 'rw', required => 1 );
117              
118             =pod
119              
120             =head2 disp_run_state
121              
122             A string of the component display run state.
123              
124             This attribute is read-only.
125              
126             =cut
127              
128             has disp_run_state => ( isa => 'Str', is => 'ro', required => 1 );
129              
130             =pod
131              
132             =head2 num_run_tasks
133              
134             An integer with the number of running tasks of the component.
135              
136             This attribute is read-only.
137              
138             =cut
139              
140             has num_run_tasks => ( isa => 'Int', is => 'ro', required => 1 );
141              
142             =pod
143              
144             =head2 max_tasks
145              
146             An integer with the maximum number of tasks the component will execute before restart itself.
147              
148             This attribute is read/write.
149              
150             =cut
151              
152             has max_tasks => ( isa => 'Int', is => 'rw', required => 1 );
153              
154             =pod
155              
156             =head2 actv_mts_procs
157              
158             An integer wit the active MTS processes running for the component.
159              
160             This attribute is read-only.
161              
162             =cut
163              
164             has actv_mts_procs => ( isa => 'Int', is => 'ro', required => 1 );
165              
166             =pod
167              
168             =head2 max_mts_procs
169              
170             An integer with the maximum number of MTS process that will run for the component.
171              
172             This attribute is read/write.
173              
174             =cut
175              
176             has max_mts_procs => ( isa => 'Int', is => 'rw', required => 1 );
177              
178             =pod
179              
180             =head2 status
181              
182             A string representing the status of the component.
183              
184             This attribute is read-only.
185              
186             =cut
187              
188             has status => ( isa => 'Str', is => 'ro', required => 1 );
189              
190             =pod
191              
192             =head2 incarn_no
193              
194             An integer with representing the component incarnation number.
195              
196             This attribute is read-only.
197              
198             =cut
199              
200             has incarn_no => (
201             isa => 'Int',
202             is => 'ro',
203             required => 1
204             );
205              
206             =pod
207              
208             =head2 desc_text
209              
210             A string representing the description of the component.
211              
212             This attribute is read/write.
213              
214             =cut
215              
216             has desc_text => ( isa => 'Str', is => 'rw', required => 1 );
217              
218             =pod
219              
220             =head1 METHODS
221              
222             All attributes have getter methods from than, following the Perl Best Practices book recomendation, so for component description invoke c<get_desc_text> method and so on.
223              
224             For those attributes that are read/write, their setters follows the same scheme.
225              
226             =head2 BUILD
227              
228             The C<BUILD> method will create all attributes/methods based on the value of the C<data> attribute.
229              
230             Once this operation is finished, the C<data> attribute is set to an empty hash reference.
231              
232             =cut
233              
234             sub BUILD {
235              
236 633     633 1 1028 my $self = shift;
237 633         1757 $self->fix_endtime;
238              
239             }
240              
241             =pod
242              
243             =head1 SEE ALSO
244              
245             =over
246              
247             =item *
248              
249             L<Moose>
250              
251             =item *
252              
253             L<namespace::autoclean>
254              
255             =item *
256              
257             L<Siebel::Srvrmgr::ListParser::Output::Duration>
258              
259             =item *
260              
261             L<Siebel::Srvrmgr::ListParser::Output::ToString>
262              
263             =item *
264              
265             L<MooseX::FollowPBP>
266              
267             =back
268              
269             =head1 AUTHOR
270              
271             Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
272              
273             =head1 COPYRIGHT AND LICENSE
274              
275             This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
276              
277             This file is part of Siebel Monitoring Tools.
278              
279             Siebel Monitoring Tools is free software: you can redistribute it and/or modify
280             it under the terms of the GNU General Public License as published by
281             the Free Software Foundation, either version 3 of the License, or
282             (at your option) any later version.
283              
284             Siebel Monitoring Tools is distributed in the hope that it will be useful,
285             but WITHOUT ANY WARRANTY; without even the implied warranty of
286             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
287             GNU General Public License for more details.
288              
289             You should have received a copy of the GNU General Public License
290             along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>.
291              
292             =cut
293              
294             __PACKAGE__->meta->make_immutable;