| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Siebel::Srvrmgr::Connection; |
|
2
|
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
50952
|
use Moose 2.0401; |
|
|
6
|
|
|
|
|
287490
|
|
|
|
6
|
|
|
|
|
53
|
|
|
4
|
6
|
|
|
6
|
|
53303
|
use Siebel::Srvrmgr::Types; |
|
|
6
|
|
|
|
|
20
|
|
|
|
6
|
|
|
|
|
186
|
|
|
5
|
6
|
|
|
6
|
|
37
|
use Carp; |
|
|
6
|
|
|
|
|
17
|
|
|
|
6
|
|
|
|
|
2510
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.29'; # VERSION |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Siebel::Srvrmgr::Connection - class responsible to provide connection details of a Siebel Enterprise |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Siebel::Srvrmgr::Connection; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $conn = Siebel::Srvrmgr::Connection->new({ |
|
17
|
|
|
|
|
|
|
server => 'servername', |
|
18
|
|
|
|
|
|
|
gateway => 'gateway', |
|
19
|
|
|
|
|
|
|
enterprise => 'enterprise', |
|
20
|
|
|
|
|
|
|
user => 'user', |
|
21
|
|
|
|
|
|
|
password => 'password', |
|
22
|
|
|
|
|
|
|
bin => 'c:\\siebel\\client\\bin\\srvrmgr.exe', |
|
23
|
|
|
|
|
|
|
lang_id => 'PTB', |
|
24
|
|
|
|
|
|
|
field_delimiter => '|' |
|
25
|
|
|
|
|
|
|
}); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This class holds all the details regarding necessary parameters to connect to a Siebel Enterprise by using srvrmgr. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
It should be used by any class that need to do that. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Beware that this class B<does not> hold a connection by itself, only the necessary data to request one. You can share those details, but |
|
35
|
|
|
|
|
|
|
not the connection itself. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 server |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This is a string representing the servername where the instance should connect. This is a optional attribute during |
|
42
|
|
|
|
|
|
|
object creation with the C<new> method. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Beware that the C<run> method will verify if the C<server> attribute has a defined value or not: if it has, the C<run> |
|
45
|
|
|
|
|
|
|
method will try to connect to the Siebel Enterprise specifying the given Siebel Server. If not, the method will try to connect |
|
46
|
|
|
|
|
|
|
to the Enterprise only, not specifying which Siebel Server to connect. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has server => ( |
|
51
|
|
|
|
|
|
|
isa => 'NotNullStr', |
|
52
|
|
|
|
|
|
|
is => 'rw', |
|
53
|
|
|
|
|
|
|
required => 0, |
|
54
|
|
|
|
|
|
|
reader => 'get_server', |
|
55
|
|
|
|
|
|
|
writer => 'set_server' |
|
56
|
|
|
|
|
|
|
); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 gateway |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This is a string representing the gateway where the instance should connect. This is a required attribute during |
|
61
|
|
|
|
|
|
|
object creation with the C<new> method. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
has gateway => ( |
|
66
|
|
|
|
|
|
|
isa => 'NotNullStr', |
|
67
|
|
|
|
|
|
|
is => 'rw', |
|
68
|
|
|
|
|
|
|
required => 1, |
|
69
|
|
|
|
|
|
|
reader => 'get_gateway', |
|
70
|
|
|
|
|
|
|
writer => 'set_gateway' |
|
71
|
|
|
|
|
|
|
); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 enterprise |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This is a string representing the enterprise where the instance should connect. This is a required attribute during |
|
76
|
|
|
|
|
|
|
object creation with the C<new> method. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
has enterprise => ( |
|
81
|
|
|
|
|
|
|
isa => 'NotNullStr', |
|
82
|
|
|
|
|
|
|
is => 'rw', |
|
83
|
|
|
|
|
|
|
required => 1, |
|
84
|
|
|
|
|
|
|
reader => 'get_enterprise', |
|
85
|
|
|
|
|
|
|
writer => 'set_enterprise' |
|
86
|
|
|
|
|
|
|
); |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 user |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This is a string representing the login for authentication. This is a required attribute during |
|
91
|
|
|
|
|
|
|
object creation with the C<new> method. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
has user => ( |
|
96
|
|
|
|
|
|
|
isa => 'NotNullStr', |
|
97
|
|
|
|
|
|
|
is => 'rw', |
|
98
|
|
|
|
|
|
|
required => 1, |
|
99
|
|
|
|
|
|
|
reader => 'get_user', |
|
100
|
|
|
|
|
|
|
writer => 'set_user' |
|
101
|
|
|
|
|
|
|
); |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 password |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This is a string representing the password for authentication. This is a required attribute during |
|
106
|
|
|
|
|
|
|
object creation with the C<new> method. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
has password => ( |
|
111
|
|
|
|
|
|
|
isa => 'NotNullStr', |
|
112
|
|
|
|
|
|
|
is => 'rw', |
|
113
|
|
|
|
|
|
|
required => 1, |
|
114
|
|
|
|
|
|
|
reader => 'get_password', |
|
115
|
|
|
|
|
|
|
writer => 'set_password' |
|
116
|
|
|
|
|
|
|
); |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 bin |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
An string representing the full path to the C<srvrmgr> program in the filesystem. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This is a required attribute during object creation with the C<new> method. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
has bin => ( |
|
127
|
|
|
|
|
|
|
isa => 'NotNullStr', |
|
128
|
|
|
|
|
|
|
is => 'rw', |
|
129
|
|
|
|
|
|
|
required => 1, |
|
130
|
|
|
|
|
|
|
reader => 'get_bin', |
|
131
|
|
|
|
|
|
|
writer => 'set_bin' |
|
132
|
|
|
|
|
|
|
); |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 lang_id |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
A string representing the LANG_ID parameter to connect to srvrmgr. If defaults to "ENU"; |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
has lang_id => ( |
|
141
|
|
|
|
|
|
|
isa => 'Str', |
|
142
|
|
|
|
|
|
|
is => 'rw', |
|
143
|
|
|
|
|
|
|
reader => 'get_lang_id', |
|
144
|
|
|
|
|
|
|
writer => 'set_lang_id', |
|
145
|
|
|
|
|
|
|
default => 'ENU' |
|
146
|
|
|
|
|
|
|
); |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 field_delimiter |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This is a single character attribute. It tells the Daemon class to consider a field delimiter, if such options was |
|
151
|
|
|
|
|
|
|
set in the C<srvrmgr> program. If this option is used but this attribute is not set accordinly, parsing will probably |
|
152
|
|
|
|
|
|
|
fail. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Since this attribute should be defined during Daemon object instance, it is read-only. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=cut |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
has field_delimiter => ( is => 'ro', isa => 'Chr', reader => 'get_field_del' ); |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 METHODS |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 get_params |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Returns an array reference with all the required parameters to execute srvrmgr program, but the C<password> attribute. See C<get_params_pass> method. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Here is the list of parameters/attributes returned, in this specific order: |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=over |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item 1. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
bin |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item 2. |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
enterprise |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item 3. |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
gateway |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item 4. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
user |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item 5. |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
lang_id |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item 6. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
server - if available |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item 7. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
field_delimiter - if available |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=back |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
The last two parameters are optional, so they might or not be included, depending on how the object was created. |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
The C<password> attribute is omitted, in the case the password prompt from srvrmgr is desired to be used. |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
It is suitable to used directly with C<system> call, avoiding calling the shell (see L<perlsec>). |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub get_params { |
|
209
|
8
|
|
|
8
|
1
|
18
|
my $self = shift; |
|
210
|
8
|
|
|
|
|
337
|
my @params = ( |
|
211
|
|
|
|
|
|
|
$self->get_bin(), '/e', $self->get_enterprise(), '/g', |
|
212
|
|
|
|
|
|
|
$self->get_gateway(), '/u', $self->get_user(), '/l', |
|
213
|
|
|
|
|
|
|
$self->get_lang_id() |
|
214
|
|
|
|
|
|
|
); |
|
215
|
8
|
100
|
|
|
|
266
|
push( @params, '/s', $self->get_server() ) |
|
216
|
|
|
|
|
|
|
if ( defined( $self->get_server() ) ); |
|
217
|
8
|
100
|
|
|
|
245
|
push( @params, '/k', $self->get_field_del() ) |
|
218
|
|
|
|
|
|
|
if ( defined( $self->get_field_del() ) ); |
|
219
|
8
|
|
|
|
|
34
|
return \@params; |
|
220
|
|
|
|
|
|
|
} |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 get_params_pass |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Returns the same array reference of C<get_params> (in fact, invokes it), with the password included as the last element. |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=cut |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
sub get_params_pass { |
|
229
|
4
|
|
|
4
|
1
|
10
|
my $self = shift; |
|
230
|
4
|
|
|
|
|
11
|
my $params_ref = $self->get_params; |
|
231
|
4
|
|
|
|
|
8
|
push( @{$params_ref}, '/p', $self->get_password ); |
|
|
4
|
|
|
|
|
118
|
|
|
232
|
4
|
|
|
|
|
17
|
return $params_ref; |
|
233
|
|
|
|
|
|
|
} |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head2 get_field_del |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
Getter for the C<field_delimiter> attribute. |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head2 get_lang_id |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
Returns the value of the attribute C<lang_id>. |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head2 set_lang_id |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
Sets the attribute C<lang_id>. Expects a string as parameter. |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=head2 get_server |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
Returns the content of C<server> attribute as a string. |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head2 set_server |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Sets the attribute C<server>. Expects an string as parameter. |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=head2 get_gateway |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
Returns the content of C<gateway> attribute as a string. |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head2 set_gateway |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
Sets the attribute C<gateway>. Expects a string as parameter. |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head2 get_enterprise |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
Returns the content of C<enterprise> attribute as a string. |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head2 set_enterprise |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
Sets the C<enterprise> attribute. Expects a string as parameter. |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head2 get_user |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
Returns the content of C<user> attribute as a string. |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=head2 set_user |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
Sets the C<user> attribute. Expects a string as parameter. |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=head2 get_password |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
Returns the content of C<password> attribute as a string. |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=head2 set_password |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
Sets the C<password> attribute. Expects a string as parameter. |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=head2 get_bin |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
Returns the content of the C<bin> attribute. |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=head2 set_bin |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Sets the content of the C<bin> attribute. Expects a string as parameter. |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=over |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=item * |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
L<Siebel::Srvrmgr::Daemon> |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=back |
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=head1 AUTHOR |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt> |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt> |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
This file is part of Siebel Monitoring Tools. |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
Siebel Monitoring Tools is free software: you can redistribute it and/or modify |
|
316
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
|
317
|
|
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or |
|
318
|
|
|
|
|
|
|
(at your option) any later version. |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
Siebel Monitoring Tools is distributed in the hope that it will be useful, |
|
321
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
322
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
323
|
|
|
|
|
|
|
GNU General Public License for more details. |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
326
|
|
|
|
|
|
|
along with Siebel Monitoring Tools. If not, see <http://www.gnu.org/licenses/>. |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=cut |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
1; |
|
333
|
|
|
|
|
|
|
|