|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.gotoandplay.smartfoxserver.extensions.AbstractExtension
public abstract class AbstractExtension
AbstractExtension is the parent class for all SmartFoxServer extensions.
In a nutshell an extension accomplishes four main tasks by implementing the following methods:
Since SmartFoxServer 1.6.0 there's an additional handleInternalRequest() method which is optional and can be used to invoke methods between extensions or other classes.
| Field Summary | |
|---|---|
it.gotoandplay.smartfoxserver.extensions.AdminExtension |
adminExtension
|
| Constructor Summary | |
|---|---|
AbstractExtension()
|
|
| Method Summary | |
|---|---|
void |
destroy()
This method should be overridden by the child class. |
java.lang.String |
getOwnerRoom()
Get the name of the room where the extension is attached to (if any) |
java.lang.String |
getOwnerZone()
Get the name of the zone where the extension is attached to |
java.lang.Object |
handleInternalRequest(java.lang.Object params)
Allows to send requests from another extension / class / or servlet. |
void |
handleRequest(java.lang.String cmd,
org.json.JSONObject jso,
User u,
int fromRoom)
Basic implementation of interface method Needed to avoid breaking extensions of version 1.4.0 and previous which only handle XML or String requests. |
void |
init()
This method should be overridden by the child class. |
boolean |
isActive()
Returns true if the extension is active |
net.n3.nanoxml.IXMLElement |
loadConfig(java.lang.String xmlFile)
|
void |
registerForEvents(java.lang.String zoneName,
java.lang.String roomName)
|
void |
sendResponse(ActionscriptObject ao,
int fromRoom,
User sender,
java.util.LinkedList recipients)
Send a response to one or more clients using XML format |
void |
sendResponse(org.json.JSONObject jso,
int fromRoom,
User sender,
java.util.LinkedList recipients)
Send a response to one or more clients using JSON format |
void |
sendResponse(net.sf.json.JSONObject jso,
int fromRoom,
User sender,
java.util.LinkedList recipients)
Send a response to one or more clients using JSON format |
void |
sendResponse(java.lang.String[] params,
int fromRoom,
User sender,
java.util.LinkedList recipients)
Send a response to one or more clients using String format |
void |
setActive(boolean b)
|
void |
setOwner(java.lang.String zoneName,
java.lang.String roomName)
|
void |
trace(java.lang.String msg)
Trace the message remotely to admin tool and to the console |
void |
unRegister()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtension |
|---|
handleRequest, handleRequest |
| Methods inherited from interface it.gotoandplay.smartfoxserver.events.IEventListener |
|---|
handleInternalEvent |
| Field Detail |
|---|
public it.gotoandplay.smartfoxserver.extensions.AdminExtension adminExtension
| Constructor Detail |
|---|
public AbstractExtension()
| Method Detail |
|---|
public void setOwner(java.lang.String zoneName,
java.lang.String roomName)
setOwner in interface it.gotoandplay.smartfoxserver.events.IEventListenerpublic java.lang.String getOwnerZone()
getOwnerZone in interface it.gotoandplay.smartfoxserver.events.IEventListenerpublic java.lang.String getOwnerRoom()
getOwnerRoom in interface it.gotoandplay.smartfoxserver.events.IEventListenerpublic void init()
init in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtensionpublic void destroy()
destroy in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtensionpublic boolean isActive()
isActive in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtensionpublic void setActive(boolean b)
setActive in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtension
public void registerForEvents(java.lang.String zoneName,
java.lang.String roomName)
registerForEvents in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtensionpublic void unRegister()
unRegister in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtensionpublic void trace(java.lang.String msg)
msg - the string message to tracepublic net.n3.nanoxml.IXMLElement loadConfig(java.lang.String xmlFile)
public void handleRequest(java.lang.String cmd,
org.json.JSONObject jso,
User u,
int fromRoom)
handleRequest in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtensionpublic java.lang.Object handleInternalRequest(java.lang.Object params)
params - any number of objects
public void sendResponse(ActionscriptObject ao,
int fromRoom,
User sender,
java.util.LinkedList recipients)
sendResponse in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtensionao - the ActionscriptObject containing the data for the clientfromRoom - the roomId (-1 for none)recipients - a list of SocketChannelssender - the User object of the sender (if null, the sender is the Server)
public void sendResponse(java.lang.String[] params,
int fromRoom,
User sender,
java.util.LinkedList recipients)
sendResponse in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtensionparams - an array of String paramsfromRoom - the roomId (-1 for none)recipients - a list of SocketChannelssender - the User object of the sender (if null, the sender is the Server)
public void sendResponse(org.json.JSONObject jso,
int fromRoom,
User sender,
java.util.LinkedList recipients)
sendResponse in interface it.gotoandplay.smartfoxserver.extensions.ISmartFoxExtensionjso - a JSONObjectfromRoom - the roomId (-1 for none)recipients - a list of SocketChannelssender - the User object of the sender (if null, the sender is the Server)
public void sendResponse(net.sf.json.JSONObject jso,
int fromRoom,
User sender,
java.util.LinkedList recipients)
jso - a JSONObjectfromRoom - the roomId (-1 for none)recipients - a list of SocketChannelssender - the User object of the sender (if null, the sender is the Server)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||