org.iges.grads.server
Class GradsTool

java.lang.Object
  |
  +--org.iges.anagram.AbstractModule
        |
        +--org.iges.anagram.Tool
              |
              +--org.iges.grads.server.GradsTool
All Implemented Interfaces:
Module

public class GradsTool
extends Tool

GrADS-based implementation of the Anagram framework. This just ties together the various specialized modules in to a single interface. For example, the actual work for routine data and metadata requests is done by the GradsDODSModule.

See Also:
GradsUploadModule, GradsUpdateModule, GradsAnalysisModule, GradsImportModule, GradsDODSModule, GradsTaskModule

Field Summary
protected  GradsAnalysisModule analyzer
           
protected  GradsDODSModule dods
           
protected  GradsImportModule importer
           
protected  GradsTaskModule task
           
protected  GradsUpdateModule updater
           
protected  GradsUploadModule uploader
           
 
Fields inherited from class org.iges.anagram.AbstractModule
log, moduleName, parent, server
 
Constructor Summary
GradsTool()
           
 
Method Summary
 void configure(Setting setting)
          Configures the module according to the settings provided.
 TempDataHandle doAnalysis(java.lang.String name, java.lang.String ae, Privilege privilege)
          Performs an analysis task.
 DataHandle[] doImport(Setting setting)
          Creates usable handles for data objects specified by tags in the configuration file.
 boolean doUpdate(DataHandle data)
          Creates an up-to-date version of the data handle provided.
 TempDataHandle doUpload(java.lang.String name, java.io.InputStream input, long size, Privilege privilege)
          Accepts an uploaded data object.
 DAS getDAS(DataHandle data)
          Provides an object representation of a Data Attribute Structure.
 ServerDDS getDDS(DataHandle data, java.lang.String ce)
          Provides an object representation of a Data Descriptor Structure.
 java.lang.String getModuleID()
          Returns an ID for this module.
 GradsTaskModule getTask()
          Used internally.
 void init(Server server, Module parent)
          Saves references to the server, log module, and parent module, and constructs the complete module name.
 void writeASCIIData(DataHandle data, java.lang.String ce, Privilege privilege, java.io.OutputStream out)
          Writes a data subset to a stream in ASCII format.
 void writeBinaryData(DataHandle data, java.lang.String ce, Privilege privilege, java.io.OutputStream out)
          Writes a data subset to a stream in binary format.
 void writeDAS(DataHandle data, java.io.OutputStream out)
          Writes a Data Attribute Structure to a stream.
 void writeDDS(DataHandle data, java.lang.String ce, java.io.OutputStream out)
          Writes a Data Descriptor Structure to a stream.
 void writeWebInfo(DataHandle data, java.io.OutputStream out)
          Writes a customized summary of the dataset, in the form of an HTML fragment, to the specified stream.
 
Methods inherited from class org.iges.anagram.AbstractModule
configModule, debug, debug, error, fail, fail, fail, getModuleName, info, toString, verbose, verbose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uploader

protected GradsUploadModule uploader

updater

protected GradsUpdateModule updater

analyzer

protected GradsAnalysisModule analyzer

importer

protected GradsImportModule importer

dods

protected GradsDODSModule dods

task

protected GradsTaskModule task
Constructor Detail

GradsTool

public GradsTool()
Method Detail

getModuleID

public java.lang.String getModuleID()
Description copied from interface: Module
Returns an ID for this module. This ID should be a legal XML tag name. It has two uses: as a tag name in the server's configuration file, and as the final element of the complete module name.

Specified by:
getModuleID in interface Module
Specified by:
getModuleID in class AbstractModule

init

public void init(Server server,
                 Module parent)
Description copied from class: AbstractModule
Saves references to the server, log module, and parent module, and constructs the complete module name. Subclasses which override this method should call super.init().

Specified by:
init in interface Module
Overrides:
init in class AbstractModule

configure

public void configure(Setting setting)
               throws ConfigException
Description copied from class: AbstractModule
Configures the module according to the settings provided. The server supports dynamic reconfiguration. Thus this method may be called at any time in the life of the module. If the module cannot be reconfigured, it should throw an exception.

Specified by:
configure in interface Module
Specified by:
configure in class AbstractModule
ConfigException

doImport

public DataHandle[] doImport(Setting setting)
Description copied from class: Tool
Creates usable handles for data objects specified by tags in the configuration file.

If possible, the import method should skip data objects that are already loaded, and whose attributes have not changed.

This method does not need to be threadsafe.

Specified by:
doImport in class Tool
Parameters:
setting - The tag tree specifying the data objects. This will be the tree rooted at the subtag of the tag in the configuration file. The combination of tag names and attributes to be used for specifying data objects is up to the implementor of this method.


doAnalysis

public TempDataHandle doAnalysis(java.lang.String name,
                                 java.lang.String ae,
                                 Privilege privilege)
                          throws ModuleException
Description copied from class: Tool
Performs an analysis task.

If analysis is not supported, this method should throw an exception.

This method must be threadsafe.

Specified by:
doAnalysis in class Tool
Parameters:
ae - The analysis expression to be evaluated
Returns:
A handle to the result(s) of the analysis
Throws:
ModuleException - if the analysis fails for any reason

doUpload

public TempDataHandle doUpload(java.lang.String name,
                               java.io.InputStream input,
                               long size,
                               Privilege privilege)
                        throws ModuleException
Description copied from class: Tool
Accepts an uploaded data object.

If uploads are not supported, this method should throw an exception.

This method must be threadsafe.

Specified by:
doUpload in class Tool
Parameters:
input - The stream of data to be stored
Returns:
Handle(s) to the stored data
Throws:
ModuleException - if the operation fails for any reason

doUpdate

public boolean doUpdate(DataHandle data)
                 throws ModuleException
Creates an up-to-date version of the data handle provided. Returns null if the data handle has not changed. Throws an exception if the data can no longer be accessed.

Specified by:
doUpdate in class Tool
Returns:
True if the data handle was modified.
Throws:
ModuleException - If the data source has become unusable.

getDDS

public ServerDDS getDDS(DataHandle data,
                        java.lang.String ce)
                 throws ModuleException
Provides an object representation of a Data Descriptor Structure.

Specified by:
getDDS in class Tool
Parameters:
data - The data to be accessed
ce - A constraint to be applied to the DDS. Set to null to retrieve an unconstrained DDS.
Returns:
an object representing the DDS
Throws:
ModuleException - if the request fails for any reason
See Also:
Handle.getSynch()

getDAS

public DAS getDAS(DataHandle data)
           throws ModuleException
Provides an object representation of a Data Attribute Structure.

Specified by:
getDAS in class Tool
Parameters:
data - The data to be accessed
Returns:
an object representing the DAS
Throws:
ModuleException - if the request fails for any reason
See Also:
Handle.getSynch()

writeDDS

public void writeDDS(DataHandle data,
                     java.lang.String ce,
                     java.io.OutputStream out)
              throws ModuleException
Writes a Data Descriptor Structure to a stream.

Overrides:
writeDDS in class Tool
Parameters:
data - The data to be accessed
ce - A constraint to be applied to the DDS. Set to null to retrieve an unconstrained DDS.
out - A stream to which to write the DDS
Throws:
ModuleException - if the request fails for any reason
See Also:
Handle.getSynch()

writeDAS

public void writeDAS(DataHandle data,
                     java.io.OutputStream out)
              throws ModuleException
Writes a Data Attribute Structure to a stream.

Overrides:
writeDAS in class Tool
Parameters:
data - The data to be accessed
out - A stream to which to write the DAS
Throws:
ModuleException - if the request fails for any reason
See Also:
Handle.getSynch()

writeWebInfo

public void writeWebInfo(DataHandle data,
                         java.io.OutputStream out)
                  throws ModuleException
Description copied from class: Tool
Writes a customized summary of the dataset, in the form of an HTML fragment, to the specified stream. It is guaranteed that the calling thread will already have a non-exclusive lock on the data parameter before this method is called. Other than that, this method must guarantee its own thread-safety.

Specified by:
writeWebInfo in class Tool
Parameters:
data - The data object to be accessed
out - A stream to which to write the DAS
Throws:
ModuleException - if the request fails for any reason
See Also:
Handle.getSynch()

writeBinaryData

public void writeBinaryData(DataHandle data,
                            java.lang.String ce,
                            Privilege privilege,
                            java.io.OutputStream out)
                     throws ModuleException
Writes a data subset to a stream in binary format.

Specified by:
writeBinaryData in class Tool
Parameters:
data - The data to be accessed
ce - A constraint expression specifying the subset to be sent
out - A stream to which to write the subset
Throws:
ModuleException - if the request fails for any reason
See Also:
Handle.getSynch()

writeASCIIData

public void writeASCIIData(DataHandle data,
                           java.lang.String ce,
                           Privilege privilege,
                           java.io.OutputStream out)
                    throws ModuleException
Writes a data subset to a stream in ASCII format.

Specified by:
writeASCIIData in class Tool
Parameters:
data - The data to be accessed
ce - A constraint expression specifying the subset to be sent
out - A stream to which to write the subset
Throws:
ModuleException - if the request fails for any reason
See Also:
Handle.getSynch()

getTask

public GradsTaskModule getTask()
Used internally. The task module is the module in charge of invoking the GrADS executable.