solar.service.pack
Class ClientPackService

java.lang.Object
  |
  +--solar.service.BaseService
        |
        +--solar.service.pack.ClientPackService
All Implemented Interfaces:
EventHandler, MobileHostListener, PackConstants, PackService, RequestHandler, RpcConstants, Service

public class ClientPackService
extends BaseService
implements PackService, MobileHostListener, RpcConstants, PackConstants

The PACK service that runs at the client side.

Version:
$Id: ClientPackService.java,v 1.21 2003/10/13 03:13:03 glchen Exp $
Author:
Guanling Chen

Nested Class Summary
(package private)  class ClientPackService.Handler
           
(package private)  class ClientPackService.Sender
           
 
Field Summary
protected  DispatchService _dispatch
           
protected  EndPointManager _epman
           
protected  InputProtocol _inproto
           
protected static org.apache.log4j.Logger _log
          Logging facility.
protected  MobileHostService _mhost
           
protected  OutputProtocol _outproto
           
protected  java.lang.String _packName
           
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
 
Fields inherited from interface solar.service.pack.PackConstants
PACK_ACK, PACK_BUFFER_LIMIT, PACK_EVENT, PACK_FORWARD, PACK_LASTHOP, PACK_MEMORY_LIMIT, PACK_POLICY, PACK_PUBID, PACK_SUBID, PACK_SUSPEND_LIMIT
 
Constructor Summary
ClientPackService()
           
 
Method Summary
private  void assertAttached()
           
 void attachPublisher(Id pubId, Publisher publisher)
          Attach a PACK publisher to the service.
 void attachSubscriber(Id subId, Subscriber subscriber)
          Attach a PACK subscriber to the service.
private  java.lang.Object callRpc(Request request)
           
 void clientAttached(Address address)
          Handler when a client is attached to a Planet.
 void clientDetached(Address address)
          Handler when a client is detached from a Planet.
 void detachPublisher(Id pubId)
          Detach a PACK publisher from the service.
 void detachSubscriber(Id subId)
          Detach a PACK subscriber from the service.
 void handleEvent(Event evt)
          Processing an event.
 void handlePackEvent(PackEvent evt)
           
 void handleSubscribeEvent(SubscribeEvent evt)
           
 void init()
          Initiate the service, do not try to init dependent services here.
 void initDependents()
          Initialize dependent services here.
 Guid makeGuid(Id id)
          Return a global unique ID.
 void publish(Id pubId, Event evt)
          Publish an event to all subscribers.
 void subscribe(Id pubId, Id subId, java.lang.Object policy)
          Make a subscription to a PACK publisher.
 
Methods inherited from class solar.service.BaseService
assertInited, getDependentService, getName, getServiceManager, handleDispatchUnit, handleEvent, handleRequest, 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
 
Methods inherited from interface solar.api.RequestHandler
handleRequest
 

Field Detail

_log

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


_server

protected Address _server

_packName

protected java.lang.String _packName

_transportName

protected java.lang.String _transportName

_transportAddress

protected Address _transportAddress

_rpc

protected RpcService _rpc

_mhost

protected MobileHostService _mhost

_dispatch

protected DispatchService _dispatch

_inproto

protected InputProtocol _inproto

_outproto

protected OutputProtocol _outproto

_epman

protected EndPointManager _epman
Constructor Detail

ClientPackService

public ClientPackService()
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

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

handleSubscribeEvent

public void handleSubscribeEvent(SubscribeEvent evt)
                          throws java.lang.Exception
java.lang.Exception

handlePackEvent

public void handlePackEvent(PackEvent evt)
                     throws java.lang.Exception
java.lang.Exception

attachPublisher

public void attachPublisher(Id pubId,
                            Publisher publisher)
                     throws PackException
Description copied from interface: PackService
Attach a PACK publisher to the service.

Specified by:
attachPublisher in interface PackService
PackException

detachPublisher

public void detachPublisher(Id pubId)
                     throws PackException
Description copied from interface: PackService
Detach a PACK publisher from the service.

Specified by:
detachPublisher in interface PackService
PackException

attachSubscriber

public void attachSubscriber(Id subId,
                             Subscriber subscriber)
                      throws PackException
Description copied from interface: PackService
Attach a PACK subscriber to the service.

Specified by:
attachSubscriber in interface PackService
PackException

detachSubscriber

public void detachSubscriber(Id subId)
                      throws PackException
Description copied from interface: PackService
Detach a PACK subscriber from the service.

Specified by:
detachSubscriber in interface PackService
PackException

subscribe

public void subscribe(Id pubId,
                      Id subId,
                      java.lang.Object policy)
               throws PackException
Description copied from interface: PackService
Make a subscription to a PACK publisher.

Specified by:
subscribe in interface PackService
PackException

publish

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

Specified by:
publish in interface PackService
PackException

makeGuid

public Guid makeGuid(Id id)
Description copied from interface: PackService
Return a global unique ID.

Specified by:
makeGuid in interface PackService

assertAttached

private void assertAttached()
                     throws PackException
PackException

callRpc

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

clientAttached

public void clientAttached(Address address)
Description copied from interface: MobileHostListener
Handler when a client is attached to a Planet.

Specified by:
clientAttached in interface MobileHostListener

clientDetached

public void clientDetached(Address address)
Description copied from interface: MobileHostListener
Handler when a client is detached from a Planet.

Specified by:
clientDetached in interface MobileHostListener