uk.org.ogsadai.client.toolkit.activity.files
Class DirectoryAccess

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.activity.RequestComponent
        |
        +--uk.org.ogsadai.client.toolkit.activity.Activity
              |
              +--uk.org.ogsadai.client.toolkit.activity.files.DirectoryAccess

public class DirectoryAccess
extends Activity

Lists names of all files and subdirectories in a given directory.

Author:
The OGSA-DAI Team.

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  java.lang.String[] mDirectories
          subdirectories
private  java.lang.String[] mFiles
          file names
private  java.lang.String mPath
          relative path of the directory
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
DirectoryAccess()
          Construct a new activity instance.
DirectoryAccess(java.lang.String path)
          Construct a new activity instance which accesses the given directory.
 
Method Summary
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 java.lang.String[] getFileNames()
          Returns the names of all files in the accessed directory.
 ActivityOutput getOutput()
          Gets the activity's only output.
 java.lang.String getPath()
          Gets the relative path name of the directory that is being accessed.
 java.lang.String[] getSubDirectories()
          Returns the names of all subdirectories of the accessed directory.
private  void parseData()
          Parses the output data and populates the String arrays with directory and file names.
 void setPath(java.lang.String path)
          Set the relative path name of the directory to access.
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
addInput, addOutput, addOutputs, getDataResourceID, getInputParameters, getOutputParameters, getOutputs, replaceSpecialCharacters, setDataResourceID, setInput
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
getDataService, getName, getSession, setDataService, setSession
 
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

mPath

private java.lang.String mPath
relative path of the directory


mDirectories

private java.lang.String[] mDirectories
subdirectories


mFiles

private java.lang.String[] mFiles
file names

Constructor Detail

DirectoryAccess

public DirectoryAccess()
Construct a new activity instance.


DirectoryAccess

public DirectoryAccess(java.lang.String path)
Construct a new activity instance which accesses the given directory.

Parameters:
path - directory to access
Method Detail

setPath

public void setPath(java.lang.String path)
Set the relative path name of the directory to access.

Parameters:
path - relative path

getPath

public java.lang.String getPath()
Gets the relative path name of the directory that is being accessed.

Returns:
directory name

getSubDirectories

public java.lang.String[] getSubDirectories()
                                     throws NoActivityOutputException,
                                            DataFormatException
Returns the names of all subdirectories of the accessed directory.

Returns:
subdirectory names
Throws:
NoActivityOutputException - if there is no output data or the data has not yet been processed to this output or the activity that generates this output has not yet been executed.
DataFormatException - if the output from the activity cannot be parsed

getFileNames

public java.lang.String[] getFileNames()
                                throws NoActivityOutputException,
                                       DataFormatException
Returns the names of all files in the accessed directory.

Returns:
file names
Throws:
NoActivityOutputException - if there is no output data or the data has not yet been processed to this output or the activity that generates this output has not yet been executed.
DataFormatException - if the output from the activity cannot be parsed

getOutput

public ActivityOutput getOutput()
Gets the activity's only output.

Returns:
activity output

generateXML

protected java.lang.String generateXML()
Description copied from class: RequestComponent
Generates the XML representing the activity. This XML can then be inserted into a perform document that is sent to a data service.

Specified by:
generateXML in class Activity
Returns:
the XML for the activity

parseData

private void parseData()
                throws NoActivityOutputException,
                       DataFormatException
Parses the output data and populates the String arrays with directory and file names.

Throws:
NoActivityOutputException - if there is no output data or the data has not yet been processed to this output or the activity that generates this output has not yet been executed.
DataFormatException - if the data cannot be parsed