org.objectweb.dream.protocol.channel
Class MultiplexExportProtocolImpl

java.lang.Object
  extended by org.objectweb.dream.AbstractComponent
      extended by org.objectweb.dream.protocol.channel.MultiplexExportProtocolImpl
All Implemented Interfaces:
ContextualBindingController, NeedAsyncStartController, PrepareStopLifeCycleController, Loggable, ChannelFactory, ChannelProtocol, MultiplexExportProtocol, Protocol, BindingController, LifeCycleController

public class MultiplexExportProtocolImpl
extends AbstractComponent
implements MultiplexExportProtocol, ChannelFactory

Implementation of an export multiplexer protocol. This protocol allows to export multiple ChannelFactory using a single lower level Channel.


Field Summary
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, fcNeedAsyncStart, fcState, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.protocol.channel.MultiplexExportProtocol
ROUTE_ID
 
Fields inherited from interface org.objectweb.dream.protocol.Protocol
ITF_NAME, LOWER_PROTOCOL_ITF_NAME
 
Fields inherited from interface org.objectweb.dream.protocol.channel.ChannelFactory
CHANEL_ITF_NAME, EXPORTED_CHANNEL_ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
MultiplexExportProtocolImpl()
           
 
Method Summary
 OutgoingPush bind(ExportIdentifier exportId, IncomingPush toClientPush, Map<String,Object> hints)
          Binds to a previously exported ChannelFactory interface designated by the given export identifier.
 void bindFc(String clientItfName, Object serverItf)
           
 ExportIdentifier createExportIdentifier(Map<String,Object> info, ExportIdentifier[] next)
          Creates a new export identifier with the provided info
 ExportIdentifier export(ChannelFactory channel, Map<String,Object> hints)
          Exports a ChannelFactory interface using this protocol.
 IncomingPush instantiate(OutgoingPush toClientPush)
          Notify the protocol who exports this interface, that a client is opening a new communication channel.
 String[] listFc()
           
 void unexport(ExportIdentifier exportId)
          Closes the export of a previously exported ChannelFactory interface.
 
Methods inherited from class org.objectweb.dream.AbstractComponent
beforeFirstStart, bindFc, getFcNeedAsyncStart, getFcState, initComponent, lookupFc, prepareStopFc, setLogger, startFc, stopFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiplexExportProtocolImpl

public MultiplexExportProtocolImpl()
Method Detail

instantiate

public IncomingPush instantiate(OutgoingPush toClientPush)
                         throws BindException
Description copied from interface: ChannelFactory
Notify the protocol who exports this interface, that a client is opening a new communication channel. The toClientPush interface can be used to send messages to the client. This method returns the interface on which messages sent by the client will be passed.

Specified by:
instantiate in interface ChannelFactory
Parameters:
toClientPush - the interface that can be used to send messages to the client through the newly created communication channel.
Returns:
the interface on which messages sent by the client will be passed.
Throws:
BindException - if the bind process fails.
See Also:
ChannelFactory.instantiate(OutgoingPush)

bind

public OutgoingPush bind(ExportIdentifier exportId,
                         IncomingPush toClientPush,
                         Map<String,Object> hints)
                  throws InvalidExportIdentifierException,
                         BindException
Description copied from interface: ChannelProtocol
Binds to a previously exported ChannelFactory interface designated by the given export identifier. This methods instantiate a new communication channel and returns an interface on which messages can be sent to the server. In addition the toClientPush interface is the interface on which the client want to receive messages from the server.

Specified by:
bind in interface ChannelProtocol
Parameters:
exportId - the identifier of the exported interface.
toClientPush - the interface on which the client want to receive messages from the server, may be null if no messages are expected from the server.
hints - additional parameters, can be null.
Returns:
a OutgoingPush interface on which message can be send over the new communication channel.
Throws:
InvalidExportIdentifierException - if the given export identifier is incorrect.
BindException - if the binding process fails.
See Also:
ChannelProtocol.bind(ExportIdentifier, IncomingPush, Map)

export

public ExportIdentifier export(ChannelFactory channel,
                               Map<String,Object> hints)
                        throws ExportException
Description copied from interface: ChannelProtocol
Exports a ChannelFactory interface using this protocol. This method informs the protocol that the provided ChannelFactory is willing to accept connection. The returned export identifier is a specific name for the exported channel.

Specified by:
export in interface ChannelProtocol
Parameters:
channel - a ChannelFactory interface to export.
hints - additional parameters, can be null.
Returns:
an identifier for the exported interface.
Throws:
ExportException - if the export process fails.
See Also:
ChannelProtocol.export(ChannelFactory, Map)

unexport

public void unexport(ExportIdentifier exportId)
              throws InvalidExportIdentifierException
Description copied from interface: ChannelProtocol
Closes the export of a previously exported ChannelFactory interface. This methods do not close communication channels created by the exported channel factory.

Specified by:
unexport in interface ChannelProtocol
Parameters:
exportId - the export identifier of the channel.
Throws:
InvalidExportIdentifierException - if the given export identifier is incorrect.
See Also:
ChannelProtocol.unexport(ExportIdentifier)

createExportIdentifier

public ExportIdentifier createExportIdentifier(Map<String,Object> info,
                                               ExportIdentifier[] next)
                                        throws InvalidExportIdentifierException
Description copied from interface: Protocol
Creates a new export identifier with the provided info

Specified by:
createExportIdentifier in interface Protocol
Parameters:
info - the info used to create the export identifier.
next - the export identifier of the lower level protocols.
Returns:
a new export identifier.
Throws:
InvalidExportIdentifierException - if the export identifier can't be created.
See Also:
Protocol.createExportIdentifier(Map, ExportIdentifier[])

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController
See Also:
BindingController.listFc()

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Overrides:
bindFc in class AbstractComponent
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.bindFc(String, Object)


Copyright © 2003, 2005 - INRIA Rhone-Alpes - All Rights Reserved.