| 1 | #!/usr/bin/perl | ||||||||||
| 2 | package JMX::Jmx4Perl::Product::Jetty; | ||||||||||
| 3 | |||||||||||
| 4 | 4 | ▶ | use JMX::Jmx4Perl::Product::BaseHandler; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 4 | ▶ | use base "JMX::Jmx4Perl::Product::BaseHandler"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 4 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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<http://www.mortbay.org/jetty/>) | ||||||||||
| 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 | 4 | ▶ | sub id { | ||||||||
|
Subroutine
id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 25 | 4 | return "jetty"; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | sub name { | ||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 29 | 0 | return "Jetty"; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 0 | ▶ | sub _try_version { | ||||||||
|
Subroutine
_try_version: not called CC=3 SCAR=24.8
| |||||||||||
| 33 | 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 | ▶ | if ($servers) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 0 | $ret = $self->try_attribute("version",$servers->[0],"version"); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | # Jetty V5 | ||||||||||
| 44 | 0 | ▶ | if (!length($self->{version})) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | 0 | ▶ | sub autodetect_pattern { | ||||||||
|
Subroutine
autodetect_pattern: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 54 | 0 | return "version"; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 0 | ▶ | sub vendor { | ||||||||
|
Subroutine
vendor: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 58 | 0 | return "Mortbay"; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | sub jsr77 { | ||||||||
|
Subroutine
jsr77: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 62 | 0 | return 0; | |||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 0 | ▶ | sub init_aliases { | ||||||||
|
Subroutine
init_aliases: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 66 | return | ||||||||||
| 67 | { | ||||||||||
| 68 | 0 | 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 <http://www.gnu.org/licenses/>. | ||||||||||
| 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 | 4 | 1; | |||||||||