File Coverage

blib/lib/JMX/Jmx4Perl/Product/Jetty.pm
Criterion Covered Total %
statement 13 29 44.8
branch 0 4 0.0
condition n/a
subroutine 5 11 45.4
pod 6 6 100.0
total 24 50 48.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2             package JMX::Jmx4Perl::Product::Jetty;
3              
4 3     3   15 use JMX::Jmx4Perl::Product::BaseHandler;
  3         4  
  3         64  
5 3     3   12 use strict;
  3         7  
  3         58  
6 3     3   12 use base "JMX::Jmx4Perl::Product::BaseHandler";
  3         6  
  3         205  
7              
8 3     3   13 use Carp qw(croak);
  3         5  
  3         792  
9              
10             =head1 NAME
11              
12             JMX::Jmx4Perl::Product::Jetty - Handler for Jetty
13              
14             =head1 DESCRIPTION
15              
16             This is the product handler support Jetty. It supports Jetty version 5, 6 and 7.
17             (L)
18              
19             Please note, that you must have JMX support enabled in Jetty for autodetection
20             and aliasing to work. See the Jetty documentation for details.
21              
22             =cut
23              
24             sub id {
25 3     3 1 20 return "jetty";
26             }
27              
28             sub name {
29 0     0 1   return "Jetty";
30             }
31              
32             sub _try_version {
33 0     0     my $self = shift;
34 0           my $jmx = $self->{jmx4perl};
35              
36             # Jetty V6 & 7
37 0           my $servers = $jmx->search("*:id=0,type=server,*");
38 0           my $ret;
39 0 0         if ($servers) {
40 0           $ret = $self->try_attribute("version",$servers->[0],"version");
41             }
42              
43             # Jetty V5
44 0 0         if (!length($self->{version})) {
45 0           delete $self->{version};
46 0           $ret = $self->try_attribute("version","org.mortbay:jetty=default","version");
47             }
48              
49 0           $self->{version} =~ s/Jetty\/([^\s]+).*/$1/;
50 0           return $ret;
51             }
52              
53             sub autodetect_pattern {
54 0     0 1   return "version";
55             }
56              
57             sub vendor {
58 0     0 1   return "Mortbay";
59             }
60              
61             sub jsr77 {
62 0     0 1   return 0;
63             }
64              
65             sub init_aliases {
66             return
67             {
68 0     0 1   attributes =>
69             {
70             },
71             operations =>
72             {
73             THREAD_DUMP => [ "jboss.system:type=ServerInfo", "listThreadDump"]
74             }
75             # Alias => [ "mbean", "attribute", "path" ]
76             };
77             }
78              
79              
80             =head1 LICENSE
81              
82             This file is part of jmx4perl.
83              
84             Jmx4perl is free software: you can redistribute it and/or modify
85             it under the terms of the GNU General Public License as published by
86             the Free Software Foundation, either version 2 of the License, or
87             (at your option) any later version.
88              
89             jmx4perl is distributed in the hope that it will be useful,
90             but WITHOUT ANY WARRANTY; without even the implied warranty of
91             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
92             GNU General Public License for more details.
93              
94             You should have received a copy of the GNU General Public License
95             along with jmx4perl. If not, see .
96              
97             A commercial license is available as well. Please contact roland@cpan.org for
98             further details.
99              
100             =head1 AUTHOR
101              
102             roland@cpan.org
103              
104             =cut
105              
106             1;