JMX::Jmx4Perl::Agent::ArtifactHandler - Handler for extracting and manipulating Jolokia artifacts


This module is responsible for mangaging a singe JAR or WAR Archive. It requires Archive::Zip for proper operation.

I.e. this module can

  • Extract jolokia-access.xml and web.xml from WAR/JAR archives

  • Check for the esistance of jolokia-access.xml

  • Update web.xml for WAR files


$handler = JMX::Jmx4Perl::Agent::Jolokia::ArtifactHandler->new(...)

Create a new handler with the following options:

  file => $file      : Path to archive to handle
  logger => $logger  : Logger to use
  meta => $meta      : Jolokia-Meta handler to extract the type of an archive
$info = $handler->info()

Extract information about an archive. Return value is a has with the following keys:

  "version"      Agent's version
  "type"         Agent type (war, osgi, osgi-bundle, mule, jdk6)
  "artifactId"   Maven artifact id 
  "groupId"      Maven group Id 

Add or update the policy given as string to this archive. Dependening on whether it is a WAR or another agent, it is put into the proper place

For "war" agents, this is WEB-INF/classes/jolokia-access.xml, for all others it is /jolokia-access.xml


Remove a policy file (no-op, when no policy is present)


Returns true (i.e. the path to the policy file) if a policy file is contained, undef otherwise.


Get the policy file as string or undef if no policy is contained.


Extract web.xml from WAR agents, for other types, a fatal error is raised. Return value is a string containing the web.xml.


Update web.xml in WAR agents, for other types, a fatal error is raised. Return value is a string containing the web.xml. $webxml is the descriptor as a string.


Return the agent's type, which is one of "war", "osgi", "osgi-bundle", "mule" or "jdk6"


This file is part of jmx4perl. Jmx4perl is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by The Free Software Foundation, either version 2 of the License, or (at your option) any later version.

jmx4perl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with jmx4perl. If not, see <>.

A commercial license is available as well. Please contact for further details.