uk.org.ogsadai.client.databrowser
Class DBModel

java.lang.Object
  |
  +--java.util.Observable
        |
        +--uk.org.ogsadai.client.databrowser.DBModel

public class DBModel
extends java.util.Observable

Model for the DBClient application.

Acts as the model in the MVC pattern. It is accessed by controllers, and in turn updates views when its state changes.

In this case the model holds lists of registries and their associated factories, and updates registered observers when these lists change. It also handles the launching of queries, and notifies registered observers of the results of the queries.

Version:
$Revision: 1.10 $
Author:
Paul J Graham, EPCC, The OGSA-DAI project team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  java.util.Vector mDataServices
           
 
Fields inherited from class java.util.Observable
 
Constructor Summary
DBModel()
           
 
Method Summary
 void addDataService(java.lang.String url, DBProgressModel progressModel)
          Adds a data service to the current list
 java.util.Vector getDataResourceIDs()
          Gets the resource IDs for all available data resources.
 java.util.Vector getDataServices()
          Gets the list of currently accessed data services.
 java.util.Vector getDataServiceURLs()
          Gets the URLs for all the currently accessed data services.
 void removeDataService(DBDataService service)
          Removes a data service from the currently accessible list and removes its associated resources.
 void retrieveSchema(DBProgressModel model, DBDataResource service)
          Retrieves the schema from the data resource and informs all observers.
 void runJoin(DBProgressModel pm, DBJoinParameter parameters)
          Runs a join.
 void updateObservers(java.lang.Object obj)
          Updates any Views which have registered themselves as observers of the model
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

mDataServices

private java.util.Vector mDataServices
Constructor Detail

DBModel

public DBModel()
Method Detail

updateObservers

public void updateObservers(java.lang.Object obj)
Updates any Views which have registered themselves as observers of the model

Parameters:
obj - The object passed on to the observers

addDataService

public void addDataService(java.lang.String url,
                           DBProgressModel progressModel)
                    throws java.lang.Exception
Adds a data service to the current list

Parameters:
url - The URL of the data service to be added
progressModel - Follows the progress
Throws:
java.lang.Exception

removeDataService

public void removeDataService(DBDataService service)
Removes a data service from the currently accessible list and removes its associated resources.

Parameters:
service - The data service to remove.

getDataServices

public java.util.Vector getDataServices()
Gets the list of currently accessed data services.

Returns:
Vector of data services. The vector will contain objects of type DBDataService.

getDataServiceURLs

public java.util.Vector getDataServiceURLs()
Gets the URLs for all the currently accessed data services.

Returns:
Vector of URLs. The vector will contain objects of type String.

getDataResourceIDs

public java.util.Vector getDataResourceIDs()
Gets the resource IDs for all available data resources.

Returns:
Vector of resource IDs. The vector will contain objects of type String.

runJoin

public void runJoin(DBProgressModel pm,
                    DBJoinParameter parameters)
             throws java.lang.Exception
Runs a join.

Parameters:
pm - The progress monitor
parameters - The join parameters
Throws:
java.lang.Exception

retrieveSchema

public void retrieveSchema(DBProgressModel model,
                           DBDataResource service)
                    throws java.lang.Exception
Retrieves the schema from the data resource and informs all observers.

Parameters:
model - Progress model (unused)
service - The service and data resource from which to retrieve the database schema.
Throws:
java.lang.Exception - if there was a problem