solar.service.pack.proto
Class BaseProtocol

java.lang.Object
  |
  +--solar.service.pack.proto.BaseProtocol
All Implemented Interfaces:
Protocol
Direct Known Subclasses:
ForwardProtocol, InputProtocol, OutputProtocol

public class BaseProtocol
extends java.lang.Object
implements Protocol

The base class for PACK protocol suit.

Version:
$Id: BaseProtocol.java,v 1.11 2003/10/13 03:13:05 glchen Exp $
Author:
Guanling Chen

Nested Class Summary
(package private)  class BaseProtocol.ProtocolState
           
 
Field Summary
protected  InputBufferManager _inbufman
           
protected static org.apache.log4j.Logger _log
           
protected  OutputBufferManager _outbufman
           
protected  BaseProtocol.ProtocolState _state
           
 
Constructor Summary
BaseProtocol(int bt, int mt, int st)
           
 
Method Summary
 void addPublisher(Id pubId)
          Add a publisher that may put events in this buffer manager.
 void addSubscriber(Id pubId, Id subId, java.lang.Object policy)
          Add a local subscriber that may get events from this manager.
 void addSubscriber(Id pubId, Id subId, java.lang.Object policy, Address from)
          Add a remote subscriber that may get events from this manager.
private  void assertPubRegistered(Id pubId)
           
 Event getEvent()
          Get an event from protocol buffers for processing.
 boolean hasPublisher(Id pubId)
          Whether this manager contains the specified publisher.
 void putEvent(Event evt, Address from)
          Put a received event into protocol buffers.
 void removePublisher(Id pubId)
          Cancel all the buffers for specified publisher.
 void removeSubscriber(Id subId)
          Cancel all the buffers for specified subscriber.
 void resumeSubscriber(java.lang.Object subkey)
          Restart delivering events to specified subscriber.
 void suspendSubscriber(java.lang.Object subkey)
          Stop delivering the event to subscriber, but continue receiving events.
 java.lang.String toString()
          Return the string representation of this protocol.
 void update(ProtocolEvent evt)
          Update the protocol state with control events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_log

protected static org.apache.log4j.Logger _log

_state

protected BaseProtocol.ProtocolState _state

_inbufman

protected InputBufferManager _inbufman

_outbufman

protected OutputBufferManager _outbufman
Constructor Detail

BaseProtocol

public BaseProtocol(int bt,
                    int mt,
                    int st)
Method Detail

addPublisher

public void addPublisher(Id pubId)
Add a publisher that may put events in this buffer manager.


hasPublisher

public boolean hasPublisher(Id pubId)
Whether this manager contains the specified publisher.


addSubscriber

public void addSubscriber(Id pubId,
                          Id subId,
                          java.lang.Object policy)
Add a local subscriber that may get events from this manager.


addSubscriber

public void addSubscriber(Id pubId,
                          Id subId,
                          java.lang.Object policy,
                          Address from)
Add a remote subscriber that may get events from this manager.


removePublisher

public void removePublisher(Id pubId)
Cancel all the buffers for specified publisher.


removeSubscriber

public void removeSubscriber(Id subId)
Cancel all the buffers for specified subscriber.


suspendSubscriber

public void suspendSubscriber(java.lang.Object subkey)
Stop delivering the event to subscriber, but continue receiving events.


resumeSubscriber

public void resumeSubscriber(java.lang.Object subkey)
Restart delivering events to specified subscriber.


toString

public java.lang.String toString()
Return the string representation of this protocol.

Overrides:
toString in class java.lang.Object

putEvent

public void putEvent(Event evt,
                     Address from)
Description copied from interface: Protocol
Put a received event into protocol buffers.

Specified by:
putEvent in interface Protocol

getEvent

public Event getEvent()
               throws java.lang.InterruptedException
Description copied from interface: Protocol
Get an event from protocol buffers for processing.

Specified by:
getEvent in interface Protocol
java.lang.InterruptedException

update

public void update(ProtocolEvent evt)
Description copied from interface: Protocol
Update the protocol state with control events.

Specified by:
update in interface Protocol

assertPubRegistered

private void assertPubRegistered(Id pubId)