solar.service.dispatch
Class SolarDispatchService

java.lang.Object
  |
  +--solar.service.BaseService
        |
        +--solar.service.dispatch.SolarDispatchService
All Implemented Interfaces:
DispatchService, EventHandler, RequestHandler, java.lang.Runnable, Service

public class SolarDispatchService
extends BaseService
implements DispatchService, java.lang.Runnable

An event disptaching service for Solar. This dispatch service requires a transport service.

Version:
$Id: SolarDispatchService.java,v 1.19 2003/10/05 18:50:56 glchen Exp $
Author:
Guanling Chen

Nested Class Summary
(package private)  class SolarDispatchService.NetListener
           
 
Field Summary
protected static org.apache.log4j.Logger _log
          Logging facility.
protected  ServiceManager _manager
          Service manager.
protected  Queue _queue
          Inbound event queue.
protected  java.util.Hashtable _transports
          A table of transport services.
 
Fields inherited from class solar.service.BaseService
_inited, _name
 
Constructor Summary
SolarDispatchService()
           
 
Method Summary
 void dispatchEvent(Event evt, Address dest, java.lang.String service, java.lang.String transport)
          Dispatch an event to specified destination using a transport service.
 Address getTransportAddress(java.lang.String name)
          Return local address of a transport service with specified name.
 TransportService getTransportService(java.lang.String name)
          Return a transport service with specified name.
 void handleDispatchUnit(DispatchUnit dunit)
          Handle the data unit delivered by dispatch service.
 java.lang.Object handleRequest(Request req)
          Processing a request.
 void initDependents()
          Initialize dependent services here.
 void run()
           
 
Methods inherited from class solar.service.BaseService
assertInited, getDependentService, getName, getServiceManager, handleEvent, handleEvent, hasInited, init, 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, hasInited, init, setName, setServiceManager, start, stop
 
Methods inherited from interface solar.api.EventHandler
handleEvent
 

Field Detail

_log

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


_manager

protected ServiceManager _manager
Service manager.


_transports

protected java.util.Hashtable _transports
A table of transport services.


_queue

protected Queue _queue
Inbound event queue.

Constructor Detail

SolarDispatchService

public SolarDispatchService()
Method Detail

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

handleDispatchUnit

public void handleDispatchUnit(DispatchUnit dunit)
                        throws java.lang.Exception
Description copied from interface: Service
Handle the data unit delivered by dispatch service.

Specified by:
handleDispatchUnit in interface Service
Overrides:
handleDispatchUnit in class BaseService
java.lang.Exception

handleRequest

public java.lang.Object handleRequest(Request req)
                               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

getTransportService

public TransportService getTransportService(java.lang.String name)
Description copied from interface: DispatchService
Return a transport service with specified name.

Specified by:
getTransportService in interface DispatchService

getTransportAddress

public Address getTransportAddress(java.lang.String name)
Description copied from interface: DispatchService
Return local address of a transport service with specified name.

Specified by:
getTransportAddress in interface DispatchService

dispatchEvent

public void dispatchEvent(Event evt,
                          Address dest,
                          java.lang.String service,
                          java.lang.String transport)
                   throws java.lang.Exception
Description copied from interface: DispatchService
Dispatch an event to specified destination using a transport service.

Specified by:
dispatchEvent in interface DispatchService
java.lang.Exception

run

public void run()
Specified by:
run in interface java.lang.Runnable