File Coverage

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