org.coweb.bots.transport
Class Transport

java.lang.Object
  extended by org.coweb.bots.transport.Transport
Direct Known Subclasses:
LocalTransport

public abstract class Transport
extends Object

Abstract base class for new transport implementations between coweb server and service bots. Instantiated per service bot instance per session.


Field Summary
protected  org.cometd.bayeux.server.BayeuxServer bayeuxServer
           
protected  Map<String,Object> botConfig
          Contains bot configuration options and metadata.
protected  org.cometd.bayeux.server.ServerSession server
           
protected  String serviceName
          Name of the service provided by the bot communicating via this transport.
protected  String sessionId
          Unique ID of the session to which the transport is bridging its bot
 
Constructor Summary
protected Transport()
           
  Transport(Map<String,Object> botConfig, String sessionId)
           
 
Method Summary
 org.cometd.bayeux.server.ServerChannel getResponseChannel()
           
 org.cometd.bayeux.server.ServerSession getServer()
           
 String getServiceName()
           
abstract  void init()
          The coweb server calls this method when a session decides to launch a service bot using this transport.
 void setBayeuxServer(org.cometd.bayeux.server.BayeuxServer bayeuxServer)
           
 void setBotConfig(Map<String,Object> botConfig)
           
 void setSessionId(String sessionId)
           
abstract  void shutdown()
          The coweb server calls this method when a session decides to shut down the service bot using this transport.
abstract  boolean subscribeUser(org.cometd.bayeux.server.ServerSession client, boolean pub)
          The coweb server calls this method when a coweb application subscribes to the service bot using this transport.
abstract  boolean unsubscribeUser(org.cometd.bayeux.server.ServerSession client, boolean pub)
          The coweb server calls this method when a coweb application unsubscribes from the service bot using this transport.
abstract  boolean userRequest(org.cometd.bayeux.server.ServerSession client, org.cometd.bayeux.Message message)
          The coweb server calls this method when a coweb application sends a private request to the service bot using this transport.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

botConfig

protected Map<String,Object> botConfig
Contains bot configuration options and metadata.


serviceName

protected String serviceName
Name of the service provided by the bot communicating via this transport.


sessionId

protected String sessionId
Unique ID of the session to which the transport is bridging its bot


bayeuxServer

protected org.cometd.bayeux.server.BayeuxServer bayeuxServer

server

protected org.cometd.bayeux.server.ServerSession server
Constructor Detail

Transport

protected Transport()

Transport

public Transport(Map<String,Object> botConfig,
                 String sessionId)
Method Detail

setBotConfig

public void setBotConfig(Map<String,Object> botConfig)

getServiceName

public String getServiceName()

getServer

public org.cometd.bayeux.server.ServerSession getServer()

setSessionId

public void setSessionId(String sessionId)

setBayeuxServer

public void setBayeuxServer(org.cometd.bayeux.server.BayeuxServer bayeuxServer)

getResponseChannel

public org.cometd.bayeux.server.ServerChannel getResponseChannel()

init

public abstract void init()
The coweb server calls this method when a session decides to launch a service bot using this transport.


subscribeUser

public abstract boolean subscribeUser(org.cometd.bayeux.server.ServerSession client,
                                      boolean pub)
                               throws IOException
The coweb server calls this method when a coweb application subscribes to the service bot using this transport. The transport should notify its bot of the subscription.

Parameters:
client - instance representing the application that sent the message
message - instance representing the service subscription message
pub - True iff subscribing to the bot's public broadcast channel
Returns:
Always return True
Throws:
IOException - When the transport experiences a failure delivering the message

unsubscribeUser

public abstract boolean unsubscribeUser(org.cometd.bayeux.server.ServerSession client,
                                        boolean pub)
                                 throws IOException
The coweb server calls this method when a coweb application unsubscribes from the service bot using this transport. The transport should notify its bot of the unsubscribe.

Parameters:
client - instance representing the application that sent the message
message - instance representing the service subscription message
pub - True iff subscribing to the bot's public broadcast channel
Returns:
Always return True
Throws:
IOException - When the transport experiences a failure delivering the message

userRequest

public abstract boolean userRequest(org.cometd.bayeux.server.ServerSession client,
                                    org.cometd.bayeux.Message message)
                             throws IOException
The coweb server calls this method when a coweb application sends a private request to the service bot using this transport. The transport should notify its bot of the request.

Parameters:
client - instance representing the application that sent the message
message - instance representing the service subscription message
Returns:
Always return True
Throws:
IOException - When the transport experiences a failure delivering the message

shutdown

public abstract void shutdown()
The coweb server calls this method when a session decides to shut down the service bot using this transport. The transport should notify its bot of the impending shutdown.



Copyright © 2011-2012 The Dojo Foundation. All Rights Reserved.