|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rhq.enterprise.communications.ServiceContainer
public class ServiceContainer
This is the main container that manages the communications services required by the server to accept incoming command requests.
| Field Summary | |
|---|---|
static String |
JMX_DOMAIN
The JMX domain where all the services are registered. |
static ObjectName |
OBJECTNAME_CMDSERVICE_DIRECTORY
The default name of the network registry service. |
static ObjectName |
OBJECTNAME_CONNECTOR
The default name of the multicast detector service. |
static ObjectName |
OBJECTNAME_MULTICAST_DETECTOR
The default name of the multicast detector service. |
static ObjectName |
OBJECTNAME_NETWORK_REGISTRY
The default name of the network registry service. |
static ObjectName |
OBJECTNAME_SSL_SERVERSOCKET_FACTORY
The default name of the SSL server socket factory service. |
| Constructor Summary | |
|---|---|
ServiceContainer()
Private to prevent external instantiation. |
|
| Method Summary | ||
|---|---|---|
void |
addCommandListener(CommandListener listener)
Adds the given listener so it can be notified everytime a new command is received. |
|
CommandServiceId |
addCommandService(CommandService command_service)
Adds the given command service to the service container. |
|
CommandServiceId |
addCommandService(String command_service_class_name)
Adds the given command service to the service container where the command service classname is specified. |
|
void |
addDiscoveryListener(AutoDiscoveryListener listener)
Adds the given object as a listener that will receive notifications when new servers coming online have been discovered or old servers were discovered to have gone offline. |
|
void |
addInvocationHandler(String subsystem,
org.jboss.remoting.ServerInvocationHandler handler)
Allows a caller to install their own invocation handler for another subsystem. |
|
Long |
addRemoteInputStream(InputStream in)
Enables the input stream to receive remote invocations. |
|
Long |
addRemoteOutputStream(OutputStream out)
Enables the output stream to receive remote invocations. |
|
void |
addRemotePojo(Object pojo,
String interface_name)
Enables the POJO to receive remote invocations. |
|
|
addRemotePojo(T pojo,
Class<T> pojo_interface)
Similar to addRemotePojo(Object, String) except this method allows you to provide the actual interface
class representation, as opposed to its name as a String. |
|
void |
addServiceContainerSenderCreationListener(ServiceContainerSenderCreationListener listener)
Adds the given listener so it will be notified everytime this service container creates a new sender. |
|
ClientCommandSender |
createClientCommandSender(String server_endpoint,
ClientCommandSenderConfiguration client_config)
A convienence method that takes a client configuration and builds a sender
object with it. |
|
ClientCommandSender |
createClientCommandSenderWithSecurity(String server_endpoint,
ClientCommandSenderConfiguration client_config)
A convienence method that takes a client configuration and builds a sender
object with it. |
|
ClientCommandSenderConfiguration |
getClientConfiguration()
Returns the configuration that the server-side services will use when it needs to be a client itself and send commands to a remote server. |
|
ConcurrencyManager |
getConcurrencyManager()
Returns a manager that can be used by objects that either own, use or have access to this ServiceContainer object. |
|
ServiceContainerConfiguration |
getConfiguration()
Returns the configuration preferences that were used when the service container was started. |
|
MBeanServer |
getMBeanServer()
Returns the MBeanServer that is housing all the services. |
|
String |
getServerEndpoint()
Returns a string that identifies the server's socket endpoint. |
|
void |
removeCommandListener(CommandListener listener)
Removes the given listener so it no longer is notified when a new command is received. |
|
void |
removeCommandService(CommandServiceId id)
Removes a command service that is identified by the given ID. |
|
void |
removeDiscoveryListener(AutoDiscoveryListener listener)
Removes the given object as a listener so it will no longer receive discovery notifications. |
|
void |
removeInvocationHandler(String subsystem)
|
|
boolean |
removeRemoteInputStream(Long stream_id)
Removes a remoted input stream that has the given ID from the remote framework such that the stream is no longer remotely accessible. |
|
boolean |
removeRemoteOutputStream(Long stream_id)
Removes a remoted output stream that has the given ID from the remote framework such that the stream is no longer remotely accessible. |
|
void |
removeRemotePojo(Class remote_interface)
Removes the given remote interface from the remote framework such that the POJO is no longer remoted. |
|
void |
removeRemotePojo(String interface_name)
Removes the given remote interface from the remote framework such that the POJO is no longer remoted. |
|
void |
removeServiceContainerSenderCreationListener(ServiceContainerSenderCreationListener listener)
Removes the given listener so it no longer is notified when this service container creates a new sender. |
|
void |
setConcurrencyManager(ConcurrencyManager concurrencyManager)
Allows the caller to provide a reconfigured concurrency manager. |
|
void |
shutdown()
This method should be called when the services are no longer needed (for example, when the VM is shutting down). |
|
void |
start(Preferences configuration,
ClientCommandSenderConfiguration client_configuration)
This initializes the container with the given set of configuration preferences and starts the communications services. |
|
void |
start(Preferences configuration,
ClientCommandSenderConfiguration client_configuration,
MBeanServer mbs)
This initializes the container with the given set of configuration preferences and starts the communications services using the given MBeanServer to register the services. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String JMX_DOMAIN
public static final ObjectName OBJECTNAME_CMDSERVICE_DIRECTORY
public static final ObjectName OBJECTNAME_NETWORK_REGISTRY
public static final ObjectName OBJECTNAME_MULTICAST_DETECTOR
public static final ObjectName OBJECTNAME_CONNECTOR
public static final ObjectName OBJECTNAME_SSL_SERVERSOCKET_FACTORY
| Constructor Detail |
|---|
public ServiceContainer()
| Method Detail |
|---|
public ServiceContainerConfiguration getConfiguration()
started.
If this container is not started (e.g. it has been shutdown()), this will return
null.
public MBeanServer getMBeanServer()
If this container is not initialized (e.g. it has been shutdown()), this will return
null.
public String getServerEndpoint()
public ClientCommandSenderConfiguration getClientConfiguration()
public ConcurrencyManager getConcurrencyManager()
ServiceContainer object. It can be used, for example, by command services to restrict concurrent access.
Callers must not cache this object for more than a single permit/release cycle or otherwise assume they know the
specific concurrency manager instance that is being used, in case a new manager has been installed with different
configuration (see setConcurrencyManager(ConcurrencyManager)).
public void setConcurrencyManager(ConcurrencyManager concurrencyManager)
getConcurrencyManager(), otherwise, they will not pick up the changes in any new managers that are
installed by calls to this setter.
We can't easily reconfigure existing concurrency manager objects due to the nature of the counting semaphore
objects and not being able to nicely resize them to a specific value - hence we ask clients to get
getConcurrencyManager() when they need to get a permit.
concurrencyManager - the new concurrency manager object that is being installed
public ClientCommandSender createClientCommandSenderWithSecurity(String server_endpoint,
ClientCommandSenderConfiguration client_config)
client configuration and builds a sender
object with it. Note that regardless of the transport specified in server_endpoint, this method will
always place security configuration into the underlying remote communicator.
server_endpoint - a string that represents the remote endpoint to which the sender will connect and send
commandsclient_config - the client configuration which with to configure the sender
RuntimeException - if failed to create the sender
public ClientCommandSender createClientCommandSender(String server_endpoint,
ClientCommandSenderConfiguration client_config)
client configuration and builds a sender
object with it. Note that this method will examine the transport specified in server_endpoint, and
if (and only if) that transport requires security, the underlying remote communicator will get configured with
security information found in the given client configuration. This is different than
createClientCommandSenderWithSecurity(String, ClientCommandSenderConfiguration).
Note that the given client_config may have its values modified by any registered
sender creation listeners, so callers should pass in a copy of
their config object if they do not want it altered.
server_endpoint - a string that represents the remote endpoint to which the sender will connect and send
commandsclient_config - the client configuration which with to configure the sender
RuntimeException - if failed to create the sender
public void start(Preferences configuration,
ClientCommandSenderConfiguration client_configuration)
throws Exception
ServiceContainerConfigurationConstants.DISABLE_COMMUNICATIONS is true, this method does
nothing - all communications services will not be started.
The client_configuration is used in case any of the server-side services need to act as a client
and send commands out to another external server (as is the case when input streams are being remoted).
configuration - set of configuration preferences used to configure the internal server-side servicesclient_configuration - set of configuration preferences used to configure the internal client-side services
Exception - if failed to initialize all of the services successfullystart(Preferences, ClientCommandSenderConfiguration, MBeanServer)
public void start(Preferences configuration,
ClientCommandSenderConfiguration client_configuration,
MBeanServer mbs)
throws Exception
ServiceContainerConfigurationConstants.DISABLE_COMMUNICATIONS is true, this method does
nothing - all communications services will not be started.
The client_configuration is used in case any of the server-side services need to act as a client
and send commands out to another external server (as is the case when input streams are being remoted).
If mbs is null, one will be provided. First, if
ServiceContainerConfiguration.getMBeanServerName() returns null (meaning, it is not
configured), then the built-in JVM platform MBeanServer will
be used. If the configured MBeanServer name is non-null, a scan of all registered MBeanServers will
be performed to see if an MBeanServer is registered with a default domain name equal to that configured
MBeanServer name. If one exists, it will be used. If
one does not yet exist, one will be created.
configuration - configuration preferences used to configure the internal server-side servicesclient_configuration - configuration preferences used to configure the internal client-side servicesmbs - the MBeanServer where the services will be registered (may be null)
Exception - if failed to initialize all of the services successfullypublic void shutdown()
public void addDiscoveryListener(AutoDiscoveryListener listener)
started or
stopped.
listener - the object that will receive the notificationspublic void removeDiscoveryListener(AutoDiscoveryListener listener)
started or stopped.
listener - the object that will no longer receive the notificationspublic void addCommandListener(CommandListener listener)
listener - public void removeCommandListener(CommandListener listener)
listener - public void addServiceContainerSenderCreationListener(ServiceContainerSenderCreationListener listener)
sender.
listener - public void removeServiceContainerSenderCreationListener(ServiceContainerSenderCreationListener listener)
sender.
listener -
public CommandServiceId addCommandService(CommandService command_service)
throws Exception
command_service - the new command service to add
Exception - if failed to add the command service - it will not be able to process commands
public CommandServiceId addCommandService(String command_service_class_name)
throws Exception
command_service_class_name - the class name of the new command service to add
Exception - if failed to instantiate and add the command service - it will not be able to process commandsaddCommandService(CommandService)public void removeCommandService(CommandServiceId id)
id - identifies the command service to remove
public void addRemotePojo(Object pojo,
String interface_name)
throws Exception
ClientRemotePojoFactory
generated proxy object.
Note that only one POJO of the given interface can be remoted.
pojo - the object to make remotely accessibleinterface_name - the name of one of the pojo's interfaces that is to be exposed as its remote
interface
Exception - if failed to instantiate and add the command service - it will not be able to process remote
invocation requests to the POJOClientRemotePojoFactory.getRemotePojo(Class)
public <T> void addRemotePojo(T pojo,
Class<T> pojo_interface)
throws Exception
addRemotePojo(Object, String) except this method allows you to provide the actual interface
class representation, as opposed to its name as a String.
pojo - the object to make remotely accessiblepojo_interface - the interface that is to be exposed as its remote interface
Exception - if failed to instantiate and add the command service - it will not be able to process remote
invocation requests to the POJOpublic void removeRemotePojo(String interface_name)
interface_name - the name of the interface that was exposed remotely and is to be removedpublic void removeRemotePojo(Class remote_interface)
remote_interface - the interface that was exposed remotely and is to be removed
public Long addRemoteInputStream(InputStream in)
throws Exception
RemoteInputStream
proxy object.
in - the input stream to expose to remote clients
stream ID and can also be used to
remove the input stream service.
Exception - if failed to instantiate and add the command service - it will not be able to process remote
invocation requests to access input streamsRemoteInputStreamCommandService.addInputStream(InputStream)
public Long addRemoteOutputStream(OutputStream out)
throws Exception
RemoteOutputStream proxy object.
out - the output stream to expose to remote clients
stream ID and can also be used to
remove the output stream service.
Exception - if failed to instantiate and add the command service - it will not be able to process remote
invocation requests to access output streamsRemoteOutputStreamCommandService.addOutputStream(OutputStream)public boolean removeRemoteInputStream(Long stream_id)
stream_id - the ID of the stream that was exposed remotely and is to be removed
true if the stream ID was valid and a stream was removed; false if the ID
referred to a non-existent stream (which could mean either the stream was never registered at all or it
was registered but has already been removed)RemoteInputStreamCommandService.removeInputStream(Long)public boolean removeRemoteOutputStream(Long stream_id)
stream_id - the ID of the stream that was exposed remotely and is to be removed
true if the stream ID was valid and a stream was removed; false if the ID
referred to a non-existent stream (which could mean either the stream was never registered at all or it
was registered but has already been removed)RemoteOutputStreamCommandService.removeOutputStream(Long)
public void addInvocationHandler(String subsystem,
org.jboss.remoting.ServerInvocationHandler handler)
throws Exception
removeInvocationHandler(String).
subsystem - the new subsystem whose messages will be handled by the given handlerhandler - used to handle incoming messages for the given subsystem
Exception - if the remote connector hasn't been created/started or the handler failed to get added for some reason
public void removeInvocationHandler(String subsystem)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||