|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rhq.enterprise.communications.command.server.CommandMBean
org.rhq.enterprise.communications.command.server.CommandService
public abstract class CommandService
The superclass for all command services. Command services are providers of command types - that
is, they support the invocation of one or more commands.
Extending this class gives all command services the same interface, which is how the CommandProcessor can
be extended to execute arbitrary commands.
All command services are registered with the command service directory, which
allows the command processor to find this service and its supported commands easily.
Note that subclasses do not need define their own MBean interface; they need only inherit this service's MBean interface in order to plug into the command processor infrastructure.
This class is typically used to process requests of the same kind of command, or perhaps different versions of the
same kind of command. To facilitate easier support for multiple commands, see MultipleCommandService. Use
that class if a command service expects to process many different kinds of commands. That is not to say direct
subclasses of this class cannot support multiple commands - they can. However, it typically will involve the execute
method containing a series of if-then-else statements to check the instanceof value of the
incoming Command object.
| Constructor Summary | |
|---|---|
CommandService()
|
|
| Method Summary | |
|---|---|
protected CommandServiceId |
getCommandServiceId()
Returns the command service ID that this command service is registered under - will be null if not
registered or was not registered with ServiceContainer.addCommandService(CommandService). |
protected org.jboss.remoting.transport.ConnectorMBean |
getConnector()
Gets the connector providing our remote services. |
ServiceContainer |
getServiceContainer()
If this service was registered by the ServiceContainer, that container's reference will be returned. |
protected String |
getSubsystem()
Returns the subsystem that this command service is registered under. |
protected void |
prepareRemoteInputStream(RemoteInputStream remote_stream)
This is a convienence method for use by those subclass services that need to process incoming remote input streams that were received from a client. |
protected void |
prepareRemoteOutputStream(RemoteOutputStream remote_stream)
This is a convienence method for use by those subclass services that need to process incoming remote output streams that were received from a client. |
ObjectName |
preRegister(MBeanServer mbs,
ObjectName name)
Ensures that the name this command service is to be registered on is valid. |
void |
setServiceContainer(ServiceContainer container)
When this service is added by the ServiceContainer, that container's reference will be set via this
method. |
| Methods inherited from class org.rhq.enterprise.communications.command.server.CommandMBean |
|---|
getLog, getMBeanServer, getObjectName, postDeregister, postRegister, preDeregister, startService, stopService |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.rhq.enterprise.communications.command.server.CommandServiceMBean |
|---|
getSupportedCommandTypes |
| Methods inherited from interface org.rhq.enterprise.communications.command.CommandExecutor |
|---|
execute |
| Constructor Detail |
|---|
public CommandService()
| Method Detail |
|---|
public ObjectName preRegister(MBeanServer mbs,
ObjectName name)
throws Exception
KeyProperty for more
information on the valid key properties.
If the name is invalid, an exception is thrown and the service will not get registered.
preRegister in interface MBeanRegistrationpreRegister in class CommandMBeanIllegalArgumentException - if the name does not follow the required format needed to interact with the
command processor
ExceptionMBeanRegistration.preRegister(MBeanServer, ObjectName)public ServiceContainer getServiceContainer()
ServiceContainer, that container's reference will be returned. If
this service object has not yet been registered or registered by some other mechanism, this will return
null.
public void setServiceContainer(ServiceContainer container)
ServiceContainer, that container's reference will be set via this
method. This allows this command service to obtain its container (in case this service needs things like the
client configuration.
container -
protected org.jboss.remoting.transport.ConnectorMBean getConnector()
throws Exception
Exception - if failed to get the connectorprotected String getSubsystem()
null if not registeredprotected CommandServiceId getCommandServiceId()
null if not
registered or was not registered with ServiceContainer.addCommandService(CommandService).
null if not registeredprotected void prepareRemoteInputStream(RemoteInputStream remote_stream)
remote input streams that were received from a client. Remote input streams require a
connection back to the client that sent the stream - this is so this service can pull down the input stream data.
This method prepares the given remote input stream with a properly configured client command sender targeted to
send commands back to the client that sent the remote input stream.
remote_stream - the stream to be prepared with a senderprotected void prepareRemoteOutputStream(RemoteOutputStream remote_stream)
remote output streams that were received from a client. Remote output streams require
a connection back to the client that sent the stream - this is so this service can push down the output stream
data. This method prepares the given remote output stream with a properly configured client command sender
targeted to send commands back to the client that sent the remote output stream.
remote_stream - the stream to be prepared with a sender
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||