solar.service.mhost
Class SolarMobileHostService

java.lang.Object
  |
  +--solar.service.BaseService
        |
        +--solar.service.mhost.SolarMobileHostService
All Implemented Interfaces:
EventHandler, MobileHostService, RequestHandler, RpcConstants, Service

public class SolarMobileHostService
extends BaseService
implements MobileHostService, RpcConstants

Solar implementation of mobile host service.

Version:
$Id: SolarMobileHostService.java,v 1.2 2003/10/05 18:50:57 glchen Exp $
Author:
Guanling Chen

Field Summary
protected  java.util.List _attached
           
protected  DispatchService _dispatch
           
protected  java.util.List _listeners
           
protected static org.apache.log4j.Logger _log
          Logging facility.
protected  java.lang.String _mclientName
           
protected  RpcService _rpc
           
protected  boolean _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
SolarMobileHostService()
           
 
Method Summary
 void addListener(MobileHostListener listener)
          Add a listener to client mobililty.
 void attach(Address address)
          Have the client explicitly attch to a Planet.
private  java.lang.Object callRpc(Address address, Request request)
           
 void detach(Address address)
          Have the client explicitly detach from a Planet.
 java.util.List getAttachedClients()
          Get all the clients currently attached to this Planet.
 Address getAttachedServer()
          Get the Planet address to which this client is attached.
 void init()
          Initiate the service, do not try to init dependent services here.
 void initDependents()
          Initialize dependent services here.
 boolean isAttached()
          Detemine whether this client is attched.
 boolean isAttached(Address client)
          Detemine whether the specified client is attched to this Planet.
private  void notifyClientAttached(Address address)
           
private  void notifyClientDetached(Address address)
           
 void removeListener(MobileHostListener listener)
          Remove a listener to client mobililty.
 
Methods inherited from class solar.service.BaseService
assertInited, getDependentService, getName, getServiceManager, handleDispatchUnit, handleEvent, 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.EventHandler
handleEvent
 
Methods inherited from interface solar.api.RequestHandler
handleRequest
 

Field Detail

_log

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


_server

protected boolean _server

_mclientName

protected java.lang.String _mclientName

_transportName

protected java.lang.String _transportName

_transportAddress

protected Address _transportAddress

_rpc

protected RpcService _rpc

_dispatch

protected DispatchService _dispatch

_attached

protected java.util.List _attached

_listeners

protected java.util.List _listeners
Constructor Detail

SolarMobileHostService

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

attach

public void attach(Address address)
            throws MobileHostException
Description copied from interface: MobileHostService
Have the client explicitly attch to a Planet.

Specified by:
attach in interface MobileHostService
MobileHostException

detach

public void detach(Address address)
            throws MobileHostException
Description copied from interface: MobileHostService
Have the client explicitly detach from a Planet.

Specified by:
detach in interface MobileHostService
MobileHostException

isAttached

public boolean isAttached()
Description copied from interface: MobileHostService
Detemine whether this client is attched.

Specified by:
isAttached in interface MobileHostService

isAttached

public boolean isAttached(Address client)
Description copied from interface: MobileHostService
Detemine whether the specified client is attched to this Planet.

Specified by:
isAttached in interface MobileHostService

getAttachedServer

public Address getAttachedServer()
Description copied from interface: MobileHostService
Get the Planet address to which this client is attached.

Specified by:
getAttachedServer in interface MobileHostService

getAttachedClients

public java.util.List getAttachedClients()
Description copied from interface: MobileHostService
Get all the clients currently attached to this Planet.

Specified by:
getAttachedClients in interface MobileHostService

addListener

public void addListener(MobileHostListener listener)
Description copied from interface: MobileHostService
Add a listener to client mobililty.

Specified by:
addListener in interface MobileHostService

removeListener

public void removeListener(MobileHostListener listener)
Description copied from interface: MobileHostService
Remove a listener to client mobililty.

Specified by:
removeListener in interface MobileHostService

callRpc

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

notifyClientAttached

private void notifyClientAttached(Address address)

notifyClientDetached

private void notifyClientDetached(Address address)