uk.org.ogsadai.client.toolkit.activity.indexedfiles
Class ReadFile

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.activity.RequestComponent
        |
        +--uk.org.ogsadai.client.toolkit.activity.Activity
              |
              +--uk.org.ogsadai.client.toolkit.activity.indexedfiles.ReadFile

public class ReadFile
extends Activity

This activity reads the contents of an indexed file. Files can either be plain text (in which case the start line and number of lines to be read can be specified) or binary (the default, in which case the start byte and number of bytes to be read can be specified). The file is assumed to be relative to the OGSA-DAI service. The output from the activity can be base64 encoded, if required. The getOutput() method can be used to obtain the data output from the activity. This data output specifies the location of the data that is not stored in the index.


Constructor Summary
ReadFile()
          Create an instance of this activity.
ReadFile(ActivityOutput input)
          Create an instance of this activity.
ReadFile(java.lang.String filename)
          Create an instance of this activity and set name of file to be read.
 
Method Summary
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 java.lang.String getFilename()
          Get name of file to be read.
 long getLength()
          Return number of bytes or lines to be read.
 long getOffset()
          Return index of first byte/line to be read.
 ActivityOutput getOutput()
          Get this activity's only output
 boolean isBase64encoded()
           
 boolean isBinary()
          Get flag indicating if file is a binary file.
 void setBase64encode(boolean base64encode)
          Set whether output should be base64 encoded.
 void setBinary(boolean isBinary)
          Set flag indicating if file is a binary file.
 void setFilename(java.lang.String filename)
          Set name of file to be read.
 void setInput(ActivityOutput input)
          Set activity which provides input to this activity.
 void setLength(long length)
          Set number of bytes or lines to be read.
 void setOffset(long offset)
          Set index of first byte/line to be read.
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
addInput, addOutput, addOutputs, getDataResourceID, getDataServiceStub, getInputParameters, getOutputParameters, getOutputs, replaceSpecialCharacters, setDataResourceID, setDataServiceStub, setInput
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadFile

public ReadFile()
Create an instance of this activity.


ReadFile

public ReadFile(java.lang.String filename)
Create an instance of this activity and set name of file to be read.

Parameters:
filename - - relative path from data service to file.

ReadFile

public ReadFile(ActivityOutput input)
Create an instance of this activity.

Parameters:
input - - activity input stream providing data to this activity.
Method Detail

setFilename

public void setFilename(java.lang.String filename)
Set name of file to be read.

Parameters:
filename - - relative path from data service to file.

getFilename

public java.lang.String getFilename()
Get name of file to be read.

Returns:
filename

setBinary

public void setBinary(boolean isBinary)
Set flag indicating if file is a binary file.

Parameters:
isBinary -

isBinary

public boolean isBinary()
Get flag indicating if file is a binary file.

Returns:
flag

setLength

public void setLength(long length)
Set number of bytes or lines to be read.

Parameters:
length - - number of bytes or lines.
Throws:
java.lang.IllegalArgumentException - if < -1.

getLength

public long getLength()
Return number of bytes or lines to be read.

Returns:
number of bytes or lines.

setOffset

public void setOffset(long offset)
Set index of first byte/line to be read.

Parameters:
offset -

getOffset

public long getOffset()
Return index of first byte/line to be read.

Returns:
offset

isBase64encoded

public boolean isBase64encoded()
Returns:
true if the output will be base64 encoded

setBase64encode

public void setBase64encode(boolean base64encode)
Set whether output should be base64 encoded.

Parameters:
base64encode -

setInput

public void setInput(ActivityOutput input)
Set activity which provides input to this activity.

Parameters:
input -
Throws:
java.lang.IllegalArgumentException - if input is null.

getOutput

public ActivityOutput getOutput()
Get this activity's only output

Returns:
this activity's 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