org.jboss.remoting.transport
Class Connector

java.lang.Object
  extended byorg.jboss.remoting.transport.Connector
All Implemented Interfaces:
ConnectorMBean, javax.management.MBeanRegistration
Direct Known Subclasses:
MarshallLoaderConnector

public class Connector
extends Object
implements javax.management.MBeanRegistration, ConnectorMBean

Connector is an implementation of the ConnectorMBean interface. The Connector is root component for the remoting server. It binds the server transport, marshaller, and handler together to form the remoting server instance. A transport connector is configured via *-service.xml such as: 1 303 304 60000 ${jboss.bind.address} 6666 false 200 org.jboss.remoting.transport.mock.MockServerInvocationHandler 2410

Version:
$Revision: 1.26 $
Author:
Jeff Haynie, Adrian Brock, David Jencks, Juha Lindfors, Tom Elrod

Field Summary
protected  ServerInvoker invoker
           
protected  org.jboss.logging.Logger log
           
 
Constructor Summary
  Connector()
           
protected Connector(boolean isMarshallerConnector)
           
 
Method Summary
 ServerInvocationHandler addInvocationHandler(String subsystem, javax.management.ObjectName handlerObjectName)
          Adds a handler to the connector via OjbectName.
 ServerInvocationHandler addInvocationHandler(String subsystem, ServerInvocationHandler handler)
          Adds an invocation handler for the named subsystem to the invoker we manage, and sets the mbean server on the invocation handler.
 void create()
          Creates the connector.
 void destroy()
          Destroys the connector.
 Element getConfiguration()
          Configuration is an xml element indicating subsystems to be registered with the ServerInvoker we wrap.
 ServerInvocationHandler[] getInvocationHandlers()
          Will get array of all the handlers registered with the connector's server invoker.
 String getInvokerLocator()
          Returns the invoker locator.
 InvokerLocator getLocator()
          Returns the locator to the connector.
 boolean isStarted()
           
 void postDeregister()
          This method is called by the MBeanServer after deregistration takes place.
 void postRegister(Boolean registrationDone)
          This method is called by the MBeanServer after registration takes place or when registration fails.
 void preDeregister()
          This method is called by the MBeanServer before deregistration takes place.
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
          This method is called by the MBeanServer before registration takes place.
 void removeInvocationHandler(String subsystem)
          Removes an invocation handler for the supplied subsystem from the invoker we manage, and unsets the MBeanServer on the handler.
 void setConfiguration(Element xml)
          Configuration is an xml element indicating subsystems to be registered with the ServerInvoker we wrap.
 void setInvokerLocator(String locator)
          Sets the invoker locator.
 void start()
          Starts the connector.
 void stop()
          Stops the connector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

invoker

protected ServerInvoker invoker

log

protected final org.jboss.logging.Logger log
Constructor Detail

Connector

public Connector()

Connector

protected Connector(boolean isMarshallerConnector)
Method Detail

isStarted

public boolean isStarted()

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws Exception
This method is called by the MBeanServer before registration takes place. The MBean is passed a reference of the MBeanServer it is about to be registered with. The MBean must return the ObjectName it will be registered with. The MBeanServer can pass a suggested object depending upon how the MBean is registered.

The MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

Specified by:
preRegister in interface javax.management.MBeanRegistration
Parameters:
server - the MBeanServer the MBean is about to be registered with.
name - the suggested ObjectName supplied by the MBeanServer.
Returns:
the actual ObjectName to register this MBean with.
Throws:
Exception - for any error, the MBean is not registered.

postRegister

public void postRegister(Boolean registrationDone)
This method is called by the MBeanServer after registration takes place or when registration fails.

Specified by:
postRegister in interface javax.management.MBeanRegistration
Parameters:
registrationDone - the MBeanServer passes true when the MBean was registered, false otherwise.

preDeregister

public void preDeregister()
                   throws Exception
This method is called by the MBeanServer before deregistration takes place.

The MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

Specified by:
preDeregister in interface javax.management.MBeanRegistration
Throws:
Exception

postDeregister

public void postDeregister()
This method is called by the MBeanServer after deregistration takes place.

Specified by:
postDeregister in interface javax.management.MBeanRegistration

start

public void start()
           throws Exception
Starts the connector.

Specified by:
start in interface ConnectorMBean
Throws:
Exception

stop

public void stop()
Stops the connector.

Specified by:
stop in interface ConnectorMBean

create

public void create()
            throws Exception
Creates the connector.

Specified by:
create in interface ConnectorMBean
Throws:
Exception

destroy

public void destroy()
Destroys the connector.

Specified by:
destroy in interface ConnectorMBean

getInvocationHandlers

public ServerInvocationHandler[] getInvocationHandlers()
Will get array of all the handlers registered with the connector's server invoker.

Returns:

getLocator

public InvokerLocator getLocator()
Returns the locator to the connector. Locator is the actual InvokerLocator object used to identify and get the ServerInvoker we are wrapping.

Specified by:
getLocator in interface ConnectorMBean

setInvokerLocator

public void setInvokerLocator(String locator)
                       throws Exception
Sets the invoker locator. InvokerLocator is the string URI representation of the InvokerLocator used to get and identify the ServerInvoker we are wrapping.

Specified by:
setInvokerLocator in interface ConnectorMBean
Throws:
Exception

getInvokerLocator

public String getInvokerLocator()
                         throws Exception
Returns the invoker locator. InvokerLocator is the string URI representation of the InvokerLocator used to get and identify the ServerInvoker we are wrapping.

Specified by:
getInvokerLocator in interface ConnectorMBean
Throws:
Exception

setConfiguration

public void setConfiguration(Element xml)
                      throws Exception
Configuration is an xml element indicating subsystems to be registered with the ServerInvoker we wrap. Using mbean subsystems that call registerSubsystem is more flexible.

Specified by:
setConfiguration in interface ConnectorMBean
Throws:
Exception

getConfiguration

public Element getConfiguration()
Configuration is an xml element indicating subsystems to be registered with the ServerInvoker we wrap. Using mbean subsystems that call registerSubsystem is more flexible.

Specified by:
getConfiguration in interface ConnectorMBean

addInvocationHandler

public ServerInvocationHandler addInvocationHandler(String subsystem,
                                                    javax.management.ObjectName handlerObjectName)
                                             throws Exception
Adds a handler to the connector via OjbectName. This will create a mbean proxy of type of ServerInvocationHandler for the MBean specified by object name passed (so has to implement ServerInvocationHandler interface).

Specified by:
addInvocationHandler in interface ConnectorMBean
Parameters:
subsystem -
handlerObjectName -
Returns:
Previous ServerInvocatioHandler with the same subsystem value (case insensitive) or null if one did not previously exist.
Throws:
Exception

addInvocationHandler

public ServerInvocationHandler addInvocationHandler(String subsystem,
                                                    ServerInvocationHandler handler)
                                             throws Exception
Adds an invocation handler for the named subsystem to the invoker we manage, and sets the mbean server on the invocation handler.

Specified by:
addInvocationHandler in interface ConnectorMBean
Returns:
Previous ServerInvocatioHandler with the same subsystem value (case insensitive) or null if one did not previously exist.
Throws:
Exception

removeInvocationHandler

public void removeInvocationHandler(String subsystem)
                             throws Exception
Removes an invocation handler for the supplied subsystem from the invoker we manage, and unsets the MBeanServer on the handler.

Specified by:
removeInvocationHandler in interface ConnectorMBean
Throws:
Exception


Copyright © 2004 JBoss Inc. All Rights Reserved.