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 14     14   18847 use Moose;
  14         289135  
  14         70  
12 14     14   70404 use MooseX::FollowPBP;
  14         53458  
  14         81  
13 14     14   60171 use namespace::autoclean;
  14         879  
  14         98  
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             =cut
65              
66             has alias => ( isa => 'Str', is => 'rw', required => 1 );
67              
68             =pod
69              
70             =head2 name
71              
72             A string of the name of the component.
73              
74             =cut
75              
76             has name => ( isa => 'Str', is => 'rw', required => 1 );
77              
78             =pod
79              
80             =head2 ct_alias
81              
82             A string of the component type alias.
83              
84             =cut
85              
86             has ct_alias => ( isa => 'Str', is => 'rw', required => 1 );
87              
88             =pod
89              
90             =head2 cg_alias
91              
92             A string of the component group alias.
93              
94             =cut
95              
96             has cg_alias => ( isa => 'Str', is => 'rw', required => 1 );
97              
98             =pod
99              
100             =head2 run_mode
101              
102             A string of the component run mode.
103              
104             =cut
105              
106             has run_mode => ( isa => 'Str', is => 'rw', required => 1 );
107              
108             =pod
109              
110             =head2 disp_run_state
111              
112             A string of the component display run state.
113              
114             This attribute is read-only.
115              
116             =cut
117              
118             has disp_run_state => ( isa => 'Str', is => 'ro', required => 1 );
119              
120             =pod
121              
122             =head2 num_run_tasks
123              
124             An integer with the number of running tasks of the component.
125              
126             This attribute is read-only.
127              
128             =cut
129              
130             has num_run_tasks => ( isa => 'Int', is => 'ro', required => 1 );
131              
132             =pod
133              
134             =head2 max_tasks
135              
136             An integer with the maximum number of tasks the component will execute before restart itself.
137              
138             =cut
139              
140             has max_tasks => ( isa => 'Int', is => 'rw', required => 1 );
141              
142             =pod
143              
144             =head2 actv_mts_procs
145              
146             An integer wit the active MTS processes running for the component.
147              
148             This attribute is read-only.
149              
150             =cut
151              
152             has actv_mts_procs => ( isa => 'Int', is => 'ro', required => 1 );
153              
154             =pod
155              
156             =head2 max_mts_procs
157              
158             An integer with the maximum number of MTS process that will run for the component.
159              
160             =cut
161              
162             has max_mts_procs => ( isa => 'Int', is => 'rw', required => 1 );
163              
164             =pod
165              
166             =head2 status
167              
168             A string representing the status of the component.
169              
170             This attribute is read-only.
171              
172             =cut
173              
174             has status => ( isa => 'Str', is => 'ro', required => 1 );
175              
176             =pod
177              
178             =head2 incarn_no
179              
180             An integer with representing the component incarnation number.
181              
182             This attribute is read-only.
183              
184             =cut
185              
186             has incarn_no => (
187             isa => 'Int',
188             is => 'ro',
189             required => 1
190             );
191              
192             =pod
193              
194             =head2 desc_text
195              
196             A string representing the description of the component.
197              
198             =cut
199              
200             has desc_text => ( isa => 'Str', is => 'rw', required => 1 );
201              
202             =pod
203              
204             =head1 METHODS
205              
206             All attributes have the same methods name to access them. For setting them, just invoke the method name with the desirable value as parameter.
207              
208             =head2 BUILD
209              
210             The C<BUILD> method will create all attributes/methods based on the value of the C<data> attribute.
211              
212             Once this operation is finished, the C<data> attribute is set to an empty hash reference.
213              
214             =cut
215              
216             sub BUILD {
217              
218 633     633 1 571 my $self = shift;
219 633         1264 $self->fix_endtime;
220              
221             }
222              
223             =pod
224              
225             =head1 SEE ALSO
226              
227             =over
228              
229             =item *
230              
231             L<Moose>
232              
233             =item *
234              
235             L<namespace::autoclean>
236              
237             =item *
238              
239             L<Siebel::Srvrmgr::ListParser::Output::Duration>
240              
241             =item *
242              
243             L<Siebel::Srvrmgr::ListParser::Output::ToString>
244              
245             =back
246              
247             =head1 AUTHOR
248              
249             Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
250              
251             =head1 COPYRIGHT AND LICENSE
252              
253             This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
254              
255             This file is part of Siebel Monitoring Tools.
256              
257             Siebel Monitoring Tools is free software: you can redistribute it and/or modify
258             it under the terms of the GNU General Public License as published by
259             the Free Software Foundation, either version 3 of the License, or
260             (at your option) any later version.
261              
262             Siebel Monitoring Tools is distributed in the hope that it will be useful,
263             but WITHOUT ANY WARRANTY; without even the implied warranty of
264             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
265             GNU General Public License for more details.
266              
267             You should have received a copy of the GNU General Public License
268             along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>.
269              
270             =cut
271              
272             __PACKAGE__->meta->make_immutable;