|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--uk.org.ogsadai.client.toolkit.activity.RequestComponent
|
+--uk.org.ogsadai.client.toolkit.activity.Activity
|
+--uk.org.ogsadai.client.toolkit.activity.files.FileWriting
An OGSA-DAI file writing activity. This class is the superclass of
all client toolkit activities which provide an interface to the
fileWritingActivity activity.
The activity has one optional input - the output of another
activity providing any data to insert, append or replace existing
data. This can be specified using the setInput
method. The activity has one output - a dummy value representing
success.
| Field Summary | |
static int |
APPEND
Indicates an append action. |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement |
static int |
DELETE
Indicates a delete action. |
static int |
END
An offset denoting the end of the file or a file. |
static int |
INSERT
Indicates an insert action. |
protected int |
mAction
The particular kind of file writing that will take place. |
protected java.lang.String |
mFilename
The relative path to the file to be modified. |
protected int |
mLength
The number of bytes length over which the modification occurs. |
protected java.lang.String |
mMatch
An expression of the instances of matches of the regular expression to deal with. |
protected int |
mOffset
The number of bytes offset from which the modification occur. |
protected boolean |
mPerLine
Indicates whether the action will be performed on a per-line or per-file basis. |
protected java.lang.String |
mRegexp
The regular expression to use to locate the part of the file to modify. |
protected java.lang.String |
mText
Text to insert, append or replace existing text. |
static int |
NONE_SPECIFIED
A value denoting the uninitialised nature of the length or offset. |
static boolean |
PER_FILE
Denotes that the action should be applied once on the whole file. |
static boolean |
PER_LINE
Denotes that the action should be applied on each line. |
static int |
REPLACE
Indicates a replacement action. |
static int |
START
An offset denoting the beginning of the file or a line. |
static int |
TO_END
Denotes the remaining length to the end of the file or line. |
| Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity |
|
| Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent |
|
| Constructor Summary | |
FileWriting()
Default constructor. |
|
| Method Summary | |
static java.lang.String |
actionToString(int action)
Return a textual description of a given action type. |
protected java.lang.String |
generateXML()
Generates the XML representing the activity. |
java.lang.String |
getFilename()
Gets the relative path to the file to be modified. |
int |
getLength()
Gets the length to use. |
java.lang.String |
getMatch()
Gets the match expression, if any. |
int |
getOffset()
Gets the offset to use. |
java.lang.String |
getRegexp()
Gets the regular expression to be used, if any. |
java.lang.String |
getText()
Gets the text to insert/append or replace. |
boolean |
isPerLine()
Gets whether the action is to be performed on a per-line or per-file basis. |
static java.lang.String |
lengthToString(int length)
Convert an integer representation of a length into an equivalent string, also taking care to convert the special value TO_END into the string "toEnd". |
static java.lang.String |
offsetToString(int offset)
Convert an integer representation of an offset into an equivalent string, also taking care to convert special values START and END into corresponding
strings. |
void |
setFilename(java.lang.String filename)
Sets the relative path to the file to be modified. |
void |
setInput(ActivityOutput input)
Sets the input of this activity to be the output from another activity that will provide the data to be appended/inserted or to replace existing data. |
void |
setLength(int length)
Sets the length to use. |
void |
setMatch(java.lang.String match)
Sets the match expression. |
void |
setOffset(int offset)
Sets the offset to use. |
void |
setPerLine(boolean perLine)
Sets whether the action is to be performed on a per-line or per-file basis. |
void |
setRegexp(java.lang.String regexp)
Set the regular expression to be used. |
void |
setText(java.lang.String text)
Sets the text to insert/append or replace. |
protected void |
validateParams()
Test the current parameters to check that they are within acceptable bounds. |
| 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 |
private static final java.lang.String COPYRIGHT_NOTICE
public static final int REPLACE
public static final int DELETE
public static final int APPEND
public static final int INSERT
public static final int NONE_SPECIFIED
public static final int START
public static final int END
public static final int TO_END
public static final boolean PER_LINE
public static final boolean PER_FILE
protected int mAction
REPLACE, DELETE, APPEND,
or INSERT.
protected java.lang.String mFilename
protected java.lang.String mRegexp
protected java.lang.String mMatch
protected int mOffset
protected int mLength
protected java.lang.String mText
protected boolean mPerLine
true, it is performed on a
per-line basis, meaning that the offset and length will be
treated as per-line offsets, and the regular expression
match expression will be interpreted on a per-line
basis. The special values START, END
and TO_END take on meanings relevant to either
files or lines.
| Constructor Detail |
public FileWriting()
| Method Detail |
protected void validateParams()
java.lang.IllegalArgumentException - If the filename is null, the offset is
< 0 or does not equal START, END or
NONE_SPECIFIED, or the length is < 0 or does
not equal TO_END or
NONE_SPECIFIED.public void setInput(ActivityOutput input)
input - Output from another activity.
java.lang.IllegalArgumentException - If input is null.protected java.lang.String generateXML()
RequestComponent
generateXML in class Activitypublic static java.lang.String offsetToString(int offset)
START and END into corresponding
strings.
offset - The integer to convert.
public static java.lang.String lengthToString(int length)
TO_END into the string "toEnd".
length - The integer to convert.
public static java.lang.String actionToString(int action)
action - An action type - one of REPLACE,
DELETE, APPEND,
INSERT.
"unknownAction"
if the supplied parameter is not recognisedpublic java.lang.String getFilename()
public void setFilename(java.lang.String filename)
filename - The filenamepublic java.lang.String getMatch()
nullpublic void setMatch(java.lang.String match)
match - The match expressionpublic boolean isPerLine()
true if the action is to be performed
per-line, false if the action is to be performed
per-file.public void setPerLine(boolean perLine)
perLine - true if the action is to be performed
per-line, false if the action is to be
performed per-file.public java.lang.String getRegexp()
nullpublic void setRegexp(java.lang.String regexp)
regexp - The regular expressionpublic java.lang.String getText()
nullpublic void setText(java.lang.String text)
text - The textpublic int getLength()
TO_END; or
NONE_SPECIFIED.public void setLength(int length)
length - The length
java.lang.IllegalArgumentException - If length is < 0 or does not equal
TO_END or NONE_SPECIFIED.public int getOffset()
END;
STARTpublic void setOffset(int offset)
offset - The offset.
java.lang.IllegalArgumentException - If offset is < 0 or does not equal
START, END or
NONE_SPECIFIED.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||