sfs2x.client.requests
Class CreateRoomRequest

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

public class CreateRoomRequest
extends BaseRequest

Creates a new Room in the current Zone.

If the creation is successful, a roomAdd event is dispatched to all the users who subscribed the Group to which the Room is associated, including the Room creator. Otherwise, a roomCreationError event is returned to the creator's client.

Example
The following example creates a new game:

 private void someMethod() {
     sfs.addEventListener(SFSEvent.ROOM_ADD, new IEventListener() {
         public void dispatch(BaseEvent evt) throws SFSException {
             System.out.println("Room created: " + evt.getArguments().get("room"));
         }
     });
     
     sfs.addEventListener(SFSEvent.ROOM_CREATION_ERROR, new IEventListener() {
         public void dispatch(BaseEvent evt) throws SFSException {
             System.out.println("Room creation failed: " + evt.getArguments().get("errorMessage"));
         }
     });
     
     // Create a new chat Room
     RoomSettings settings = new RoomSettings("My Chat Room");
     settings.setMaxUsers(40);
     settings.setGroupId("chats");
     
     sfs.send(new CreateRoomRequest(settings));
 }
 

See Also:
SFSEvent.ROOM_ADD, SFSEvent.ROOM_CREATION_ERROR

Field Summary
static java.lang.String KEY_ALLOW_JOIN_INVITATION_BY_OWNER
          * API internal usage only *
static java.lang.String KEY_AUTOJOIN
          * API internal usage only *
static java.lang.String KEY_EVENTS
          * API internal usage only *
static java.lang.String KEY_EXTCLASS
          * API internal usage only *
static java.lang.String KEY_EXTID
          * API internal usage only *
static java.lang.String KEY_EXTPROP
          * API internal usage only *
static java.lang.String KEY_GROUP_ID
          * API internal usage only *
static java.lang.String KEY_ISGAME
          * API internal usage only *
static java.lang.String KEY_MAXSPECTATORS
          * API internal usage only *
static java.lang.String KEY_MAXUSERS
          * API internal usage only *
static java.lang.String KEY_MAXVARS
          * API internal usage only *
static java.lang.String KEY_MMO_DEFAULT_AOI
          * API internal usage only *
static java.lang.String KEY_MMO_MAP_HIGH_LIMIT
          * API internal usage only *
static java.lang.String KEY_MMO_MAP_LOW_LIMIT
          * API internal usage only *
static java.lang.String KEY_MMO_PROXIMITY_UPDATE_MILLIS
          * API internal usage only *
static java.lang.String KEY_MMO_SEND_ENTRY_POINT
          * API internal usage only *
static java.lang.String KEY_MMO_USER_MAX_LIMBO_SECONDS
          * API internal usage only *
static java.lang.String KEY_NAME
          * API internal usage only *
static java.lang.String KEY_PASSWORD
          * API internal usage only *
static java.lang.String KEY_PERMISSIONS
          * API internal usage only *
static java.lang.String KEY_ROOM
          * API internal usage only *
static java.lang.String KEY_ROOM_TO_LEAVE
          * API internal usage only *
static java.lang.String KEY_ROOMVARS
          * 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
CreateRoomRequest(RoomSettings settings)
           
CreateRoomRequest(RoomSettings settings, boolean autoJoin)
           
CreateRoomRequest(RoomSettings settings, boolean autoJoin, Room roomToLeave)
          Creates a new CreateRoomRequest 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_ROOM

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

See Also:
Constant Field Values

KEY_NAME

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

See Also:
Constant Field Values

KEY_PASSWORD

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

See Also:
Constant Field Values

KEY_GROUP_ID

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

See Also:
Constant Field Values

KEY_ISGAME

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

See Also:
Constant Field Values

KEY_MAXUSERS

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

See Also:
Constant Field Values

KEY_MAXSPECTATORS

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

See Also:
Constant Field Values

KEY_MAXVARS

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

See Also:
Constant Field Values

KEY_ROOMVARS

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

See Also:
Constant Field Values

KEY_PERMISSIONS

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

See Also:
Constant Field Values

KEY_EVENTS

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

See Also:
Constant Field Values

KEY_EXTID

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

See Also:
Constant Field Values

KEY_EXTCLASS

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

See Also:
Constant Field Values

KEY_EXTPROP

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

See Also:
Constant Field Values

KEY_AUTOJOIN

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

See Also:
Constant Field Values

KEY_ROOM_TO_LEAVE

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

See Also:
Constant Field Values

KEY_ALLOW_JOIN_INVITATION_BY_OWNER

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

See Also:
Constant Field Values

KEY_MMO_DEFAULT_AOI

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

See Also:
Constant Field Values

KEY_MMO_MAP_LOW_LIMIT

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

See Also:
Constant Field Values

KEY_MMO_MAP_HIGH_LIMIT

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

See Also:
Constant Field Values

KEY_MMO_USER_MAX_LIMBO_SECONDS

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

See Also:
Constant Field Values

KEY_MMO_PROXIMITY_UPDATE_MILLIS

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

See Also:
Constant Field Values

KEY_MMO_SEND_ENTRY_POINT

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

See Also:
Constant Field Values
Constructor Detail

CreateRoomRequest

public CreateRoomRequest(RoomSettings settings,
                         boolean autoJoin,
                         Room roomToLeave)
Creates a new CreateRoomRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

Parameters:
settings - An object containing the Room configuration settings.
autoJoin - If true, the Room is joined as soon as it is created.
roomToLeave - A Room object representing the Room that should be left if the new Room is auto-joined.
See Also:
SmartFox.send(sfs2x.client.requests.IRequest), RoomSettings, Room

CreateRoomRequest

public CreateRoomRequest(RoomSettings settings,
                         boolean autoJoin)
See Also:
CreateRoomRequest(RoomSettings, boolean, Room)

CreateRoomRequest

public CreateRoomRequest(RoomSettings settings)
See Also:
CreateRoomRequest(RoomSettings, boolean, Room)
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 *