de.upb.swtpra05.group03.companycontrol
Class CompanyControlClient

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended byde.upb.swtpra.kernel.companycontrol.CompanyControlClientBase
                  extended byde.upb.swtpra05.group03.companycontrol.CompanyControlClient
All Implemented Interfaces:
java.rmi.Remote, de.upb.swtpra.kernel.companycontrol.RMICompanyControlClientInterface, java.lang.Runnable, java.io.Serializable, de.upb.swtpra.kernel.visualisation.client.ServerStatusCheckerInterface

public class CompanyControlClient
extends de.upb.swtpra.kernel.companycontrol.CompanyControlClientBase

The Company Control Client. This Class inherits the ClientBase Class and is used for the Communication with the Server.

Version:
$Revision: 1.3 $
See Also:
Serialized Form

Field Summary
static int clientPort
          Client Port
private  int CompanyID
          Die Company ID
private static int CONNECTED
           
private  CryptoMessagesHandler cryptoMsgHandler
          this class encrypts all messages to the shuttles and decrypts all messages received from them
private static int DISCONNECTED
           
private  java.util.HashMap IDtoShuttleAgentID
          map the two different kinds of IDs
private  java.util.HashMap IDtoStationName
          Map to get the associated Name of a StationID Key : StationID (Integer) Value : Name (String)
private  java.util.HashMap KernelIDtoShuttleAgentID
          Stores all received ShuttleAgentIDs
private  CompanyMainControl refMainControl
          Reference to MainControl
private static long serialVersionUID
          Comment for serialVersionUID
static int serverPort
          Server Port
static java.lang.String serverURL
          the URL of the server
static Settings settings
           
private  java.util.Map shuttleList
           
private  java.util.Map shuttleStockMap
          Stores all Informations for the StockTable Key : StationID (Integer) Value : StockInformation (Class)
private  int state
           
private  java.util.LinkedList WaitingStocks
           
 
Fields inherited from class de.upb.swtpra.kernel.companycontrol.CompanyControlClientBase
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
 
Fields inherited from class java.rmi.server.RemoteServer
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
CompanyControlClient(CompanyMainControl refMainControl)
           
 
Method Summary
 void connectionRefused()
          The client can override this method in order to handle the case when a connection ist refused by the SimulationKernel.
 void disconnect()
           
private  java.util.HashMap extractStationNames(de.upb.swtpra.kernel.TopologyData td)
          Gathers all Station Names from the Topology
 de.upb.swtpra.kernel.id.ShuttleAgentID getShuttleAgentID(int ID)
           
private  ShuttleInformation handleRemoteShuttleStatusString(de.upb.swtpra.kernel.visualisation.RemoteShuttleStatusString rsss)
           
 void init(de.upb.swtpra.kernel.TopologyData td, int time)
          At the beginning the client gets the current topology.
private  void initialize()
          Initialize the Client.
 void logon(java.lang.String Ip, int Port, java.lang.String Username, java.lang.String Password)
           
 void sendMessage(de.upb.swtpra.kernel.companycontrol.CompanyControlRemoteObj msg)
           
 void update(de.upb.swtpra.kernel.visualisation.RemoteObj obj)
          Update Method that handles incoming Messages.
private  void updateWaitingStocks()
          Commits the StockInformations held back because not all Station Names have been gather at the time the Information was received in the update Method
 
Methods inherited from class de.upb.swtpra.kernel.companycontrol.CompanyControlClientBase
abortConnection, connectToServer, disconnectFromServer, getKerntelToClientQueue, getQueue, getServer, isConnected, run, sendMessageToKernel
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Comment for serialVersionUID

See Also:
Constant Field Values

DISCONNECTED

private static final int DISCONNECTED
See Also:
Constant Field Values

CONNECTED

private static final int CONNECTED
See Also:
Constant Field Values

state

private int state

shuttleStockMap

private java.util.Map shuttleStockMap
Stores all Informations for the StockTable Key : StationID (Integer) Value : StockInformation (Class)


shuttleList

private java.util.Map shuttleList

IDtoStationName

private java.util.HashMap IDtoStationName
Map to get the associated Name of a StationID Key : StationID (Integer) Value : Name (String)


KernelIDtoShuttleAgentID

private java.util.HashMap KernelIDtoShuttleAgentID
Stores all received ShuttleAgentIDs


IDtoShuttleAgentID

private java.util.HashMap IDtoShuttleAgentID
map the two different kinds of IDs


serverURL

public static java.lang.String serverURL
the URL of the server


WaitingStocks

private java.util.LinkedList WaitingStocks

clientPort

public static int clientPort
Client Port


refMainControl

private CompanyMainControl refMainControl
Reference to MainControl


serverPort

public static int serverPort
Server Port


settings

public static final Settings settings

CompanyID

private int CompanyID
Die Company ID


cryptoMsgHandler

private CryptoMessagesHandler cryptoMsgHandler
this class encrypts all messages to the shuttles and decrypts all messages received from them

Constructor Detail

CompanyControlClient

public CompanyControlClient(CompanyMainControl refMainControl)
                     throws java.rmi.RemoteException
Parameters:
refMainControl -
Throws:
java.rmi.RemoteException
Method Detail

initialize

private void initialize()
Initialize the Client.


connectionRefused

public void connectionRefused()
Description copied from class: de.upb.swtpra.kernel.companycontrol.CompanyControlClientBase
The client can override this method in order to handle the case when a connection ist refused by the SimulationKernel.


extractStationNames

private java.util.HashMap extractStationNames(de.upb.swtpra.kernel.TopologyData td)
Gathers all Station Names from the Topology

Parameters:
td -
Returns:
HashMap

updateWaitingStocks

private void updateWaitingStocks()
Commits the StockInformations held back because not all Station Names have been gather at the time the Information was received in the update Method


init

public void init(de.upb.swtpra.kernel.TopologyData td,
                 int time)
Description copied from class: de.upb.swtpra.kernel.companycontrol.CompanyControlClientBase
At the beginning the client gets the current topology.

Parameters:
td - The TopologyData object with the topology.
time - The current simulation time.

handleRemoteShuttleStatusString

private ShuttleInformation handleRemoteShuttleStatusString(de.upb.swtpra.kernel.visualisation.RemoteShuttleStatusString rsss)
Parameters:
rsss -
Returns:
shuttle info

update

public void update(de.upb.swtpra.kernel.visualisation.RemoteObj obj)
Update Method that handles incoming Messages.


logon

public void logon(java.lang.String Ip,
                  int Port,
                  java.lang.String Username,
                  java.lang.String Password)
Parameters:
Ip -
Port -
Username -
Password -

disconnect

public void disconnect()

getShuttleAgentID

public de.upb.swtpra.kernel.id.ShuttleAgentID getShuttleAgentID(int ID)
Parameters:
ID -
Returns:
ShuttleAgentID

sendMessage

public void sendMessage(de.upb.swtpra.kernel.companycontrol.CompanyControlRemoteObj msg)
Parameters:
msg -