sfs2x.client.requests
Class FindRoomsRequest

java.lang.Object
  extended by sfs2x.client.requests.BaseRequest
      extended by sfs2x.client.requests.FindRoomsRequest
All Implemented Interfaces:
sfs2x.client.requests.IRequest

public class FindRoomsRequest
extends BaseRequest

Retrieves a list of Rooms from the server which match the specified criteria.

By providing a matching expression and a search scope (a Group or the entire Zone), SmartFoxServer can find those Rooms matching the passed criteria and return them by means of the roomFindResult event.

Example
The following example looks for all the server Rooms whose "country" Room Variable is set to Sweden:

 private void someMethod() {
     sfs.addEventListener(SFSEvent.ROOM_FIND_RESULT, new IEventListener() {
         public void dispatch(BaseEvent evt) throws SFSException {
             System.out.println("Rooms found: " + evt.getArguments().get("rooms"));
         }
     });
     
     // Create a matching expression to find Rooms with a "country" variable equal to "Sweden"
     MatchExpression exp = new MatchExpression("country", StringMatch.EQUALS, "Sweden");
     
     // Find the Rooms
     sfs.send(new FindRoomsRequest(exp));
 }
 

See Also:
MatchExpression, SFSEvent.ROOM_FIND_RESULT

Field Summary
static java.lang.String KEY_EXPRESSION
          * API internal usage only *
static java.lang.String KEY_FILTERED_ROOMS
          * API internal usage only *
static java.lang.String KEY_GROUP
          * API internal usage only *
static java.lang.String KEY_LIMIT
          * API internal usage only *
 
Fields inherited from class sfs2x.client.requests.BaseRequest
AddBuddy, AdminMessage, AutoJoin, BanUser, BlockBuddy, CallExtension, ChangeRoomCapacity, ChangeRoomName, ChangeRoomPassword, CreateRoom, CreateSFSGame, FindRooms, FindUsers, GenericMessage, GetRoomList, GoOnline, Handshake, InitBuddyList, InvitationReply, InviteUser, JoinRoom, JoinRoomInvite, KEY_ERROR_CODE, KEY_ERROR_PARAMS, KickUser, LeaveRoom, Login, Logout, ManualDisconnection, ModeratorMessage, ObjectMessage, PingPong, PlayerToSpectator, PrivateMessage, PublicMessage, QuickJoinGame, RemoveBuddy, SetBuddyVariables, SetRoomVariables, SetUserPosition, SetUserVariables, SpectatorToPlayer, SubscribeRoomGroup, UnsubscribeRoomGroup
 
Constructor Summary
FindRoomsRequest(MatchExpression expr)
           
FindRoomsRequest(MatchExpression expr, java.lang.String groupId)
           
FindRoomsRequest(MatchExpression expr, java.lang.String groupId, short limit)
          Creates a new FindRoomsRequest instance.
 
Method Summary
 void execute(ISmartFox sfs)
          * API internal usage only *
 void validate(ISmartFox sfs)
          * API internal usage only *
 
Methods inherited from class sfs2x.client.requests.BaseRequest
getId, getMessage, getTargetController, isEncrypted, setEncrypted, setId, setTargetController
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_EXPRESSION

public static final java.lang.String KEY_EXPRESSION
* API internal usage only *

See Also:
Constant Field Values

KEY_GROUP

public static final java.lang.String KEY_GROUP
* API internal usage only *

See Also:
Constant Field Values

KEY_LIMIT

public static final java.lang.String KEY_LIMIT
* API internal usage only *

See Also:
Constant Field Values

KEY_FILTERED_ROOMS

public static final java.lang.String KEY_FILTERED_ROOMS
* API internal usage only *

See Also:
Constant Field Values
Constructor Detail

FindRoomsRequest

public FindRoomsRequest(MatchExpression expr,
                        java.lang.String groupId,
                        short limit)
Creates a new FindRoomsRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

Parameters:
expr - A matching expression that the system will use to retrieve the Rooms.
groupId - The name of the Group where to search for matching Rooms; if null, the search is performed in the whole Zone.
limit - The maximum size of the list of Rooms that will be returned by the roomFindResult event. If 0, all the found Rooms are returned.
See Also:
SmartFox.send(sfs2x.client.requests.IRequest), SFSEvent.ROOM_FIND_RESULT

FindRoomsRequest

public FindRoomsRequest(MatchExpression expr,
                        java.lang.String groupId)
See Also:
FindRoomsRequest(MatchExpression, String, short)

FindRoomsRequest

public FindRoomsRequest(MatchExpression expr)
See Also:
FindRoomsRequest(MatchExpression, String, short)
Method Detail

validate

public void validate(ISmartFox sfs)
              throws sfs2x.client.exceptions.SFSValidationException
* API internal usage only *

Throws:
sfs2x.client.exceptions.SFSValidationException

execute

public void execute(ISmartFox sfs)
* API internal usage only *