solar.service.pubsub
Class ClientPubSubService

java.lang.Object
  |
  +--solar.service.BaseService
        |
        +--solar.service.pubsub.ClientPubSubService
All Implemented Interfaces:
EventHandler, PubSubService, RequestHandler, RpcConstants, Service

public class ClientPubSubService
extends BaseService
implements PubSubService, RpcConstants

The PACK service that runs at the client side.

Version:
$Id: ClientPubSubService.java,v 1.5 2003/10/05 19:42:45 glchen Exp $
Author:
Guanling Chen

Field Summary
protected  DispatchService _dispatch
           
protected  EndPointManager _epman
           
protected static org.apache.log4j.Logger _log
          Logging facility.
protected  java.lang.String _pubsubName
           
protected  RpcService _rpc
           
protected  Address _server
           
protected  Address _transportAddress
           
protected  java.lang.String _transportName
           
 
Fields inherited from class solar.service.BaseService
_inited, _manager, _name
 
Fields inherited from interface solar.service.rpc.RpcConstants
RPC_BLOCK, RPC_HANDLER, RPC_REPLY, RPC_REQUEST, RPC_TIMEOUT
 
Constructor Summary
ClientPubSubService()
           
 
Method Summary
 void addPublisher(Id pubId, Publisher publisher)
          Register a publisher with the service.
 void addSubscriber(Id subId, Subscriber subscriber)
          Register a subscriber with the service.
private  void assertNotRegistered(Id id)
           
private  void assertRegistered(Id id)
           
private  java.lang.Object callRpc(Request request)
           
 void handleEvent(Event evt)
          Processing an event.
 java.lang.Object handleRequest(Request request)
          Processing a request.
 void init()
          Initiate the service, do not try to init dependent services here.
 void initDependents()
          Initialize dependent services here.
private  Guid makeGuid(Id id)
           
 void publish(Id pubId, Event evt)
          Publish an event to all subscribers.
 void subscribe(Id pubId, Id subId, java.lang.Object extra)
          Make a subscription to a publisher.
 
Methods inherited from class solar.service.BaseService
assertInited, getDependentService, getName, getServiceManager, handleDispatchUnit, handleEvent, hasInited, init, setInited, setName, setServiceManager, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface solar.service.Service
getName, getServiceManager, handleDispatchUnit, hasInited, setName, setServiceManager, start, stop
 

Field Detail

_log

protected static org.apache.log4j.Logger _log
Logging facility.


_server

protected Address _server

_pubsubName

protected java.lang.String _pubsubName

_transportName

protected java.lang.String _transportName

_transportAddress

protected Address _transportAddress

_rpc

protected RpcService _rpc

_dispatch

protected DispatchService _dispatch

_epman

protected EndPointManager _epman
Constructor Detail

ClientPubSubService

public ClientPubSubService()
Method Detail

init

public void init()
          throws ServiceException
Description copied from interface: Service
Initiate the service, do not try to init dependent services here.

Specified by:
init in interface Service
Overrides:
init in class BaseService
ServiceException

initDependents

public void initDependents()
                    throws ServiceException
Description copied from interface: Service
Initialize dependent services here.

Specified by:
initDependents in interface Service
Overrides:
initDependents in class BaseService
ServiceException

handleRequest

public java.lang.Object handleRequest(Request request)
                               throws java.lang.Exception
Description copied from interface: RequestHandler
Processing a request.

Specified by:
handleRequest in interface RequestHandler
Overrides:
handleRequest in class BaseService
java.lang.Exception

handleEvent

public void handleEvent(Event evt)
                 throws java.lang.Exception
Description copied from interface: EventHandler
Processing an event.

Specified by:
handleEvent in interface EventHandler
Overrides:
handleEvent in class BaseService
java.lang.Exception

addPublisher

public void addPublisher(Id pubId,
                         Publisher publisher)
                  throws PubSubException
Description copied from interface: PubSubService
Register a publisher with the service.

Specified by:
addPublisher in interface PubSubService
PubSubException

addSubscriber

public void addSubscriber(Id subId,
                          Subscriber subscriber)
                   throws PubSubException
Description copied from interface: PubSubService
Register a subscriber with the service.

Specified by:
addSubscriber in interface PubSubService
PubSubException

subscribe

public void subscribe(Id pubId,
                      Id subId,
                      java.lang.Object extra)
               throws PubSubException
Description copied from interface: PubSubService
Make a subscription to a publisher.

Specified by:
subscribe in interface PubSubService
PubSubException

publish

public void publish(Id pubId,
                    Event evt)
             throws PubSubException
Description copied from interface: PubSubService
Publish an event to all subscribers.

Specified by:
publish in interface PubSubService
PubSubException

makeGuid

private Guid makeGuid(Id id)

assertRegistered

private void assertRegistered(Id id)
                       throws PubSubException
PubSubException

assertNotRegistered

private void assertNotRegistered(Id id)
                          throws PubSubException
PubSubException

callRpc

private java.lang.Object callRpc(Request request)
                          throws RpcException
RpcException