| jmx4perl documentation | view source | Contained in the jmx4perl distribution. |
JMX::Jmx4Perl::J4psh::Command - Base object for commands
This is the base command from which all j4psh commands should be extended. It provides registration hooks so that the command handler can determine the position of this command in the menu structure. Additionally it provides common methods useful for each command to perform its action.
A JMX::Jmx4Perl::J4psh::Command is a collection of shell commands, grouped in a certain context. It can be reused in different contexts and hence can occur at different places in the menu structure.
Constructor, which should not called be directly on this module but on a submodule. In fact, it will be called (indirectly) only by the JMX::Jmx4Perl::J4psh::CommandHandler during the command registration process. The single argument required is the central context object.
This method is called by the command handler during registration in order to
obtain the global commands which are always present in the menu. The default
implementation returns undef which means that no global commands should be
registered. Overwrite this to provide a command hashref as known to
Term::ShellUI for setting the global commands.
This method is called by the command handler during registration in order to
obtain the top commands which are present in the top level menu. The default
implementation returns undef which means that no top commands are to be
registered. Overwrite this to provide a command hashref as known to
Term::ShellUI for setting the top commands.
Get the context object used during construction. This is a convenience method for sublassed commands.
Convenience method to get the JMX::Jmx4perl::J4psh::CompletionHandler for getting various command line completions.
Convenience method to get the JMX::Jmx4Perl agent in order to contact the server agent bundle (via JMX::Jmx4Perl)
Return a list of ANSI color strings for the given symbolic color names which
are looked up from the current color theme. If no coloring is enabled, empty
strings are returned. This method dispatched directly to the underylying
context object.
Rerturn a sub (closure) which can be used as a command to update the context
stack managed by the command handler. Update in this sense means push the given
context ("context") on the stack, remembering the provided shell commands
$cmds for later use when traversing the stack upwards via ..
Go up one level in the stack
Reset the stack completely effectively jumping on top of it
Extract any options from a command specified via $spec. This method uses
Getopt::Long for extrating the options. It returns a hashref with the
extracted options and an array of remaining arguments
Formats a date like for ls -l:
Dec 2 18:21 Jun 23 2009
This format is especially useful when used in listing.
Use a pager for printing $txt which has $nr_lines lines. Only if
$nr_lines exceeds a certain limit (default: 24), then the pager is used,
otherwise $txt is printed directly.
Trim a string $string to a certain length $max, i.e. if $string is
larger than $max, then it is truncated to to $max-3 and ... is
appended. If it is less or equal, than $string is returned unchanged.
Convert the wildcards * and . to their regexp equivalent and return a
regular expression.
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 <http://www.gnu.org/licenses/>.
A commercial license is available as well. Please contact roland@cpan.org for further details.
Just in case you need professional support for this module (or Nagios or JMX in general), you might want to have a look at http://www.consol.com/opensource/nagios/. Contact roland.huss@consol.de for further information (or use the contact form at http://www.consol.com/contact/)
roland@cpan.org
| jmx4perl documentation | view source | Contained in the jmx4perl distribution. |