File Coverage

blib/lib/Siebel/Srvrmgr/ListParser/Output/ListServers/Server.pm
Criterion Covered Total %
statement 12 14 85.7
branch n/a
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 17 20 85.0


line stmt bran cond sub pod time code
1             package Siebel::Srvrmgr::ListParser::Output::ListServers::Server;
2              
3             =pod
4              
5             =head1 NAME
6              
7             Siebel::Srvrmgr::ListParser::Output::ListServers::Server - class that represents a Siebel Server return by a "list servers" command
8              
9             =cut
10              
11 3     3   17 use Moose;
  3         6  
  3         19  
12 3     3   20037 use namespace::autoclean;
  3         8  
  3         57  
13 3     3   819 use Siebel::Srvrmgr::Types;
  3         7  
  3         81  
14 3     3   705 use MooseX::FollowPBP;
  3         13122  
  3         23  
15              
16             with 'Siebel::Srvrmgr::ListParser::Output::Duration';
17             with 'Siebel::Srvrmgr::ListParser::Output::ToString';
18              
19             =head1 SYNOPSIS
20              
21             use Siebel::Srvrmgr::ListParser::Output::ListServers::Server;
22             # retrieved the hash reference from a "list servers" command output
23             my $server = Siebel::Srvrmgr::ListParser::Output::ListServers::Server->new(
24             name => $ref->{SBLSRVR_NAME},
25             group => $ref->{SBLSRVR_GROUP_NAME},
26             host => $ref->{HOST_NAME},
27             install_dir => $ref->{INSTALL_DIR},
28             disp_state => $ref->{SV_DISP_STATE},
29             state => $ref->{SBLSRVR_STATE},
30             start_datetime => $ref->{START_TIME},
31             end_datetime => $ref->{END_TIME},
32             status => $ref->{SBLSRVR_STATUS},
33             pid => $ref->{SBLMGR_PID}
34             );
35              
36             ($server->is_running) ? print $server->name . 'is still running' : $server->name ' was running for a period of ' . $server->duration;
37              
38             =head1 DESCRIPTION
39              
40             This class is mean to be created by a L<Siebel::Srvrmgr::ListParser::Output::Tabular::ListServers> object.
41              
42             It represents a Siebel Server as returned by the C<list servers> command from C<srvrmgr> program.
43              
44             =head1 ATTRIBUTES
45              
46             All attributes of the Moose Role L<Siebel::Srvrmgr::ListParser::Output::Duration> are available.
47              
48             =head2 name
49              
50             A string representing the Siebel Server name (actually a "NotNullStr" type defined at L<Siebel::Srvrmgr::Types>).
51              
52             This attribute is read-only and required.
53              
54             =cut
55              
56             has 'name' => ( is => 'ro', isa => 'NotNullStr', 'required' => 1 );
57              
58             =head2 group
59              
60             A string representingn the Siebel server Group name
61              
62             This attribute is read-only.
63              
64             =cut
65              
66             has 'group' => ( is => 'ro', isa => 'Str' );
67              
68             =head2 host
69              
70             A string representing the host name of server machine.
71              
72             This attribute is read-only and required.
73              
74             =cut
75              
76             has 'host' => (is => 'ro', isa => 'NotNullStr', required => 1);
77              
78             =head2 install_dir
79              
80             A string representing the Server install directory name
81              
82             This attribute is read-only.
83              
84             =cut
85              
86             has 'install_dir' => (is => 'ro', isa => 'Str');
87              
88             =head2 pid
89              
90             An integer of O/S process/thread ID of Siebel Server Manager.
91              
92             This attribute is read-only.
93              
94             It will return C<undef> if the Siebel Server is not running anymore.
95              
96             =cut
97              
98             has 'pid' => (is => 'ro', isa => 'Int');
99              
100             =head2 disp_state
101              
102             A string representing the server state (started, stopped, etc.)
103              
104             This attribute is read-only and required.
105              
106             =cut
107              
108             has 'disp_state' => (is => 'ro', isa => 'Str', required => 1);
109              
110             =head2 state
111              
112             A string representing the server state internal (started, stopped, etc.)
113              
114             This attribute is read-only and required.
115              
116             =cut
117              
118             has 'state' => (is => 'ro', isa => 'Str', required => 1);
119              
120             =head2 status
121              
122             A string representing the server status
123              
124             This attribute is read-only and required.
125              
126             =cut
127              
128             has 'status' => (is => 'ro', isa => 'Str', required => 1);
129              
130             =head1 METHODS
131              
132             All methods of the Moose Role L<Siebel::Srvrmgr::ListParser::Output::Duration> are available.
133              
134             =head2 BUILD
135              
136             Invokes automatically the L<Siebel::Srvrmgr::ListParser::Output::Duration> C<fix_endtime> method during
137             object creation.
138              
139             =cut
140              
141             sub BUILD {
142              
143 0     0 1   my $self = shift;
144              
145 0           $self->fix_endtime;
146              
147             }
148              
149             =head1 SEE ALSO
150              
151             =over
152              
153             =item *
154              
155             L<Siebel::Srvrmgr::Types>
156              
157             =item *
158              
159             L<Siebel::Srvrmgr::ListParser::Output::Duration>
160              
161             =item *
162              
163             L<Siebel::Srvrmgr::ListParser::Output::Tabular::ListServers>
164              
165             =back
166              
167             =head1 AUTHOR
168              
169             Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
170              
171             =head1 COPYRIGHT AND LICENSE
172              
173             This software is copyright (c) 2015 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
174              
175             This file is part of Siebel Monitoring Tools.
176              
177             Siebel Monitoring Tools is free software: you can redistribute it and/or modify
178             it under the terms of the GNU General Public License as published by
179             the Free Software Foundation, either version 3 of the License, or
180             (at your option) any later version.
181              
182             Siebel Monitoring Tools is distributed in the hope that it will be useful,
183             but WITHOUT ANY WARRANTY; without even the implied warranty of
184             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
185             GNU General Public License for more details.
186              
187             You should have received a copy of the GNU General Public License
188             along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>.
189              
190             =cut
191              
192             __PACKAGE__->meta->make_immutable;