All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.coweb.SessionHandlerDelegate Maven / Gradle / Ivy

There is a newer version: 1.0
Show newest version
/**
 * Copyright (c) The Dojo Foundation 2011. All Rights Reserved.
 * Copyright (c) IBM Corporation 2008, 2011. All Rights Reserved.
 */
package org.coweb;

import org.cometd.bayeux.Message;
import org.cometd.bayeux.server.ServerSession;

public interface SessionHandlerDelegate {

	/**
	 * Called when a session is first being initialized.
	 * 
	 * @param sessionHandler
	 *            The org.coweb.SessionHandler object which invokes this
	 *            delegate.
	 * @param cacheState
	 *            boolean indicating if state should be cached.
	 */
	public void init(SessionHandler sessionHandler, boolean cacheState,
			UpdaterTypeMatcher updaterTypeMatcher);

	/**
	 * Called when a user attempts to send a request to a service in a session.
	 * 
	 * @return true if the user can send the request or false if not.
	 */
	public boolean onServiceRequest(ServerSession client, Message message);

	/**
	 * Called when a client sends a sync message. Implementations should forward
	 * sync events to the bots.
	 * 
	 * @param client
	 *            Client who sent the sync.
	 * @param message
	 *            Message containg sync event.
	 * 
	 * @return true if this sync event should forwarded to the bots
	 */
	public boolean onSync(ServerSession client, Message message);

	/**
	 * Called when a client joins a prepared session.
	 */
	public void onClientJoin(ServerSession client, Message message);

	/**
	 * Called when a user attempts to join a coweb session.
	 */
	public void onSubscribeService(ServerSession client, Message message);

	/**
	 * Called when a user attempts to unsubscribe from a service in a session.
	 */
	public void onUnsubscribeService(ServerSession client, Message message);

	/**
	 * Called when a client sends it's state to the server after a send state
	 * request.
	 * 
	 * @param client
	 *            The client sending the state
	 * @param message
	 *            Message containing the state in the data field.
	 */
	public void onUpdaterSendState(ServerSession client, Message message);

	/**
	 * Called after a client has been updated and is ready to be an updater.
	 * 
	 * @param client
	 *            The client who is ready to be an updater.
	 * @param message
	 *            Message associated with the subscribe.
	 */
	public void onUpdaterSubscribe(ServerSession client, Message message);

	/**
	 * Called when a client leaves a session.
	 * 
	 * @return true if client was successfully removed.
	 */
	public boolean onClientRemove(ServerSession client);

	/**
	 * Called when a session is ending.
	 * 
	 * @return true if session ended properly.
	 */
	public boolean onEndSession();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy