|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
The main interface of the org.omus.ext package, used to build custom groups (or "rooms").
It contains a set of methods that get invoked when a special event occured. All groups in the Oregano Server are single-threaded, so you do not need to care about synchronization issues. There is no need to create your own threads or Timer instances. If there is a time consuming task you can delegate it to a pool of worker threads with one of the methods of the TaskManager.
There are two places in config.xml where a GroupExtension can be specified. The defaultExtension attribute of the enclosing <groupConfig>-node and the extension attribute of each particular <group>-node. The former is useful if you want to add features to every group that will be created on the server, the latter is used if you write a "local" extension, only intended for groups created with a particular configID. If you combine both approaches, make sure that your local extension is a subclass of your defaultExtension, otherwise the functionality of your defaultExtension would be wiped out by the methods in your local one.
Let's assume you develop a default extension with the following class body:
class MyGlobalExtension implements org.omus.ext.GroupExtension { ... }
In this case the groupConfig node in config.xml should look as follows:
<groupConfig defaultExtension="MyGlobalExtension" ...
If you want to add special behaviour to a particular set of groups, you can define a subclass:
class MySpecialExtension extends MyGlobalExtension { ... }
Each method in this subclass should call the method in the superclass that it overrides
if you want to combine the functionality of your local and global extensions.
The node for the groups that are supposed to load this extension might look as follows:
<group
configID="spec"
userLimit="50"
extension="MySpecialExtension"
/>
<startup server="serv1" name="spec_A" />
<startup server="serv1" name="spec_B" />
</group>
When the server boots, two groups named "spec_A" and "spec_B" will be created and both
will load the extension class MySpecialExtension which in turn is a subclass of
MyGlobalExtension. Furthermore each group that will be created dynamically due to a
client calling org.omus.group.change("anyName","spec",false) will load
the same extension too.
| Method Summary | |
void |
finishGroupCreation(Group group)
Invoked after the group has been created. |
void |
groupRemoved()
Invoked after the group has been removed. |
void |
messageFromClient(Message msg,
User sender)
Invoked after a message from the specified sender has been received. |
boolean |
messageToGroup(Message msg)
Invoked before a message is sent to all the clients who are currently member of this group. |
boolean |
messageToUser(Message msg,
User recipient)
Invoked before a message is sent to the specified user. |
boolean |
prepareGroupCreation(GroupCreationData gcd)
Invoked before the group will be created. |
boolean |
syncGroupProperties(PropertyUpdate newValues,
User sender)
Invoked before the properties of this group will be synchronized. |
boolean |
syncUserProperties(PropertyUpdate newValues,
User sender,
User owner)
Invoked before the properties of the specified owner will be synchronized. |
void |
userJoined(User user,
DataRow extraData)
Invoked after a user has joined the group. |
void |
userLeft(User user)
Invoked after a user has left the group. |
| Method Detail |
public boolean prepareGroupCreation(GroupCreationData gcd)
public void finishGroupCreation(Group group)
public void groupRemoved()
public void userJoined(User user,
DataRow extraData)
onChange event handler of the group object in the client. (if you develop an extension to
the login group, the additional data will be receceived in the onLogin or onRegister events.public void userLeft(User user)
public boolean messageToUser(Message msg,
User recipient)
sendToUser or sendToAll in org.omus.messenger
or from any server extension
calling sendToGroup or sendToAll in the MessagingManager. Return true if you want the message
to proceed on its way to the client.public boolean messageToGroup(Message msg)
sendToGroup in org.omus.messenger
or from any
server extension calling sendToGroup in the MessagingManager. Return true if you want the message
to proceed on its way to the clients.
public void messageFromClient(Message msg,
User sender)
sendToServer in org.omus.messenger.
public boolean syncUserProperties(PropertyUpdate newValues,
User sender,
User owner)
setErrorCode method of the PropertyUpdate object to send customized
error codes to the clients. Otherwise a default error code will be sent.
public boolean syncGroupProperties(PropertyUpdate newValues,
User sender)
setErrorCode method of the PropertyUpdate object to send customized error
codes to the clients. Otherwise a default error code will be sent.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||