net.agmodel.demBean
Class DEMSpatialRequestBean

java.lang.Object
  |
  +--net.agmodel.utilBean.RequestBean
        |
        +--net.agmodel.demBean.DEMSpatialRequestBean
All Implemented Interfaces:
DataSourceListener, DEMSourceListener, EventListener, MapDisplayListener, Runnable, ServiceBeanListener

public class DEMSpatialRequestBean
extends RequestBean
implements MapDisplayListener, DEMSourceListener, ServiceBeanListener


Field Summary
protected  DEMSourceDetail currentSource
           
protected  GeographicalBox displayRegion
           
protected  ArrayList sourceListeners
           
protected  GeographicalArea targetRegion
           
 
Fields inherited from class net.agmodel.utilBean.RequestBean
brokerHTTP, brokerRMI, dataListeners, indeterminateListeners, loginDialog, parent, rb, retrieveDataThread, sessionID, ub
 
Constructor Summary
DEMSpatialRequestBean(Frame parent)
           
 
Method Summary
 void addDEMSourceListener(DEMSourceListener x)
           
 void addSpatialDataListener(DEMSpatialDataListener x)
           
protected  void clearListeners()
           
protected  void fireSpecificEvent(RequestBeanListener listener, ServerResult result)
           
protected  ServerResult getData(ServerRequest request)
          Implemented by descendant requestBeans to call the broker to get the data.
protected  ServerRequest makeRequest()
          Implemented by descendant requestBeans to create an appropriate request object for this kind of broker.
 void newConnection(ServiceBeanEvent evt)
          Called when a ServerBean establishes a connection to a server
 void newDEMSource(DEMSourceEvent evt)
          If a new source is selected, and the new source covers a different area to the request bean's current request area then tell GeographicalArea listeners to move to the default display area of the new source.
 void newMapDisplay(MapDisplayEvent evt)
           
protected  boolean readyToRequest()
           
protected  void relayDEMSourceEvent(DEMSourceEvent evt)
           
 void removeDEMSourceListener(DEMSourceListener x)
           
 void removeSpatialDataListener(DEMSpatialDataListener x)
           
protected  void setUpBean()
           
protected  boolean suitableLogin(ServerRequest request)
          Implemented by descendant requestBeans to select which login mechanism to use.
 
Methods inherited from class net.agmodel.utilBean.RequestBean
addDataListener, addIndeterminateListener, alreadyLoggedIn, fireDataArrivedEvent, fireDataRequestedEvent, fireIndeterminateEvent, listSourceDetails, login, login, loginToDataSource, removeDataListener, removeIndeterminateListener, run, runRetrieveThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentSource

protected transient DEMSourceDetail currentSource

targetRegion

protected transient GeographicalArea targetRegion

displayRegion

protected transient GeographicalBox displayRegion

sourceListeners

protected transient ArrayList sourceListeners
Constructor Detail

DEMSpatialRequestBean

public DEMSpatialRequestBean(Frame parent)
Method Detail

clearListeners

protected void clearListeners()
Overrides:
clearListeners in class RequestBean

setUpBean

protected void setUpBean()
Overrides:
setUpBean in class RequestBean

relayDEMSourceEvent

protected void relayDEMSourceEvent(DEMSourceEvent evt)

addDEMSourceListener

public void addDEMSourceListener(DEMSourceListener x)

removeDEMSourceListener

public void removeDEMSourceListener(DEMSourceListener x)

newDEMSource

public void newDEMSource(DEMSourceEvent evt)
If a new source is selected, and the new source covers a different area to the request bean's current request area then tell GeographicalArea listeners to move to the default display area of the new source. Otherwise, send a GeographicalAreaEvent for the current request area to signal listeners to reload from the new source.

Specified by:
newDEMSource in interface DEMSourceListener
Parameters:
evt -

newMapDisplay

public void newMapDisplay(MapDisplayEvent evt)
Specified by:
newMapDisplay in interface MapDisplayListener

readyToRequest

protected boolean readyToRequest()
Overrides:
readyToRequest in class RequestBean

fireSpecificEvent

protected void fireSpecificEvent(RequestBeanListener listener,
                                 ServerResult result)
Specified by:
fireSpecificEvent in class RequestBean

addSpatialDataListener

public void addSpatialDataListener(DEMSpatialDataListener x)

removeSpatialDataListener

public void removeSpatialDataListener(DEMSpatialDataListener x)

getData

protected ServerResult getData(ServerRequest request)
                        throws RemoteException,
                               GeneralException
Description copied from class: RequestBean
Implemented by descendant requestBeans to call the broker to get the data.
These beans can use brokerRMI if the connection is RMI, or brokerHTTP if the connection is via HTTP.

Specified by:
getData in class RequestBean
Returns:
a request to be sent to the broker.
RemoteException
GeneralException

suitableLogin

protected boolean suitableLogin(ServerRequest request)
                         throws RemoteException,
                                GeneralException
Description copied from class: RequestBean
Implemented by descendant requestBeans to select which login mechanism to use.
Should either called login(GeographicalArea) or login(String), depending on whether spatial request bean or data source request bean

Specified by:
suitableLogin in class RequestBean
Returns:
true if at least one database is accessible after the logging in process.
RemoteException
GeneralException

makeRequest

protected ServerRequest makeRequest()
Description copied from class: RequestBean
Implemented by descendant requestBeans to create an appropriate request object for this kind of broker.

Specified by:
makeRequest in class RequestBean
Returns:
a request to be sent to the broker.

newConnection

public void newConnection(ServiceBeanEvent evt)
Description copied from interface: ServiceBeanListener
Called when a ServerBean establishes a connection to a server

Specified by:
newConnection in interface ServiceBeanListener
Parameters:
evt - contact details for the server.