org.gscg.singleuser.interactionlayer
Class DistributorSingleUserInteractionLayer

java.lang.Object
  extended bynl.tudelft.simulation.event.EventProducer
      extended byorg.gscg.common.interactionlayer.ThreadedEventProducer
          extended byorg.gscg.singleuser.interactionlayer.DistributorSingleUserInteractionLayer
All Implemented Interfaces:
java.util.EventListener, nl.tudelft.simulation.event.EventListenerInterface, nl.tudelft.simulation.event.EventProducerInterface, GlobalInteractionLayerInterface, java.rmi.Remote, nl.tudelft.simulation.event.remote.RemoteEventProducerInterface, RemoteInteractionLayerInterface, java.io.Serializable, SingleUserInteractionLayerInterface

public class DistributorSingleUserInteractionLayer
extends ThreadedEventProducer
implements RemoteInteractionLayerInterface, SingleUserInteractionLayerInterface

The DistributorSingleUserInteractionLayer takes care of the communication between the simulation server side and a client side application for a distributor.

Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl . The source code and binary code of this software is proprietary information of Delft University of Technology.

Since:
1.0.0
Version:
$Revision: 1.1 $ $Date: 2005/08/09 15:43:41 $
Author:
Stijn-Pieter van Houten
See Also:
Serialized Form

Field Summary
protected static java.util.Map idMap
          the static list of ids in this game for identification mapping
 
Fields inherited from class org.gscg.common.interactionlayer.ThreadedEventProducer
DIJKSTRASEMAPHORE
 
Fields inherited from class nl.tudelft.simulation.event.EventProducer
listeners
 
Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
 
Constructor Summary
DistributorSingleUserInteractionLayer(nl.tudelft.simulation.dsol.simulators.SimulatorInterface simulator, java.lang.String id, nl.tudelft.simulation.supplychain.actor.SupplyChainActor owner, GameGlobalData globalSupplyChainData)
          constructs a new DistributorSingleUserInteractionLayer
 
Method Summary
 void addEventType(nl.tudelft.simulation.event.EventType eventType)
          Method addEventType Before an event is fired by the interaction layer, a check is performed whether the interaction layer should fire the event.
 void addEventTypeSentByClient(nl.tudelft.simulation.event.EventType eventType)
          Method addEventTypeSentByClient.
 void addEventTypeToAnnounceList(nl.tudelft.simulation.event.EventType eventType, AnnounceInterface announceObject)
          Method addEventTypeToAnnounceList.
 void addStatisticEventType(nl.tudelft.simulation.event.EventType eventType)
          Method addStatisticEventType adds an event to a set with event types only used for statistical updates.
 void fireAllNumberData()
          Method fireAllNumberData.
 void getCache(java.lang.Object remoteEventProducer, nl.tudelft.simulation.event.EventType eventType, boolean cache)
          this method is used by a remote client to indicate that it is 'online' the server side object is then able to subscribe to client side events and to send cached data
 void getContentList(java.lang.Class contentClass, boolean sent, java.lang.String productName)
          Method getContentList.
 GameGlobalData getGlobalSupplyChainData()
           
 nl.tudelft.simulation.supplychain.actor.SupplyChainActor getOwner()
           
 nl.tudelft.simulation.dsol.simulators.SimulatorInterface getSimulator()
           
 nl.tudelft.simulation.event.EventType[] getStatisticEventTypes()
           
 RFQDataSuppliers getSuppliers(java.lang.String productName)
          Method getSuppliers returns the suppliers for the specified product name.
 int getTotalNumberOfDays()
           
 boolean login(nl.tudelft.simulation.event.remote.RemoteEventListenerInterface client)
           
 void notify(nl.tudelft.simulation.event.EventInterface event)
           
 void notifyAnnounced(nl.tudelft.simulation.event.EventInterface event)
          Method notifyAnnounced.
 void publicFireEvent(nl.tudelft.simulation.event.EventInterface event)
          Method publicFireEvent.
 boolean removeListener(nl.tudelft.simulation.event.EventListenerInterface listener, nl.tudelft.simulation.event.EventType eventType)
           
 
Methods inherited from class org.gscg.common.interactionlayer.ThreadedEventProducer
fireEvent
 
Methods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getEventTypes, removeAllListeners, removeAllListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.tudelft.simulation.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypes
 

Field Detail

idMap

protected static java.util.Map idMap
the static list of ids in this game for identification mapping

Constructor Detail

DistributorSingleUserInteractionLayer

public DistributorSingleUserInteractionLayer(nl.tudelft.simulation.dsol.simulators.SimulatorInterface simulator,
                                             java.lang.String id,
                                             nl.tudelft.simulation.supplychain.actor.SupplyChainActor owner,
                                             GameGlobalData globalSupplyChainData)
constructs a new DistributorSingleUserInteractionLayer

Parameters:
simulator - the simulator
id - the id of the single user interaction layer
owner - the owner of the interaction layer
globalSupplyChainData - the global supply chain data
Method Detail

addEventType

public void addEventType(nl.tudelft.simulation.event.EventType eventType)
Description copied from interface: SingleUserInteractionLayerInterface
Method addEventType Before an event is fired by the interaction layer, a check is performed whether the interaction layer should fire the event. The check is based upon a set with events which is filled by invoking this method.

Specified by:
addEventType in interface SingleUserInteractionLayerInterface
Parameters:
eventType - the event type to add
See Also:
SingleUserInteractionLayerInterface.addEventType(nl.tudelft.simulation.event.EventType)

addEventTypeSentByClient

public void addEventTypeSentByClient(nl.tudelft.simulation.event.EventType eventType)
Description copied from interface: GlobalInteractionLayerInterface
Method addEventTypeSentByClient. EventTypes added using this method are fired by a client. Object which are interested in these events subscribe them as listeners to these events. At the same time, when the interaction layer receives one of these events, the event is checked with a list of known events.

Specified by:
addEventTypeSentByClient in interface GlobalInteractionLayerInterface
Parameters:
eventType - the event type to add
See Also:
GlobalInteractionLayerInterface.addEventTypeSentByClient(nl.tudelft.simulation.event.EventType)

addEventTypeToAnnounceList

public void addEventTypeToAnnounceList(nl.tudelft.simulation.event.EventType eventType,
                                       AnnounceInterface announceObject)
Description copied from interface: GlobalInteractionLayerInterface
Method addEventTypeToAnnounceList. Adds an event type and the corresponding announce object to a hashmap.

Specified by:
addEventTypeToAnnounceList in interface GlobalInteractionLayerInterface
Parameters:
eventType - the event type
announceObject - the object to announce
See Also:
GlobalInteractionLayerInterface.addEventTypeToAnnounceList(nl.tudelft.simulation.event.EventType, org.gscg.common.interactionlayer.AnnounceInterface)

addStatisticEventType

public void addStatisticEventType(nl.tudelft.simulation.event.EventType eventType)
Description copied from interface: SingleUserInteractionLayerInterface
Method addStatisticEventType adds an event to a set with event types only used for statistical updates. Upon initialization, a remote game leader graphical user interface asks for this set. EventTypes which are added to this set should follow the following convention ACTORROLE_ + description of eventtype. E.g. CUSTOMER_DEMAND_CHANGED_EVENT.

Specified by:
addStatisticEventType in interface SingleUserInteractionLayerInterface
Parameters:
eventType - the event type to add
See Also:
SingleUserInteractionLayerInterface.addStatisticEventType(nl.tudelft.simulation.event.EventType)

getCache

public void getCache(java.lang.Object remoteEventProducer,
                     nl.tudelft.simulation.event.EventType eventType,
                     boolean cache)
              throws java.rmi.RemoteException
Description copied from interface: GlobalInteractionLayerInterface
this method is used by a remote client to indicate that it is 'online' the server side object is then able to subscribe to client side events and to send cached data

Specified by:
getCache in interface GlobalInteractionLayerInterface
Parameters:
remoteEventProducer - the remote event producer or the remote event listener, may be null
eventType - the event type given as an argument for the announce method, may not be null
cache - true if this method is called during initialization of a client user interface; false in case of announcing for a statistic
Throws:
java.rmi.RemoteException - thrown in case of a network error
See Also:
GlobalInteractionLayerInterface.getCache(java.lang.Object, nl.tudelft.simulation.event.EventType, boolean)

notify

public void notify(nl.tudelft.simulation.event.EventInterface event)
            throws java.rmi.RemoteException
Specified by:
notify in interface nl.tudelft.simulation.event.EventListenerInterface
Throws:
java.rmi.RemoteException
See Also:
EventListenerInterface.notify(nl.tudelft.simulation.event.EventInterface)

notifyAnnounced

public void notifyAnnounced(nl.tudelft.simulation.event.EventInterface event)
Description copied from interface: SingleUserInteractionLayerInterface
Method notifyAnnounced.

Specified by:
notifyAnnounced in interface SingleUserInteractionLayerInterface
Parameters:
event - the event for the announce method
See Also:
SingleUserInteractionLayerInterface.notifyAnnounced(nl.tudelft.simulation.event.EventInterface)

login

public boolean login(nl.tudelft.simulation.event.remote.RemoteEventListenerInterface client)
              throws java.rmi.RemoteException
Specified by:
login in interface GlobalInteractionLayerInterface
Parameters:
client - The client to login
Returns:
Returns returns true if an interactionlayer is already logged in
Throws:
java.rmi.RemoteException - thrown in case of network failure
See Also:
GlobalInteractionLayerInterface.login(nl.tudelft.simulation.event.remote.RemoteEventListenerInterface)

publicFireEvent

public void publicFireEvent(nl.tudelft.simulation.event.EventInterface event)
Method publicFireEvent.

Parameters:
event - the event to fire

fireAllNumberData

public void fireAllNumberData()
Method fireAllNumberData.


removeListener

public boolean removeListener(nl.tudelft.simulation.event.EventListenerInterface listener,
                              nl.tudelft.simulation.event.EventType eventType)
Specified by:
removeListener in interface nl.tudelft.simulation.event.EventProducerInterface
See Also:
EventProducerInterface.removeListener(nl.tudelft.simulation.event.EventListenerInterface, nl.tudelft.simulation.event.EventType)

getContentList

public void getContentList(java.lang.Class contentClass,
                           boolean sent,
                           java.lang.String productName)
                    throws java.rmi.RemoteException
Description copied from interface: RemoteInteractionLayerInterface
Method getContentList. TODO provide java doc examples of the implementation of a call

Specified by:
getContentList in interface RemoteInteractionLayerInterface
Parameters:
contentClass - the class reflecting the content
sent - indicates whether the sent or received messages should be returned as an asynchronous event
productName - the name of the product for which to get the list
Throws:
java.rmi.RemoteException - thrown in case of a network error
See Also:
RemoteInteractionLayerInterface.getContentList(java.lang.Class, boolean, java.lang.String)

getGlobalSupplyChainData

public GameGlobalData getGlobalSupplyChainData()
Specified by:
getGlobalSupplyChainData in interface SingleUserInteractionLayerInterface
Returns:
Returns the globalSupplyChainData.
See Also:
SingleUserInteractionLayerInterface.getGlobalSupplyChainData()

getStatisticEventTypes

public nl.tudelft.simulation.event.EventType[] getStatisticEventTypes()
Specified by:
getStatisticEventTypes in interface GlobalInteractionLayerInterface
Returns:
Returns an array with event types for statistics
See Also:
GlobalInteractionLayerInterface.getStatisticEventTypes()

getSuppliers

public RFQDataSuppliers getSuppliers(java.lang.String productName)
                              throws java.rmi.RemoteException
Description copied from interface: RemoteInteractionLayerInterface
Method getSuppliers returns the suppliers for the specified product name. If the product name does not exist, an empty array is returned.

Specified by:
getSuppliers in interface RemoteInteractionLayerInterface
Parameters:
productName - the product to get the 'empty' RFQ data for
Returns:
an initialized RFQData object with potential suppliers
Throws:
java.rmi.RemoteException - thrown in case of a network error
See Also:
RemoteInteractionLayerInterface.getSuppliers(java.lang.String)

getTotalNumberOfDays

public int getTotalNumberOfDays()
                         throws java.rmi.RemoteException
Specified by:
getTotalNumberOfDays in interface GlobalInteractionLayerInterface
Returns:
Returns an integer representing the total number of days of the simulation. This integer is used for stastistics as a range.
Throws:
java.rmi.RemoteException - thrown in case of network failure
See Also:
GlobalInteractionLayerInterface.getTotalNumberOfDays()

getOwner

public nl.tudelft.simulation.supplychain.actor.SupplyChainActor getOwner()
Specified by:
getOwner in interface SingleUserInteractionLayerInterface
Returns:
Returns the owner.
See Also:
SingleUserInteractionLayerInterface.getOwner()

getSimulator

public nl.tudelft.simulation.dsol.simulators.SimulatorInterface getSimulator()
Specified by:
getSimulator in interface SingleUserInteractionLayerInterface
Returns:
Returns the simulator.
See Also:
SingleUserInteractionLayerInterface.getSimulator()


Copyright © 2002-2005 Delft University of Technology, the Netherlands. All Rights Reserved.