net.agmodel.genericBroker
Class GenericBrokerHTTP

java.lang.Object
  |
  +--net.agmodel.genericBroker.ServiceHTTP
        |
        +--net.agmodel.genericBroker.ServerHTTP
              |
              +--net.agmodel.genericBroker.GenericBrokerHTTP
Direct Known Subclasses:
ChizuBrokerHTTP, DEMBrokerHTTP, MetBrokerHTTP

public abstract class GenericBrokerHTTP
extends ServerHTTP

An HTTP servlet wrapper interface to GenericBrokerRMI. The HTTP servlet wrapper is used when direct RMI connnections are blocked by firewalls. Each method below wraps a corresponding GenericBrokerRMI method. Method parameters are serialized and sent using HTTP to a wrapper servlet which calls the corresponding GenericBrokerRMI method and returns the results. int constants are used to identify which GenericBrokerRMI method to call

See Also:
GenericBrokerRMI

Field Summary
static int ALREADYLOGGEDIN
          call GenericBrokerRMI.alreadyLoggedIn(String, String)
static int GETSOURCEDETAIL
          call GenericBrokerRMI.getSourceDetail(String, String)
static int LISTSOURCES
          call GenericBrokerRMI.listSourceDetails(String)
static int LISTSOURCESINREGION
          call GenericBrokerRMI.listSourceDetails(String, GeographicalArea)
static int LOGIN
          call GenericBrokerRMI.loginToDataSource(String, String)
static int LOGINWITHEMAIL
          call GenericBrokerRMI.loginToDataSource(String, String, String)
static int LOGINWITHPASSWORD
          call GenericBrokerRMI.loginToDataSource(String, String, String, String)
static int LOGOUTALLSOURCES
          call GenericBrokerRMI.logOutOfAllSources(String)
static int LOGOUTOFSOURCE
          call GenericBrokerRMI.logOutOfSource(String, String)
 
Fields inherited from class net.agmodel.genericBroker.ServerHTTP
CONNECT, CONNECTUSER, DISCONNECT
 
Fields inherited from class net.agmodel.genericBroker.ServiceHTTP
HOSTPARAMEXTENSION, PORTPARAMEXTENSION, servlet
 
Constructor Summary
GenericBrokerHTTP(String host)
          Create a linking class to communicate with the wrapper servlet on the default HTTP port (80).
GenericBrokerHTTP(String host, int port)
          Create a linking class to communicate with the wrapper servlet on a nominated port.
 
Method Summary
 boolean alreadyLoggedIn(String sessionID, String sourceID)
          Check whether any required connection to the specified database has already been established.
 DataSourceDetail getSourceDetail(String sessionID, String dataSourceID)
          Gets details about a single data source.
 DataSourceDetail[] listSourceDetails(String sessionID)
          Get the details for all the data sources in the broker.
 DataSourceDetail[] listSourceDetails(String sessionID, GeographicalArea ofInterest)
          Get the details of the data sources in the broker that coincide with the area specified.
 boolean loginToDataSource(String sessionID, String sourceID)
          Establish a connection to the specified database without identifying the user in any way
 boolean loginToDataSource(String sessionID, String sourceID, String emailAddress)
          Establish a connection to the specified database using the e-mail address supplied as identification.
 boolean loginToDataSource(String sessionID, String sourceID, String usercode, String password)
          Establish a connection to the specified database using the usercode and password supplied.
 void logOutOfAllSources(String sessionID)
          Log out from any MetSources to which the client is currently logged in.
 void logOutOfSource(String sessionID, String metSourceID)
          Log out from the MetSource identified by the SourceID
 ServerResult supplyData(String sessionID, ServerRequest request, int callID)
          Get the relevant data from a single station.
 
Methods inherited from class net.agmodel.genericBroker.ServerHTTP
disconnect, getConnection, getConnection
 
Methods inherited from class net.agmodel.genericBroker.ServiceHTTP
getServletPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LISTSOURCES

public static final int LISTSOURCES
call GenericBrokerRMI.listSourceDetails(String)

See Also:
Constant Field Values

LISTSOURCESINREGION

public static final int LISTSOURCESINREGION
call GenericBrokerRMI.listSourceDetails(String, GeographicalArea)

See Also:
Constant Field Values

GETSOURCEDETAIL

public static final int GETSOURCEDETAIL
call GenericBrokerRMI.getSourceDetail(String, String)

See Also:
Constant Field Values

ALREADYLOGGEDIN

public static final int ALREADYLOGGEDIN
call GenericBrokerRMI.alreadyLoggedIn(String, String)

See Also:
Constant Field Values

LOGINWITHPASSWORD

public static final int LOGINWITHPASSWORD
call GenericBrokerRMI.loginToDataSource(String, String, String, String)

See Also:
Constant Field Values

LOGINWITHEMAIL

public static final int LOGINWITHEMAIL
call GenericBrokerRMI.loginToDataSource(String, String, String)

See Also:
Constant Field Values

LOGIN

public static final int LOGIN
call GenericBrokerRMI.loginToDataSource(String, String)

See Also:
Constant Field Values

LOGOUTOFSOURCE

public static final int LOGOUTOFSOURCE
call GenericBrokerRMI.logOutOfSource(String, String)

See Also:
Constant Field Values

LOGOUTALLSOURCES

public static final int LOGOUTALLSOURCES
call GenericBrokerRMI.logOutOfAllSources(String)

See Also:
Constant Field Values
Constructor Detail

GenericBrokerHTTP

public GenericBrokerHTTP(String host,
                         int port)
                  throws GeneralException
Create a linking class to communicate with the wrapper servlet on a nominated port. Usually port 80 (default HTTP) or 8080 (Tomcat servlet container default) are used.

Parameters:
host - the web server hosting the wrapper servlet
Throws:
GeneralException

GenericBrokerHTTP

public GenericBrokerHTTP(String host)
                  throws GeneralException
Create a linking class to communicate with the wrapper servlet on the default HTTP port (80).

Parameters:
host - the web server hosting the wrapper servlet
Throws:
GeneralException
Method Detail

listSourceDetails

public DataSourceDetail[] listSourceDetails(String sessionID)
                                     throws GeneralException
Get the details for all the data sources in the broker.

Parameters:
sessionID - the ID returned by getConnection
Returns:
a list of sources
GeneralException

listSourceDetails

public DataSourceDetail[] listSourceDetails(String sessionID,
                                            GeographicalArea ofInterest)
                                     throws GeneralException
Get the details of the data sources in the broker that coincide with the area specified.

Parameters:
sessionID - the ID returned by getConnection
ofInterest - the area from which data is required
Returns:
a list of sources whose GeographicalAreas overlap with the area of Interest. Returns an array of 0 length if no such sources exist.
GeneralException

getSourceDetail

public DataSourceDetail getSourceDetail(String sessionID,
                                        String dataSourceID)
                                 throws GeneralException
Gets details about a single data source.

Parameters:
sessionID - the ID returned by getConnection
Returns:
the database details
Throws:
IllegalArgumentException - if the data source ID is not known
GeneralException

alreadyLoggedIn

public boolean alreadyLoggedIn(String sessionID,
                               String sourceID)
                        throws GeneralException
Check whether any required connection to the specified database has already been established.

Parameters:
sessionID - the ID returned by getConnection
sourceID - the identifier assigned to the source by the broker - see listSourceDetails
Returns:
true if the broker is able to proceed with data access, false if a required connection needs to be established.
GeneralException

loginToDataSource

public boolean loginToDataSource(String sessionID,
                                 String sourceID,
                                 String usercode,
                                 String password)
                          throws GeneralException
Establish a connection to the specified database using the usercode and password supplied.

Parameters:
sessionID - the ID returned by getConnection
sourceID - the identifier assigned to the source by the broker
usercode - a valid usercode on the source
password - the corresponding password (warning - may be transmitted without encryption)
Returns:
true if the broker was able to log in to the source, false otherwise
GeneralException

loginToDataSource

public boolean loginToDataSource(String sessionID,
                                 String sourceID,
                                 String emailAddress)
                          throws GeneralException
Establish a connection to the specified database using the e-mail address supplied as identification.

Parameters:
sessionID - the ID returned by getConnection
sourceID - the identifier assigned to the source by the broker - see listSourceDetails
emailAddress - the user's e-mail address
Returns:
true if the broker was able to log in to the source, false otherwise
GeneralException
See Also:
getSourceDetail(String,String)

loginToDataSource

public boolean loginToDataSource(String sessionID,
                                 String sourceID)
                          throws GeneralException
Establish a connection to the specified database without identifying the user in any way

Parameters:
sessionID - the ID returned by getConnection
sourceID - the identifier assigned to the source by the broker - see listSourceDetails
Returns:
true if the the broker was able to log in to the source, false otherwise
GeneralException
See Also:
getSourceDetail(String,String)

supplyData

public ServerResult supplyData(String sessionID,
                               ServerRequest request,
                               int callID)
                        throws GeneralException
Get the relevant data from a single station.

Parameters:
sessionID - the ID returned by getConnection
request - specifies which station get data for, and what data to get
Returns:
the requested data
GeneralException

logOutOfSource

public void logOutOfSource(String sessionID,
                           String metSourceID)
                    throws GeneralException
Log out from the MetSource identified by the SourceID

Parameters:
sessionID - the ID returned by getConnection
metSourceID - the identifier assigned to the source by MetBroker
GeneralException

logOutOfAllSources

public void logOutOfAllSources(String sessionID)
                        throws GeneralException
Log out from any MetSources to which the client is currently logged in.

Parameters:
sessionID - the ID returned by getConnection
GeneralException