| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.cuny.cat.server.ConnectionAdaptor
public final class ConnectionAdaptor
Each instance of this class is created by ConnectionManager on behalf
 of a game server to deal with requests and responses from/to a game client.
| Field Summary | |
|---|---|
protected  ChargeValidator | 
chargeValidator
 | 
protected  AccountHolder | 
client
 | 
protected  GameClock | 
clock
 | 
protected  ReactiveConnection<CatpMessage> | 
connection
 | 
protected  GameController | 
controller
 | 
protected  edu.cuny.event.EventEngine | 
eventEngine
 | 
protected  boolean | 
failed
for debug only.  | 
protected static org.apache.log4j.Logger | 
logger
 | 
protected  ConnectionManager | 
manager
 | 
protected  java.util.Map<java.lang.String,edu.cuny.cat.server.ConnectionAdaptor.ShoutFromTraderSession> | 
pendingRequestSessions
 | 
protected  org.apache.commons.collections15.Buffer<CatpProactiveSession> | 
proactiveSessions
 | 
protected  CatpReactiveSession[] | 
reactiveSessions
 | 
protected  Registry | 
registry
 | 
protected  ShoutValidator | 
shoutValidator
 | 
protected  int | 
state
 | 
static java.lang.String | 
tag
 | 
protected  TimeoutController | 
timeController
 | 
protected  TransactionValidator | 
transactionValidator
 | 
protected  ValuationPolicy | 
valuer
 | 
| Constructor Summary | |
|---|---|
ConnectionAdaptor(ConnectionManager manager,
                  Connection<CatpMessage> conn)
 | 
|
| Method Summary | |
|---|---|
protected  int | 
calculateState(int newState)
 | 
protected  void | 
clearPendingProactiveSessions()
 | 
protected  void | 
clearPendingRequestSessions()
 | 
protected  void | 
debug(java.lang.String s)
 | 
protected  void | 
dispatchEvent(AuctionEvent event,
              java.util.Collection<java.lang.String> receiverIdColl)
 | 
protected  void | 
dispatchIncomingMessage(CatpMessage msg)
 | 
protected  void | 
dispatchOutgoingMessage(CatpMessage msg,
                        Session<CatpMessage> session)
 | 
 void | 
eventOccurred(AuctionEvent event)
receives notification of control messages from GameView, or messages from somewhere else, i.e.  | 
 AccountHolder | 
getClient()
 | 
 java.lang.String | 
getClientId()
 | 
 ReactiveConnection<CatpMessage> | 
getConnection()
 | 
 int | 
getState()
 | 
 ValuationPolicy | 
getValuer()
 | 
 void | 
handleMessage(CatpMessage msg)
 | 
 boolean | 
isSeller()
 | 
 boolean | 
isSpecialist()
 | 
 boolean | 
isTrader()
 | 
 void | 
messageArrived(CatpMessage msg)
 | 
protected  void | 
processAvailableMarketsAnnounced(AvailableMarketsAnnouncedEvent event)
 | 
protected  void | 
processAvailableTradersAnnounced(AvailableTradersAnnouncedEvent event)
 | 
protected  void | 
processDayClosed(DayClosedEvent event)
 | 
protected  void | 
processDayOpenedEvent(DayOpenedEvent event)
 | 
protected  void | 
processDayOpening(DayOpeningEvent event)
 | 
protected  void | 
processFeesAnnounced(FeesAnnouncedEvent event)
 | 
protected  void | 
processGameOver(GameOverEvent event)
 | 
protected  void | 
processGameStarted(GameStartedEvent event)
 | 
protected  void | 
processGameStarting(GameStartingEvent event)
 | 
protected  void | 
processRegistration(RegistrationEvent event)
 | 
protected  void | 
processRoundClosed(RoundClosedEvent event)
 | 
protected  void | 
processRoundClosing(RoundClosingEvent event)
 | 
protected  void | 
processRoundOpened(RoundOpenedEvent event)
 | 
protected  void | 
processShoutPlaced(ShoutPlacedEvent event)
notifies a trader that its shout is placed.  | 
protected  void | 
processShoutPosted(ShoutPostedEvent event)
This notifies a subscriber of a placed shout.  | 
protected  void | 
processShoutReceived(ShoutReceivedEvent event)
NOTE: this method is used to let a specialist know a shout is received towards it.  | 
protected  void | 
processShoutRejected(ShoutRejectedEvent event)
 | 
protected  void | 
processSimulationOver(SimulationOverEvent event)
 | 
protected  void | 
processSimulationStarted(SimulationStartedEvent event)
 | 
protected  void | 
processSubscription(SubscriptionEvent event)
 | 
protected  void | 
processTransactionExecuted(TransactionExecutedEvent event)
notifieds traders that their shouts are matched in the transaction.  | 
protected  void | 
processTransactionPosted(TransactionPostedEvent event)
notifies subscribers of transactions.  | 
 void | 
setValuer(ValuationPolicy valuer)
 | 
protected  void | 
showReactiveSessions()
 | 
 void | 
timeout(TimableCatpProactiveSession session)
processes timeout event from TimeController on sessions.  | 
 void | 
update(java.util.Observable o,
       java.lang.Object arg)
to observe the results of dispatching events to other clients.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected static org.apache.log4j.Logger logger
protected edu.cuny.event.EventEngine eventEngine
protected ConnectionManager manager
protected GameController controller
protected ReactiveConnection<CatpMessage> connection
protected Registry registry
protected GameClock clock
protected ShoutValidator shoutValidator
protected TransactionValidator transactionValidator
protected ChargeValidator chargeValidator
protected TimeoutController timeController
protected org.apache.commons.collections15.Buffer<CatpProactiveSession> proactiveSessions
protected CatpReactiveSession[] reactiveSessions
protected java.util.Map<java.lang.String,edu.cuny.cat.server.ConnectionAdaptor.ShoutFromTraderSession> pendingRequestSessions
protected AccountHolder client
protected ValuationPolicy valuer
protected int state
public static java.lang.String tag
protected boolean failed
| Constructor Detail | 
|---|
public ConnectionAdaptor(ConnectionManager manager,
                         Connection<CatpMessage> conn)
| Method Detail | 
|---|
public AccountHolder getClient()
public boolean isTrader()
public boolean isSeller()
public boolean isSpecialist()
public void setValuer(ValuationPolicy valuer)
public ValuationPolicy getValuer()
protected void processGameStarting(GameStartingEvent event)
protected void processAvailableTradersAnnounced(AvailableTradersAnnouncedEvent event)
protected void processAvailableMarketsAnnounced(AvailableMarketsAnnouncedEvent event)
protected void processGameStarted(GameStartedEvent event)
protected void processGameOver(GameOverEvent event)
protected void processDayOpening(DayOpeningEvent event)
protected void processDayOpenedEvent(DayOpenedEvent event)
protected void processDayClosed(DayClosedEvent event)
protected void processRoundOpened(RoundOpenedEvent event)
protected void processRoundClosing(RoundClosingEvent event)
protected void processRoundClosed(RoundClosedEvent event)
protected void processRegistration(RegistrationEvent event)
protected void processSubscription(SubscriptionEvent event)
protected void processFeesAnnounced(FeesAnnouncedEvent event)
protected void processShoutPlaced(ShoutPlacedEvent event)
event - protected void processShoutPosted(ShoutPostedEvent event)
event - protected void processShoutReceived(ShoutReceivedEvent event)
protected void processShoutRejected(ShoutRejectedEvent event)
protected void processTransactionExecuted(TransactionExecutedEvent event)
event - protected void processTransactionPosted(TransactionPostedEvent event)
event - protected void processSimulationStarted(SimulationStartedEvent event)
protected void processSimulationOver(SimulationOverEvent event)
public void eventOccurred(AuctionEvent event)
eventOccurred in interface AuctionEventListenerpublic void messageArrived(CatpMessage msg)
messageArrived in interface ConnectionListener<CatpMessage>public void handleMessage(CatpMessage msg)
handleMessage in interface MessageHandler<CatpMessage>
protected void dispatchEvent(AuctionEvent event,
                             java.util.Collection<java.lang.String> receiverIdColl)
protected void dispatchOutgoingMessage(CatpMessage msg,
                                       Session<CatpMessage> session)
protected void dispatchIncomingMessage(CatpMessage msg)
public void timeout(TimableCatpProactiveSession session)
protected int calculateState(int newState)
public int getState()
public java.lang.String getClientId()
public ReactiveConnection<CatpMessage> getConnection()
protected void showReactiveSessions()
protected void clearPendingRequestSessions()
protected void clearPendingProactiveSessions()
public void update(java.util.Observable o,
                   java.lang.Object arg)
update in interface java.util.Observero - arg - the AuctionEvent attempted to dispatchprotected void debug(java.lang.String s)
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||