net.sf.opensmus
Class MUSMovie

java.lang.Object
  extended by net.sf.opensmus.MUSMovie
All Implemented Interfaces:
ServerMovie

public class MUSMovie
extends java.lang.Object
implements ServerMovie


Field Summary
 MUSGroup allUsers
           
protected  java.util.Vector<java.lang.String> m_disabledgroupslist
           
 boolean m_enabled
           
 java.util.concurrent.ConcurrentHashMap<java.lang.String,MUSGroup> m_grouplist
           
 java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Integer> m_groupsizelimitlist
           
 int m_maxconnections
           
 java.lang.String m_name
           
protected  java.util.Vector<java.lang.String> m_notifydisconnectlist
           
 boolean m_persists
           
 MUSMovieProperties m_props
           
 java.util.Vector<ServerSideScript> m_scriptList
           
 java.util.concurrent.ConcurrentHashMap<java.lang.String,ServerUser> m_userlist
           
 
Constructor Summary
MUSMovie(MUSServer srv, java.lang.String initname)
           
 
Method Summary
 void addGroup(MUSGroup oneGroup)
           
 void addUser(ServerUser wuser)
           
 void buildUserlevelCache()
           
 void checkStructure()
           
 void createAllServerSideScripts()
           
 ServerGroup createServerGroup(java.lang.String groupname)
          Creates a new group on the movie and returns a pointer to it.
 boolean createServerSideScript(int scriptNumber)
           
 void deleteServerGroup(java.lang.String groupname)
          Deletes a group from the movie.
 boolean deleteServerSideScript(int scriptNum)
           
 boolean deleteServerSideScript(java.lang.String scriptName)
           
 void disableGroup(java.lang.String gname)
          Disables this group so new users can not join it.
 void enableGroup(java.lang.String gname)
          Enables this group to receive new users.
 MUSGroup getGroup(java.lang.String gname)
           
static void GetGroupListFromContents(LList list, LValue cont)
           
 int getRequiredUserLevel(java.lang.String command)
           
 MUSServer getServer()
           
 ServerGroup getServerGroup(int groupidx)
          Retrieves a pointer to a ServerGroup object representing a group that exists on this ServerMovie.
 ServerGroup getServerGroup(java.lang.String groupname)
          Retrieves a pointer to a ServerGroup object representing a group that exists on this ServerMovie.
static void GetStringListFromContents(LList list, LValue cont)
           
 ServerUser getUser(java.lang.String uname)
           
 void handleGroupAttributeMsg(ServerUser user, java.lang.String attrcommand, MUSMessage msg, MUSMessage reply)
           
 void handleGroupMsg(ServerUser user, java.lang.String recpt, MUSMessage msg)
           
 void handleLocalMsg(ServerUser user, java.lang.String recpt, MUSMessage msg)
           
 void handleMsg(ServerUser user, MUSMessage msg)
           
 void handleSystemMsg(ServerUser user, java.lang.String recpt, MUSMessage msg)
           
 boolean IsConnectionAllowed(ServerUser auser)
           
 boolean IsGroupAllowed(java.lang.String groupname)
           
 void logDroppedMsg()
           
 java.lang.String name()
          Returns the name of the movie as a String
 void notifyDisconnection(java.lang.String uname)
           
 boolean persists()
          Checks if the movie is set to persist on the server even when no users are connected to it.
 void removeAllUsers()
           
 void removeUser(ServerUser oneuser)
           
 int serverGroupCount()
          Gets the number of groups in this movie.
 int serverUserCount()
          Gets the number of users connected to this movie.
 void setpersists(boolean persistflag)
          Toggles the movie persistent flag for this movie.
 void setuserLevel(int level)
          Sets the default user levels for users that connect to this movie and do not have a user account in the DB.
 LValue srvcmd_createUniqueName()
           
 LValue srvcmd_getGroupCount()
           
 LValue srvcmd_getGroups()
           
 LValue srvcmd_getUserCount()
           
 void srvcmd_joinGroup(ServerUser user, java.lang.String gname)
           
 void srvcmd_leaveGroup(ServerUser user, java.lang.String gname)
           
 int userLevel()
          Gets the default user levels for users that connect to this movie and do not have a user account in the DB.
 boolean userThreadAlive(java.lang.String uname)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_name

public java.lang.String m_name

m_grouplist

public final java.util.concurrent.ConcurrentHashMap<java.lang.String,MUSGroup> m_grouplist

m_userlist

public final java.util.concurrent.ConcurrentHashMap<java.lang.String,ServerUser> m_userlist

m_groupsizelimitlist

public final java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Integer> m_groupsizelimitlist

m_disabledgroupslist

protected final java.util.Vector<java.lang.String> m_disabledgroupslist

m_notifydisconnectlist

protected final java.util.Vector<java.lang.String> m_notifydisconnectlist

m_maxconnections

public final int m_maxconnections

m_props

public MUSMovieProperties m_props

m_enabled

public boolean m_enabled

m_persists

public boolean m_persists

m_scriptList

public final java.util.Vector<ServerSideScript> m_scriptList

allUsers

public final MUSGroup allUsers
Constructor Detail

MUSMovie

public MUSMovie(MUSServer srv,
                java.lang.String initname)
Method Detail

getServer

public MUSServer getServer()

addGroup

public void addGroup(MUSGroup oneGroup)

srvcmd_getUserCount

public LValue srvcmd_getUserCount()
                           throws GroupNotFoundException
Throws:
GroupNotFoundException

getGroup

public MUSGroup getGroup(java.lang.String gname)
                  throws GroupNotFoundException,
                         MUSErrorCode
Throws:
GroupNotFoundException
MUSErrorCode

notifyDisconnection

public void notifyDisconnection(java.lang.String uname)

getUser

public ServerUser getUser(java.lang.String uname)
                   throws UserNotFoundException
Throws:
UserNotFoundException

addUser

public void addUser(ServerUser wuser)

removeUser

public void removeUser(ServerUser oneuser)

removeAllUsers

public void removeAllUsers()

checkStructure

public void checkStructure()

userThreadAlive

public boolean userThreadAlive(java.lang.String uname)

srvcmd_getGroups

public LValue srvcmd_getGroups()

srvcmd_getGroupCount

public LValue srvcmd_getGroupCount()

srvcmd_createUniqueName

public LValue srvcmd_createUniqueName()

IsGroupAllowed

public boolean IsGroupAllowed(java.lang.String groupname)

IsConnectionAllowed

public boolean IsConnectionAllowed(ServerUser auser)

disableGroup

public void disableGroup(java.lang.String gname)
Description copied from interface: ServerMovie
Disables this group so new users can not join it.

Specified by:
disableGroup in interface ServerMovie

enableGroup

public void enableGroup(java.lang.String gname)
Description copied from interface: ServerMovie
Enables this group to receive new users. Groups are enabled by default.

Specified by:
enableGroup in interface ServerMovie

logDroppedMsg

public void logDroppedMsg()

getServerGroup

public ServerGroup getServerGroup(java.lang.String groupname)
                           throws GroupNotFoundException
Description copied from interface: ServerMovie
Retrieves a pointer to a ServerGroup object representing a group that exists on this ServerMovie.

Specified by:
getServerGroup in interface ServerMovie
Parameters:
groupname - String with the name of the group to be returned
Returns:
ServerGroup pointer, or throws a GroupNotFoundException
Throws:
GroupNotFoundException

getServerGroup

public ServerGroup getServerGroup(int groupidx)
                           throws GroupNotFoundException
Description copied from interface: ServerMovie
Retrieves a pointer to a ServerGroup object representing a group that exists on this ServerMovie.

Specified by:
getServerGroup in interface ServerMovie
Parameters:
groupidx - index of the movie to be returned
Returns:
ServerGroup pointer, or throws a GroupNotFoundException
Throws:
GroupNotFoundException

createServerGroup

public ServerGroup createServerGroup(java.lang.String groupname)
                              throws MUSErrorCode
Description copied from interface: ServerMovie
Creates a new group on the movie and returns a pointer to it.

Specified by:
createServerGroup in interface ServerMovie
Parameters:
groupname - String with the name of the group to be created
Returns:
ServerGroup pointer, or throws a MUSErrorCode if the creation fails
Throws:
MUSErrorCode

deleteServerGroup

public void deleteServerGroup(java.lang.String groupname)
Description copied from interface: ServerMovie
Deletes a group from the movie.

Specified by:
deleteServerGroup in interface ServerMovie
Parameters:
groupname - String with the name of the group to be deleted

serverGroupCount

public int serverGroupCount()
Description copied from interface: ServerMovie
Gets the number of groups in this movie.

Specified by:
serverGroupCount in interface ServerMovie
Returns:
the number of groups

serverUserCount

public int serverUserCount()
Description copied from interface: ServerMovie
Gets the number of users connected to this movie.

Specified by:
serverUserCount in interface ServerMovie
Returns:
the number of users

name

public java.lang.String name()
Description copied from interface: ServerMovie
Returns the name of the movie as a String

Specified by:
name in interface ServerMovie

userLevel

public int userLevel()
Description copied from interface: ServerMovie
Gets the default user levels for users that connect to this movie and do not have a user account in the DB.
This value can be configured by the DefaultUserLevel directive in a movie configuration file.

Specified by:
userLevel in interface ServerMovie

setuserLevel

public void setuserLevel(int level)
Description copied from interface: ServerMovie
Sets the default user levels for users that connect to this movie and do not have a user account in the DB.
When this method is used it overrides the value configured by the DefaultUserLevel directive in a movie configuration file.

Specified by:
setuserLevel in interface ServerMovie

persists

public boolean persists()
Description copied from interface: ServerMovie
Checks if the movie is set to persist on the server even when no users are connected to it. Movies are not persistent by default.

Specified by:
persists in interface ServerMovie
Returns:
TRUE if the movie is set to persist, FALSE otherwise

setpersists

public void setpersists(boolean persistflag)
Description copied from interface: ServerMovie
Toggles the movie persistent flag for this movie. Persistent movies are not destroyed even when no users are connected to it.

Specified by:
setpersists in interface ServerMovie
Parameters:
persistflag - TRUE if the movie needs to persist on the server, FALSE otherwise

createAllServerSideScripts

public void createAllServerSideScripts()

createServerSideScript

public boolean createServerSideScript(int scriptNumber)

deleteServerSideScript

public boolean deleteServerSideScript(int scriptNum)

deleteServerSideScript

public boolean deleteServerSideScript(java.lang.String scriptName)

buildUserlevelCache

public void buildUserlevelCache()

getRequiredUserLevel

public int getRequiredUserLevel(java.lang.String command)

handleMsg

public void handleMsg(ServerUser user,
                      MUSMessage msg)

handleLocalMsg

public void handleLocalMsg(ServerUser user,
                           java.lang.String recpt,
                           MUSMessage msg)

handleSystemMsg

public void handleSystemMsg(ServerUser user,
                            java.lang.String recpt,
                            MUSMessage msg)

handleGroupAttributeMsg

public void handleGroupAttributeMsg(ServerUser user,
                                    java.lang.String attrcommand,
                                    MUSMessage msg,
                                    MUSMessage reply)

handleGroupMsg

public void handleGroupMsg(ServerUser user,
                           java.lang.String recpt,
                           MUSMessage msg)

GetStringListFromContents

public static void GetStringListFromContents(LList list,
                                             LValue cont)

GetGroupListFromContents

public static void GetGroupListFromContents(LList list,
                                            LValue cont)
                                     throws MUSErrorCode
Throws:
MUSErrorCode

srvcmd_joinGroup

public void srvcmd_joinGroup(ServerUser user,
                             java.lang.String gname)
                      throws MUSErrorCode
Throws:
MUSErrorCode

srvcmd_leaveGroup

public void srvcmd_leaveGroup(ServerUser user,
                              java.lang.String gname)
                       throws MUSErrorCode
Throws:
MUSErrorCode