nl.justobjects.pushlet.core
Class Controller

java.lang.Object
  extended by nl.justobjects.pushlet.core.Controller
All Implemented Interfaces:
ConfigDefs, Protocol

public class Controller
extends java.lang.Object
implements Protocol, ConfigDefs

Handles servlet requests from client.

Version:
$Id: Controller.java,v 1.9 2007/11/23 14:33:07 justb Exp $
Author:
Just van den Broecke - Just Objects ©

Field Summary
private  Session session
           
 
Fields inherited from interface nl.justobjects.pushlet.core.Protocol
DEFAULT_SERVLET_URI, E_ABORT, E_DATA, E_HEARTBEAT, E_HEARTBEAT_ACK, E_JOIN, E_JOIN_ACK, E_JOIN_LISTEN, E_JOIN_LISTEN_ACK, E_LEAVE, E_LEAVE_ACK, E_LISTEN, E_LISTEN_ACK, E_NACK, E_PUBLISH, E_PUBLISH_ACK, E_REFRESH, E_REFRESH_ACK, E_SUBSCRIBE, E_SUBSCRIBE_ACK, E_UNSUBSCRIBE, E_UNSUBSCRIBE_ACK, FORMAT_JAVASCRIPT, FORMAT_SERIALIZED_JAVA_OBJECT, FORMAT_XML, FORMAT_XML_STRICT, MODE_POLL, MODE_PULL, MODE_STREAM, P_EVENT, P_FORMAT, P_FROM, P_ID, P_MODE, P_REASON, P_SEQ, P_SUBJECT, P_SUBSCRIPTION_ID, P_SUBSCRIPTION_LABEL, P_TIME, P_TO, P_URL, P_WAIT, SUBJECT_META, SUBJECT_META_JOINS, SUBJECT_META_SUBS
 
Fields inherited from interface nl.justobjects.pushlet.core.ConfigDefs
CONTROLLER_CLASS, DISPATCHER_CLASS, LISTEN_FORCE_PULL_AGENTS, LISTEN_FORCE_PULL_ALL, LOG_LEVEL, LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_FATAL, LOG_LEVEL_INFO, LOG_LEVEL_TRACE, LOG_LEVEL_WARN, LOGGER_CLASS, POLL_REFRESH_TIMEOUT_MILLIS, POLL_REFRESH_WAIT_MAX_MILLIS, POLL_REFRESH_WAIT_MIN_MILLIS, PULL_REFRESH_TIMEOUT_MILLIS, PULL_REFRESH_WAIT_MAX_MILLIS, PULL_REFRESH_WAIT_MIN_MILLIS, QUEUE_READ_TIMEOUT_MILLIS, QUEUE_SIZE, QUEUE_WRITE_TIMEOUT_MILLIS, SESSION_CLASS, SESSION_ID_GENERATION, SESSION_ID_GENERATION_RANDOMSTRING, SESSION_ID_GENERATION_UUID, SESSION_ID_SIZE, SESSION_MANAGER_CLASS, SESSION_TIMEOUT_MINS, SOURCES_ACTIVATE, SUBSCRIBER_CLASS, SUBSCRIPTION_CLASS
 
Constructor Summary
protected Controller()
          Protected constructor as we create through factory method.
 
Method Summary
static Controller create(Session aSession)
          Create instance through factory method.
protected  void debug(java.lang.String s)
          Exceptional print util.
 void doCommand(Command aCommand)
          Handle command.
protected  void doHeartbeat(Command aCommand)
          Handle heartbeat event.
protected  void doJoin(Command aCommand)
          Handle Join request.
protected  void doJoinListen(Command aCommand)
          Handle JoinListen request.
protected  void doLeave(Command aCommand)
          Handle Leave request.
protected  void doListen(Command aCommand)
          Handle Listen request.
protected  void doPublish(Command aCommand)
          Handle Publish request.
protected  void doRefresh(Command aCommand)
          Handle refresh event.
protected  void doSubscribe(Command aCommand)
          Handle Subscribe request.
protected  void doUnsubscribe(Command aCommand)
          Handle Unsubscribe request.
 Subscriber getSubscriber()
           
protected  void info(java.lang.String s)
          Info.
protected  void sendControlResponse(Command aCommand)
          Send response on the control channel.
 java.lang.String toString()
           
protected  void warn(java.lang.String s)
          Exceptional print util.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

session

private Session session
Constructor Detail

Controller

protected Controller()
Protected constructor as we create through factory method.

Method Detail

create

public static Controller create(Session aSession)
                         throws PushletException
Create instance through factory method.

Parameters:
aSession - the parent Session
Returns:
a Controller object (or derived)
Throws:
PushletException - exception, usually misconfiguration

doCommand

public void doCommand(Command aCommand)
Handle command.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

doHeartbeat

protected void doHeartbeat(Command aCommand)
Handle heartbeat event.


doJoin

protected void doJoin(Command aCommand)
               throws PushletException
Handle Join request.

Throws:
PushletException

doJoinListen

protected void doJoinListen(Command aCommand)
                     throws PushletException
Handle JoinListen request.

Throws:
PushletException

doLeave

protected void doLeave(Command aCommand)
                throws java.io.IOException
Handle Leave request.

Throws:
java.io.IOException

doListen

protected void doListen(Command aCommand)
                 throws PushletException
Handle Listen request.

Throws:
PushletException

doPublish

protected void doPublish(Command aCommand)
Handle Publish request.


doRefresh

protected void doRefresh(Command aCommand)
Handle refresh event.


doSubscribe

protected void doSubscribe(Command aCommand)
                    throws java.io.IOException
Handle Subscribe request.

Throws:
java.io.IOException

doUnsubscribe

protected void doUnsubscribe(Command aCommand)
                      throws java.io.IOException
Handle Unsubscribe request.

Throws:
java.io.IOException

getSubscriber

public Subscriber getSubscriber()

sendControlResponse

protected void sendControlResponse(Command aCommand)
Send response on the control channel.


info

protected void info(java.lang.String s)
Info.


warn

protected void warn(java.lang.String s)
Exceptional print util.


debug

protected void debug(java.lang.String s)
Exceptional print util.



Copyright 2000-2003 - Just Objects B.V.