org.rhq.enterprise.communications.command.impl.remotepojo.server
Class RemotePojoInvocationCommandService

java.lang.Object
  extended by org.rhq.enterprise.communications.command.server.CommandMBean
      extended by org.rhq.enterprise.communications.command.server.CommandService
          extended by org.rhq.enterprise.communications.command.impl.remotepojo.server.RemotePojoInvocationCommandService
All Implemented Interfaces:
MBeanRegistration, CommandExecutor, RemotePojoInvocationCommandServiceMBean, CommandServiceMBean

public class RemotePojoInvocationCommandService
extends CommandService
implements RemotePojoInvocationCommandServiceMBean

Processes a client request to invoke a remoted POJO.

Author:
John Mazzitelli

Constructor Summary
RemotePojoInvocationCommandService()
           
 
Method Summary
 void addPojo(Object pojo, String interfaceName)
          Adds the given POJO so it becomes remoteable via the ClientRemotePojoFactory.
<T> void
addPojo(T pojo, Class<T> remoteInterface)
          Adds the given POJO so it becomes remoteable via the ClientRemotePojoFactory.
 CommandResponse execute(Command command, InputStream in, OutputStream out)
          Takes the remote POJO invocation request, which has the NameBasedInvocation parameter, and convert that to a method call on the target POJO (using reflection).
 CommandType[] getSupportedCommandTypes()
          Supports RemotePojoInvocationCommand.COMMAND_TYPE.
 void removePojo(Class<?> remoteInterface)
          Removes the POJO with the given remoted interface so it no longer is remoteable and cannot be invoked via remote clients.
 void removePojo(String remoteInterfaceName)
          Removes the POJO with the given remoted interface so it no longer is remoteable and cannot be invoked via remote clients.
 void startService()
          This is called after the MBean is fully registered with the MBeanServer.
 void stopService()
          This is called when the MBean is being deregistered from the MBeanServer.
 
Methods inherited from class org.rhq.enterprise.communications.command.server.CommandService
getCommandServiceId, getConnector, getServiceContainer, getSubsystem, prepareRemoteInputStream, prepareRemoteOutputStream, preRegister, setServiceContainer
 
Methods inherited from class org.rhq.enterprise.communications.command.server.CommandMBean
getLog, getMBeanServer, getObjectName, postDeregister, postRegister, preDeregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemotePojoInvocationCommandService

public RemotePojoInvocationCommandService()
Method Detail

startService

public void startService()
Description copied from class: CommandMBean
This is called after the MBean is fully registered with the MBeanServer. This implementation is a no-op that subclasses are free to override.

Overrides:
startService in class CommandMBean
See Also:
CommandMBean.startService()

stopService

public void stopService()
Description copied from class: CommandMBean
This is called when the MBean is being deregistered from the MBeanServer. This implementation is a no-op that subclasses are free to override.

Overrides:
stopService in class CommandMBean
See Also:
CommandMBean.stopService()

addPojo

public void addPojo(Object pojo,
                    String interfaceName)
Description copied from interface: RemotePojoInvocationCommandServiceMBean
Adds the given POJO so it becomes remoteable via the ClientRemotePojoFactory. The remoteInterfaceName will be the name of the interface that is exposed to the remote clients.

Specified by:
addPojo in interface RemotePojoInvocationCommandServiceMBean
Parameters:
pojo - the POJO to add to the list of remoted POJOs
interfaceName - name of the interface to expose to remote clients
See Also:
RemotePojoInvocationCommandServiceMBean.addPojo(Object, String)

addPojo

public <T> void addPojo(T pojo,
                        Class<T> remoteInterface)
Description copied from interface: RemotePojoInvocationCommandServiceMBean
Adds the given POJO so it becomes remoteable via the ClientRemotePojoFactory. The remoteInterface will be the interface that is exposed to the remote clients.

Specified by:
addPojo in interface RemotePojoInvocationCommandServiceMBean
Parameters:
pojo - the POJO to add to the list of remoted POJOs
remoteInterface - the interface to expose to remote clients
See Also:
RemotePojoInvocationCommandServiceMBean.addPojo(Object, Class)

removePojo

public void removePojo(String remoteInterfaceName)
Description copied from interface: RemotePojoInvocationCommandServiceMBean
Removes the POJO with the given remoted interface so it no longer is remoteable and cannot be invoked via remote clients. The remoteInterfaceName must be the name of the interface that was exposed to the remote clients.

Specified by:
removePojo in interface RemotePojoInvocationCommandServiceMBean
Parameters:
remoteInterfaceName - name of the interface that was exposed to remote clients
See Also:
RemotePojoInvocationCommandServiceMBean.removePojo(String)

removePojo

public void removePojo(Class<?> remoteInterface)
Description copied from interface: RemotePojoInvocationCommandServiceMBean
Removes the POJO with the given remoted interface so it no longer is remoteable and cannot be invoked via remote clients. The remoteInterface must be the interface that was exposed to the remote clients.

Specified by:
removePojo in interface RemotePojoInvocationCommandServiceMBean
Parameters:
remoteInterface - the interface that was exposed to remote clients
See Also:
RemotePojoInvocationCommandServiceMBean.removePojo(Class)

execute

public CommandResponse execute(Command command,
                               InputStream in,
                               OutputStream out)
Takes the remote POJO invocation request, which has the NameBasedInvocation parameter, and convert that to a method call on the target POJO (using reflection). Then return the Object returned from the method call on the target POJO in the response.

Specified by:
execute in interface CommandExecutor
Parameters:
command - the command to execute
in - input stream should the executor want to get streamed data from the client
out - output stream should the executor want to stream data to the client
Returns:
the results of the command execution
See Also:
CommandExecutor.execute(Command, java.io.InputStream, java.io.OutputStream)

getSupportedCommandTypes

public CommandType[] getSupportedCommandTypes()
Supports RemotePojoInvocationCommand.COMMAND_TYPE.

Specified by:
getSupportedCommandTypes in interface CommandServiceMBean
Returns:
array of supported command types
See Also:
CommandServiceMBean.getSupportedCommandTypes()


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.