Package net.sf.freecol.common.networking
Class LoginMessage
- java.lang.Object
- 
- net.sf.freecol.common.networking.Message
- 
- net.sf.freecol.common.networking.TrivialMessage
- 
- net.sf.freecol.common.networking.AttributeMessage
- 
- net.sf.freecol.common.networking.ObjectMessage
- 
- net.sf.freecol.common.networking.LoginMessage
 
 
 
 
 
- 
 public class LoginMessage extends ObjectMessage The message sent when logging in.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class net.sf.freecol.common.networking.MessageMessage.MessagePriority
 
- 
 - 
Field SummaryFields Modifier and Type Field Description private static java.lang.StringCURRENT_PLAYER_TAGprivate PlayerplayerThe player in the attached game, if any.private static java.lang.StringSINGLE_PLAYER_TAGprivate static java.lang.StringSTATE_TAGstatic java.lang.StringTAGprivate static java.lang.StringUSER_NAME_TAGprivate static java.lang.StringVERSION_TAG- 
Fields inherited from class net.sf.freecol.common.networking.AttributeMessageattributes
 - 
Fields inherited from class net.sf.freecol.common.networking.TrivialMessagecontinueMessage, disconnectMessage, endTurnMessage, enterRevengeModeMessage, reconnectMessage, requestLaunchMessage, retireMessage, startGameMessage
 - 
Fields inherited from class net.sf.freecol.common.networking.Messagelogger, messagePriorityComparator
 
- 
 - 
Constructor SummaryConstructors Constructor Description LoginMessage(Game ignoredGame, FreeColXMLReader xr)Create a newLoginMessagefrom a stream.LoginMessage(Player player, java.lang.String userName, java.lang.String version, FreeColServer.ServerState state, boolean singlePlayer, boolean currentPlayer, Game game)Create a newLoginMessagewith the supplied parameters.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclientHandler(FreeColClient freeColClient)Client-side handler for this message.private booleangetCurrentPlayer()private GamegetGame()private PlayergetPlayer(Game game)Get the player (if any) with the current name in a given game.Message.MessagePrioritygetPriority()Get the priority of this type of message.private booleangetSinglePlayer()private FreeColServer.ServerStategetState()private java.lang.StringgetUserName()private java.lang.StringgetVersion()private ChangeSetinGameLogin(FreeColServer freeColServer, Connection connection)Handle login to a running game.private ChangeSetloadGameLogin(FreeColServer freeColServer, Connection connection)Handle login that loads an existing game.ChangeSetloginHandler(FreeColServer freeColServer, Connection connection)Special purpose handler for the UserConnectionHandler.private ChangeSetpreGameLogin(FreeColServer freeColServer, Connection connection)Handle login to a completely new game.voidtoXML(FreeColXMLWriter xw)Write this message as XML.- 
Methods inherited from class net.sf.freecol.common.networking.ObjectMessageappendChild, appendChildren, getChildCount, getChildren, setChildren
 - 
Methods inherited from class net.sf.freecol.common.networking.AttributeMessagecanMerge, getStringAttribute, getStringAttributeMap, hasAttribute, setMergeable, setStringAttribute
 - 
Methods inherited from class net.sf.freecol.common.networking.TrivialMessageaiHandler, currentPlayerMessage, getType, serverHandler, setType
 - 
Methods inherited from class net.sf.freecol.common.networking.MessageclientGeneric, expected, getArrayAttributes, getBooleanAttribute, getChild, getChildren, getEnumAttribute, getIntegerAttribute, getPriorityLevel, igc, igc, invokeAndWait, invokeLater, isEmpty, isType, merge, pgc, pgc, pretty, read, setArrayAttributes, setArrayAttributes, setBooleanAttribute, setEnumAttribute, setIntegerAttribute, setStringAttributeMap, setStringAttributes, setStringAttributes, toString, writeAttributes, writeChildren
 
- 
 
- 
- 
- 
Field Detail- 
TAGpublic static final java.lang.String TAG - See Also:
- Constant Field Values
 
 - 
CURRENT_PLAYER_TAGprivate static final java.lang.String CURRENT_PLAYER_TAG - See Also:
- Constant Field Values
 
 - 
SINGLE_PLAYER_TAGprivate static final java.lang.String SINGLE_PLAYER_TAG - See Also:
- Constant Field Values
 
 - 
STATE_TAGprivate static final java.lang.String STATE_TAG - See Also:
- Constant Field Values
 
 - 
USER_NAME_TAGprivate static final java.lang.String USER_NAME_TAG - See Also:
- Constant Field Values
 
 - 
VERSION_TAGprivate static final java.lang.String VERSION_TAG - See Also:
- Constant Field Values
 
 - 
playerprivate Player player The player in the attached game, if any.
 
- 
 - 
Constructor Detail- 
LoginMessagepublic LoginMessage(Player player, java.lang.String userName, java.lang.String version, FreeColServer.ServerState state, boolean singlePlayer, boolean currentPlayer, Game game) Create a newLoginMessagewith the supplied parameters.- Parameters:
- player- The- playerto send to.
- userName- The name of the user logging in.
- version- The version of FreeCol at the client.
- state- The server state.
- singlePlayer- True in single player games.
- currentPlayer- True if this player is the current player.
- game- The entire game.
 
 - 
LoginMessagepublic LoginMessage(Game ignoredGame, FreeColXMLReader xr) throws javax.xml.stream.XMLStreamException Create a newLoginMessagefrom a stream.- Parameters:
- ignoredGame- A- Game(not actually used, the actual game is read from the stream).
- xr- The- FreeColXMLReaderto read the message from.
- Throws:
- javax.xml.stream.XMLStreamException- if there is a problem reading the stream.
 
 
- 
 - 
Method Detail- 
getUserNameprivate java.lang.String getUserName() 
 - 
getVersionprivate java.lang.String getVersion() 
 - 
getStateprivate FreeColServer.ServerState getState() 
 - 
getSinglePlayerprivate boolean getSinglePlayer() 
 - 
getCurrentPlayerprivate boolean getCurrentPlayer() 
 - 
getGameprivate Game getGame() 
 - 
getPlayerprivate Player getPlayer(Game game) Get the player (if any) with the current name in a given game.- Parameters:
- game- The- Gameto look up.
- Returns:
- The ServerPlayerfound.
 
 - 
getPrioritypublic Message.MessagePriority getPriority() Get the priority of this type of message.- Overrides:
- getPriorityin class- AttributeMessage
- Returns:
- The message priority.
 
 - 
clientHandlerpublic void clientHandler(FreeColClient freeColClient) Client-side handler for this message. Client handlers always return null.- Overrides:
- clientHandlerin class- TrivialMessage
- Parameters:
- freeColClient- The- FreeColClientto handle this message.
 
 - 
toXMLpublic void toXML(FreeColXMLWriter xw) throws javax.xml.stream.XMLStreamException Write this message as XML.
 - 
preGameLoginprivate ChangeSet preGameLogin(FreeColServer freeColServer, Connection connection) Handle login to a completely new game.- Parameters:
- freeColServer- The- FreeColServerto log into.
- connection- The incoming- Connectionthat is logging in.
- Returns:
- A ChangeSetwith the result.
 
 - 
loadGameLoginprivate ChangeSet loadGameLogin(FreeColServer freeColServer, Connection connection) Handle login that loads an existing game.- Parameters:
- freeColServer- The- FreeColServerto log into.
- connection- The incoming- Connectionthat is logging in.
- Returns:
- A ChangeSetwith the result.
 
 - 
inGameLoginprivate ChangeSet inGameLogin(FreeColServer freeColServer, Connection connection) Handle login to a running game.- Parameters:
- freeColServer- The- FreeColServerto log into.
- connection- The incoming- Connectionthat is logging in.
- Returns:
- A ChangeSetwith the result.
 
 - 
loginHandlerpublic ChangeSet loginHandler(FreeColServer freeColServer, Connection connection) Special purpose handler for the UserConnectionHandler.- Parameters:
- freeColServer- The server to connect to.
- connection- The incoming- Connection.
- Returns:
- A ChangeSetencapsulating the login.
 
 
- 
 
-