SmartFoxServer API (key classes and Key
SmartfoxServer2x programing can be divided into server related
programing, client related programing.
As mentioned earlier to this session Extension are fundamental
units of smartfoxserver2x, through the extension programing we
can control the zone and rooms.
Extension Life Cycle:-
- Extension is a java program so in the same way, Extension
program have a life cycle as extension initialization done at
init() method and ends at destroy() method.
- init() whenever the extension
loaded into Smartfox this will be fired, during the lifespan of
extension it is fired only once.
- destroy() this method is fired while at the time of
SmartfoxServer2X provides an API with that we can create the
extension jar files. Key Classes of Smartfox/Extension API
Key Classes And Interfaces
of SmartFoxServer2X API
- We can create the zones manually by creating zone.xml files
under zones folder
- We can create the zones using SmartfoxAdminTool in easy GUI
- Simple code to create room from Server side:
- Simple code to create room at Client side:
||Root Interface which consists the methods of extension
life cycle to implement.
||An abstract class which implements ISFSExtension , If we
want to call a java program as Extension File then it must
extend this class.
Main Methods of this class are
- An Abstract class which Implements IClientRequestHandler
- If we want to handle the custom events means
non-predefined events then our class need to extend this
- This abstract class consist an abstract method named
handleClientRequest() we need to implement that method.
- In order to override the behaviour of predefined events
related zone and room we need to extend this class.
- Means if we want to handle the events like Zonejoin, RoomJoin, Login, Disconnect
in that case our class must extend
- This abstract class consist an abstract method named handleServerEvent() we need to
implement that method.
- This is an enum which consist EventTypes supported and
generated by SmartfoxServer
- Main class of Extension api, Only after instantiation of
this class only all the other smartfox related program able
to interact with client.
- A static method named 'getInstance()' of this class
return the instance of SmartFoxServer.
- It is a class which implements IDBManager interface
provided by SFS2X platform.
- It manages the connection to a database using either
JDBC native drivers or JDBC-ODBC bridge.
- It provides configurable connection pooling for optimal
performance and resource usage.
- Each Zone runs its own DbManager which can be configured
via the Zone Configurator module in the SFS2X AdminTool.
- A Zone can instantiate multiple DbManagers via server
- Key Methods of SFSDBManager
- Connection getConnection()
- Object executeInsert()
- void executeUpdate()
- ISFSArray executeQuery()
- int getActiveConnections()
- int getIdleConnections()