it.gotoandplay.smartfoxserver.extensions.examples
Class SimpleDbExtension

java.lang.Object
  extended by it.gotoandplay.smartfoxserver.extensions.AbstractExtension
      extended by it.gotoandplay.smartfoxserver.extensions.examples.SimpleDbExtension
All Implemented Interfaces:
it.gotoandplay.smartfoxserver.events.IEventListener, it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtension

public class SimpleDbExtension
extends AbstractExtension

SimpleDbExtension.java This example is the java translation of the dbExtension Actionscript Example found in the sfsExtensions/ folder
For further details you should read the tutorial 8.3 of the SmartFoxServer documentation


Field Summary
 
Fields inherited from class it.gotoandplay.smartfoxserver.extensions.AbstractExtension
adminExtension
 
Constructor Summary
SimpleDbExtension()
           
 
Method Summary
 void destroy()
          Destroy / release resources
 void handleInternalEvent(InternalEventObject ieo)
          Handles an event dispateched by the Server
 void handleRequest(java.lang.String cmd, ActionscriptObject ao, User u, int fromRoom)
          Handle client requests sent in XML format.
 void handleRequest(java.lang.String cmd, java.lang.String[] params, User u, int fromRoom)
          Handle client requests sent in String format.
 void init()
          Init extension
 
Methods inherited from class it.gotoandplay.smartfoxserver.extensions.AbstractExtension
getOwnerRoom, getOwnerZone, handleRequest, isActive, loadConfig, registerForEvents, sendResponse, sendResponse, sendResponse, setActive, setOwner, trace, unRegister
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDbExtension

public SimpleDbExtension()
Method Detail

init

public void init()
Init extension

Specified by:
init in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtension
Overrides:
init in class AbstractExtension

destroy

public void destroy()
Destroy / release resources

Specified by:
destroy in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtension
Overrides:
destroy in class AbstractExtension

handleRequest

public void handleRequest(java.lang.String cmd,
                          ActionscriptObject ao,
                          User u,
                          int fromRoom)
Handle client requests sent in XML format. The AS objects sent by the client are serialized to an ActionscriptObject

Parameters:
ao - the ActionscriptObject with the serialized data coming from the client
cmd - the cmd name invoked by the client
fromRoom - the id of the room where the user is in
u - the User who sent the message

handleRequest

public void handleRequest(java.lang.String cmd,
                          java.lang.String[] params,
                          User u,
                          int fromRoom)
Handle client requests sent in String format. The parameters sent by the client are split in a String[]

Parameters:
params - an array of data coming from the client
cmd - the cmd name invoked by the client
fromRoom - the id of the room where the user is in
u - the User who sent the message

handleInternalEvent

public void handleInternalEvent(InternalEventObject ieo)
Handles an event dispateched by the Server

Parameters:
ieo - the InternalEvent object