net.agmodel.brokerImpl
Class GenericBrokerImpl

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended bynet.agmodel.brokerImpl.GenericBrokerImpl
All Implemented Interfaces:
GenericBrokerRMI, Remote, Serializable, ServerRMI
Direct Known Subclasses:
MetBrokerImpl

public abstract class GenericBrokerImpl
extends UnicastRemoteObject
implements GenericBrokerRMI

An generic broker implementation which maintains a list of the user's active connections

Version:
1.0
Author:
Matthew Laurenson
See Also:
Serialized Form

Nested Class Summary
 class GenericBrokerImpl.DBCheckAndUpdate
           
 
Field Summary
 
Fields inherited from interface net.agmodel.genericBroker.GenericBrokerRMI
EMAIL, HOSTPARAMEXTENSION, NOLOGIN, PASSWORD
 
Fields inherited from interface net.agmodel.genericBroker.ServerRMI
EXISTINGUSER, NEWUSER, SUPERUSER
 
Constructor Summary
GenericBrokerImpl()
           
 
Method Summary
 boolean alreadyLoggedIn(String sessionID, String sourceID)
          Check whether any required connection to the specified database has already been established.
 void cleanup()
           
 void DBMonitor()
           
 void disconnect(String sessionName)
          Deletes the session for this client.
 void enter(String methodname, String sessionName)
          Print Method entry info if tracing
 void exit(String methodname, String sessionName)
          Print Method exiting info if tracing
 DBAccessMechanism getAccess(String sessionID, String sourceID)
           
 String getConnection(String clientInfo, String language)
          Establishes a session for the client application.
 String getConnection(String clientInfo, String language, String brokerUser, String brokerPassword, int userType)
          Establishes a session for the client application.
 String getLanguage(String sessionID)
           
 DataSourceDetail getSourceDetail(String sessionID, String sourceID)
          Gets details about a single data source.
 GeographicalArea getSourceGeographicalArea(String sessionID, String sourceID)
           
 String getSourceID(String sessionID, String language, String sourceName)
          Get the ID of a data source using its name in a particular language.
 GenericSourceImpl getSourceImplAndRecordUse(String sourceID, String sessionID)
           
 int getSourceLoginRequirements(String sessionID, String sourceID)
           
 String getSourceName(String sessionID, String sourceID)
           
 String[] listDataSources(String sessionID)
           
 String[] listDataSources(String sessionID, GeographicalArea ofInterest)
           
 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 logMessage(String message)
           
 void logOutOfAllSources(String sessionID)
          Log out from any data sources to which the client is currently logged in.
 void logOutOfSource(String sessionID, String sourceID)
          Log out from the data source identified by the sourceID
 void setDBNames(String resServerRMIHost, String resServerHTTPHost, int resServerHTTPport, String filesetID)
          Loads names for the data sources from ResourceServer
 void shutdown(String clientinfo)
          Terminates all the client sessions.
 void start()
          start or restart Timer if the Task is null,creat the Task and set the Timer, keep status before and put the object to Task
 void stop()
          Stop the Timer
static void wait10()
           
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GenericBrokerImpl

public GenericBrokerImpl()
                  throws RemoteException
Method Detail

setDBNames

public void setDBNames(String resServerRMIHost,
                       String resServerHTTPHost,
                       int resServerHTTPport,
                       String filesetID)
Loads names for the data sources from ResourceServer

Parameters:
resServerRMIHost - the address of the ResourceServer host
resServerHTTPHost - the address of a wrapper servlet (Not used yet)
resServerHTTPport - the port on which the wrapper servlet is listening (Not used yet)
filesetID - the ResourceServer fileset in which to search for the databaseIDs.

getAccess

public DBAccessMechanism getAccess(String sessionID,
                                   String sourceID)

DBMonitor

public void DBMonitor()

start

public void start()
start or restart Timer if the Task is null,creat the Task and set the Timer, keep status before and put the object to Task


stop

public void stop()
Stop the Timer


wait10

public static void wait10()

enter

public void enter(String methodname,
                  String sessionName)
Print Method entry info if tracing


exit

public void exit(String methodname,
                 String sessionName)
Print Method exiting info if tracing


listSourceDetails

public DataSourceDetail[] listSourceDetails(String sessionID)
                                     throws RemoteException,
                                            GeneralException
Description copied from interface: GenericBrokerRMI
Get the details for all the data sources in the broker.

Specified by:
listSourceDetails in interface GenericBrokerRMI
Parameters:
sessionID - the ID returned by getConnection
Returns:
a list of sources
Throws:
RemoteException
GeneralException

listSourceDetails

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

Specified by:
listSourceDetails in interface GenericBrokerRMI
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
Throws:
RemoteException
GeneralException

getSourceID

public String getSourceID(String sessionID,
                          String language,
                          String sourceName)
                   throws RemoteException,
                          GeneralException
Description copied from interface: GenericBrokerRMI
Get the ID of a data source using its name in a particular language. This ID is not intended for presentation to users - use getName instead.

Specified by:
getSourceID in interface GenericBrokerRMI
Parameters:
sessionID - the ID returned by getConnection
sourceName - the name of the source (in the language specified)
language - the language of the name using ISO standard language codes
Returns:
the ID of the requested source, or null if it cannot be located
Throws:
RemoteException
GeneralException

listDataSources

public String[] listDataSources(String sessionID)
                         throws RemoteException,
                                GeneralException
Throws:
RemoteException
GeneralException

listDataSources

public String[] listDataSources(String sessionID,
                                GeographicalArea ofInterest)
                         throws RemoteException,
                                GeneralException
Throws:
RemoteException
GeneralException

loginToDataSource

public boolean loginToDataSource(String sessionID,
                                 String sourceID,
                                 String usercode,
                                 String password)
                          throws RemoteException,
                                 GeneralException
Description copied from interface: GenericBrokerRMI
Establish a connection to the specified database using the usercode and password supplied

Specified by:
loginToDataSource in interface GenericBrokerRMI
Parameters:
sessionID - the ID returned by getConnection
sourceID - the identifier assigned to the source by the broker - see listSourceDetails
usercode - a valid usercode on the source
password - the corresponding password (warning - may be transmitted without encryption)
Returns:
true if the the broker was able to log in to the source, false otherwise
Throws:
RemoteException
GeneralException
See Also:
GenericBrokerRMI.getSourceDetail(String,String)

loginToDataSource

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

Specified by:
loginToDataSource in interface GenericBrokerRMI
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
Throws:
RemoteException
GeneralException
See Also:
GenericBrokerRMI.getSourceDetail(String,String)

loginToDataSource

public boolean loginToDataSource(String sessionID,
                                 String sourceID)
                          throws RemoteException,
                                 GeneralException
Description copied from interface: GenericBrokerRMI
Establish a connection to the specified database without identifying the user in any way

Specified by:
loginToDataSource in interface GenericBrokerRMI
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
Throws:
RemoteException
GeneralException
See Also:
GenericBrokerRMI.getSourceDetail(String,String)

alreadyLoggedIn

public boolean alreadyLoggedIn(String sessionID,
                               String sourceID)
                        throws RemoteException
Description copied from interface: GenericBrokerRMI
Check whether any required connection to the specified database has already been established.

Specified by:
alreadyLoggedIn in interface GenericBrokerRMI
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.
Throws:
RemoteException

logOutOfSource

public void logOutOfSource(String sessionID,
                           String sourceID)
                    throws RemoteException
Description copied from interface: GenericBrokerRMI
Log out from the data source identified by the sourceID

Specified by:
logOutOfSource in interface GenericBrokerRMI
Parameters:
sessionID - the ID returned by getConnection
sourceID - the identifier assigned to the source by the broker
Throws:
RemoteException

logOutOfAllSources

public void logOutOfAllSources(String sessionID)
                        throws RemoteException
Description copied from interface: GenericBrokerRMI
Log out from any data sources to which the client is currently logged in.

Specified by:
logOutOfAllSources in interface GenericBrokerRMI
Parameters:
sessionID - the ID returned by getConnection
Throws:
RemoteException

getSourceImplAndRecordUse

public GenericSourceImpl getSourceImplAndRecordUse(String sourceID,
                                                   String sessionID)

getSourceDetail

public DataSourceDetail getSourceDetail(String sessionID,
                                        String sourceID)
                                 throws RemoteException
Description copied from interface: GenericBrokerRMI
Gets details about a single data source.

Specified by:
getSourceDetail in interface GenericBrokerRMI
Parameters:
sessionID - the ID returned by getConnection
Returns:
the database details
Throws:
RemoteException

getSourceName

public String getSourceName(String sessionID,
                            String sourceID)
                     throws RemoteException
Throws:
RemoteException

getSourceGeographicalArea

public GeographicalArea getSourceGeographicalArea(String sessionID,
                                                  String sourceID)
                                           throws RemoteException
Throws:
RemoteException

getSourceLoginRequirements

public int getSourceLoginRequirements(String sessionID,
                                      String sourceID)
                               throws RemoteException
Throws:
RemoteException

getLanguage

public String getLanguage(String sessionID)

getConnection

public String getConnection(String clientInfo,
                            String language)
                     throws RemoteException,
                            GeneralException
Description copied from interface: ServerRMI
Establishes a session for the client application.

Specified by:
getConnection in interface ServerRMI
Parameters:
clientInfo - the client application name (useful for debugging)
language - the language to use for the session (eg for station names)
Returns:
a sessionID.
Throws:
RemoteException
GeneralException

getConnection

public String getConnection(String clientInfo,
                            String language,
                            String brokerUser,
                            String brokerPassword,
                            int userType)
                     throws RemoteException
Description copied from interface: ServerRMI
Establishes a session for the client application.

Specified by:
getConnection in interface ServerRMI
Parameters:
clientInfo - the client application name (useful for debugging)
language - the language to use for the session (eg for station names)
brokerUser - the username for the broker
brokerPassword - the password for the broker
userType - a constant indicating the kind of user (eg NEWUSER or EXISTINGUSER)
Returns:
a sessionID.
Throws:
RemoteException

disconnect

public void disconnect(String sessionName)
                throws RemoteException
Deletes the session for this client.

Specified by:
disconnect in interface ServerRMI
Parameters:
sessionName - the ID returned by getConnection
Throws:
RemoteException

logMessage

public void logMessage(String message)

shutdown

public void shutdown(String clientinfo)
              throws RemoteException
Terminates all the client sessions.

Throws:
RemoteException

cleanup

public void cleanup()


Copyright (C) NARC 2001 All Rights Reserved.