Package org.jolokia.service.jmx.handler
Class ExecHandler
java.lang.Object
org.jolokia.service.jmx.handler.AbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>
org.jolokia.service.jmx.handler.ExecHandler
- All Implemented Interfaces:
CommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>
public class ExecHandler
extends AbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>
Handler for dealing with execute requests.
- Since:
- Jun 12, 2009
- Author:
- roland
-
Field Summary
Fields inherited from class org.jolokia.service.jmx.handler.AbstractCommandHandler
context, pProvider -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckForRestriction(org.jolokia.server.core.request.JolokiaExecRequest pRequest) Check whether there is a restriction on the type to apply.doHandleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess pServerManager, org.jolokia.server.core.request.JolokiaExecRequest pRequest, Object pPreviousResult) Default implementation fo handling a request for multiple servers at once.doHandleSingleServerRequest(MBeanServerConnection server, org.jolokia.server.core.request.JolokiaExecRequest request) Execute an JMX operation.org.jolokia.server.core.util.RequestTypegetType()The type of request which can be served by this handlerbooleanhandleAllServersAtOnce(org.jolokia.server.core.request.JolokiaExecRequest pRequest) EXEC may be performed on multiple objects if they match theObjectNamepatternMethods inherited from class org.jolokia.service.jmx.handler.AbstractCommandHandler
checkForModifiedSince, checkType, destroy, handleAllServerRequest, handleSingleServerRequest, init, isObjectNameHidden
-
Constructor Details
-
ExecHandler
public ExecHandler()
-
-
Method Details
-
getType
public org.jolokia.server.core.util.RequestType getType()The type of request which can be served by this handler- Returns:
- the request typ of this handler
-
checkForRestriction
protected void checkForRestriction(org.jolokia.server.core.request.JolokiaExecRequest pRequest) Check whether there is a restriction on the type to apply. This method should be overwritten by specific handlers if they support a more sophisticated check than only for the type- Specified by:
checkForRestrictionin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>- Parameters:
pRequest- request to check
-
handleAllServersAtOnce
public boolean handleAllServersAtOnce(org.jolokia.server.core.request.JolokiaExecRequest pRequest) EXEC may be performed on multiple objects if they match theObjectNamepattern- Specified by:
handleAllServersAtOncein interfaceCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>- Overrides:
handleAllServersAtOncein classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>- Parameters:
pRequest-- Returns:
-
doHandleSingleServerRequest
public Object doHandleSingleServerRequest(MBeanServerConnection server, org.jolokia.server.core.request.JolokiaExecRequest request) throws InstanceNotFoundException, ReflectionException, MBeanException, IOException Execute an JMX operation. The operation name is taken from the request, as well as the arguments to use. If the operation is given in the format "op(type1,type2,...)" (e.g "getText(java.lang.String,int)" then the argument types are taken into account as well. This way, overloaded JMX operation can be used. If an overloaded JMX operation is called without specifying the argument types, then an exception is raised.- Specified by:
doHandleSingleServerRequestin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>- Parameters:
server- server to tryrequest- request to process from where the operation and its arguments are extracted.- Returns:
- the return value of the operation call
- Throws:
InstanceNotFoundExceptionReflectionExceptionMBeanExceptionIOException
-
doHandleAllServerRequest
public Object doHandleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess pServerManager, org.jolokia.server.core.request.JolokiaExecRequest pRequest, Object pPreviousResult) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, IOException Description copied from class:AbstractCommandHandlerDefault implementation fo handling a request for multiple servers at once. A subclass, which returns,trueonAbstractCommandHandler.handleAllServersAtOnce(JolokiaRequest), needs to override this method.- Overrides:
doHandleAllServerRequestin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaExecRequest>- Parameters:
pServerManager- all MBean servers found in this JVMpRequest- the original requestpPreviousResult- a previous result which for merging requests can be used to merge files- Returns:
- the result of the the request.
- Throws:
InstanceNotFoundExceptionAttributeNotFoundExceptionReflectionExceptionMBeanExceptionIOException
-