uk.org.ogsadai.client.databrowser.commands
Class Command

java.lang.Object
  |
  +--java.util.Observable
        |
        +--uk.org.ogsadai.client.databrowser.commands.Command
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
Direct Known Subclasses:
SQLBagCommand, SQLQueryCommand, SQLResilientCommand, SQLUpdateCommand, XPathQueryCommand, XQueryCommand

public abstract class Command
extends java.util.Observable
implements java.awt.event.ActionListener

Encapulates commands to be sent to the database. Commands are essentially queries or updates.

Author:
OGSA-DAI team

Field Summary
protected  DBQueryController mController
          Controller to use when executing the command.
 
Fields inherited from class java.util.Observable
 
Constructor Summary
Command(DBQueryController controller)
          Constructor
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
abstract  java.lang.Object executeRequest(DBDataResource resource, java.lang.String expression)
          Executes a request to a data resource.
abstract  ResultView getResultView(javax.swing.JFrame parent)
          Gets the view which will display the results of this command.
 void updateObservers(java.lang.Object obj)
          Notifies observers.
 
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

mController

protected DBQueryController mController
Controller to use when executing the command.

Constructor Detail

Command

public Command(DBQueryController controller)
Constructor

Parameters:
controller -
Method Detail

executeRequest

public abstract java.lang.Object executeRequest(DBDataResource resource,
                                                java.lang.String expression)
                                         throws java.lang.Exception
Executes a request to a data resource.

Parameters:
resource - The data resource to which to send the request.
expression - The query expression to send.
Returns:
A object whose actual type is dependent on the type of command.
Throws:
java.lang.Exception - If a problem is encountered when executing the request.

getResultView

public abstract ResultView getResultView(javax.swing.JFrame parent)
Gets the view which will display the results of this command.

Parameters:
parent - The parent frame.
Returns:
The view which will display the command's results.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

updateObservers

public void updateObservers(java.lang.Object obj)
Notifies observers.

Parameters:
obj -