uk.org.ogsadai.activity.files
Class FileManipulationActivity

java.lang.Object
  |
  +--uk.org.ogsadai.activity.Activity
        |
        +--uk.org.ogsadai.activity.files.AbstractFileActivity
              |
              +--uk.org.ogsadai.activity.files.FileManipulationActivity

public class FileManipulationActivity
extends AbstractFileActivity

An activity which provides the means by which to move, copy, create and delete files from a files data service resource. For information on this activity see the OGSA-DAI user doc: OGSA-DAI/doc/interaction/activities/files/fileManipulationActivity.html

Author:
The OGSA-DAI Team

Field Summary
static int COPY
          Indicates an action to copy a file.
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
static int CREATE
          Indicates an action to create a new file.
static int DELETE
          Indicates an action to delete a file.
private static DAILogger LOG
          Logger object for logging in this class
private  java.lang.String mDestination
          Represents the second operand for binary operations (copy and move).
private  java.io.File mDestinationFile
          The File object for mDestination.
private  BlockWriter mOutput
          Activity output - a dummy which outputs "1" to indicate completion.
static int MOVE
          Indicates an action to move a file.
private  java.lang.String mSource
          Represents the first operand for binary operations (copy and move) and the file to act upon for unary operations (create and delete).
private  java.io.File mSourceFile
          The File object for mSource.
private  int mType
          The action to be performed.
private  java.lang.String mTypeName
          Name of action to be performed
static int NONE
          Indicates lack of declaration about which action to perform.
 
Fields inherited from class uk.org.ogsadai.activity.files.AbstractFileActivity
mCredentials, mFileAccessProvider, mTopDir
 
Fields inherited from class uk.org.ogsadai.activity.Activity
mContext, mExternalInputs, mExternalOutputs, mInternalInputs, mInternalOutputs
 
Constructor Summary
FileManipulationActivity(org.w3c.dom.Element element)
           
 
Method Summary
private  void copy()
          Copy a file, bytewise, from a source file, creating the destination file if necessary.
private  void create()
          Create a file.
private  void delete()
          Delete a file.
 void initialise()
          Gets the data resource accessor for the files data resource according to whether the users credentials permit this access.
private  void move()
          Move a file, bytewise, from a source file, creating the destination file if necessary.
 void processBlock()
          Performs an iteration of the processing of an activity.
 java.lang.String toString()
          Return a string representation of the action to be performed.
 
Methods inherited from class uk.org.ogsadai.activity.Activity
cleanUp, connectsTo, createOutputPipe, getActivityConfiguration, getActivityName, getCause, getName, getObservableStatus, getProperties, getSession, getStatus, hasActivityConfiguration, hasProperties, process, processFirst, setActivityName, setCompleted, setError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

LOG

private static final DAILogger LOG
Logger object for logging in this class


NONE

public static final int NONE
Indicates lack of declaration about which action to perform.

See Also:
Constant Field Values

MOVE

public static final int MOVE
Indicates an action to move a file.

See Also:
Constant Field Values

COPY

public static final int COPY
Indicates an action to copy a file.

See Also:
Constant Field Values

CREATE

public static final int CREATE
Indicates an action to create a new file.

See Also:
Constant Field Values

DELETE

public static final int DELETE
Indicates an action to delete a file.

See Also:
Constant Field Values

mType

private int mType
The action to be performed.


mTypeName

private java.lang.String mTypeName
Name of action to be performed


mOutput

private BlockWriter mOutput
Activity output - a dummy which outputs "1" to indicate completion.


mSource

private java.lang.String mSource
Represents the first operand for binary operations (copy and move) and the file to act upon for unary operations (create and delete).


mDestination

private java.lang.String mDestination
Represents the second operand for binary operations (copy and move).


mSourceFile

private java.io.File mSourceFile
The File object for mSource.


mDestinationFile

private java.io.File mDestinationFile
The File object for mDestination.

Constructor Detail

FileManipulationActivity

public FileManipulationActivity(org.w3c.dom.Element element)
                         throws ActivitySpecificationException,
                                ActivityCreationException
Method Detail

initialise

public void initialise()
                throws ActivitySpecificationException,
                       ActivityExecutionException
Description copied from class: AbstractFileActivity
Gets the data resource accessor for the files data resource according to whether the users credentials permit this access.

Overrides:
initialise in class AbstractFileActivity
Throws:
ActivitySpecificationException - If the user is not permitted to access the resource.
ActivityExecutionException - If some internal problem occurs.
See Also:
Activity.initialise()

toString

public java.lang.String toString()
Return a string representation of the action to be performed.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the action

processBlock

public void processBlock()
Description copied from class: Activity
Performs an iteration of the processing of an activity. This may involve reading a block of input data and writing a block of output data, or may involve some other kind of processing. When an activity is processed by the OGSA-DAI engine, this method will be invoked repeatedly until the activity either completes or stops due to an error or termination call. An implementation of this method should invoke the setCompleted method to indicate that processing is complete, or the setError method if an error occurs that will prevent the processing from completing.

Specified by:
processBlock in class Activity

copy

private void copy()
           throws ActivitySpecificationException,
                  ActivityExecutionException
Copy a file, bytewise, from a source file, creating the destination file if necessary. If the destination file already exists, it will be overwritten.

Throws:
ActivitySpecificationException - If the source file does not exist.
ActivityExecutionException - If there was a problem accessing the file.

move

private void move()
           throws ActivitySpecificationException,
                  ActivityExecutionException
Move a file, bytewise, from a source file, creating the destination file if necessary. If the destination file already exists, it will be overwritten.

Throws:
ActivitySpecificationException - If the source file does not exist.
ActivityExecutionException - If there was a problem accessing the file.

delete

private void delete()
             throws ActivitySpecificationException,
                    ActivityExecutionException
Delete a file.

Throws:
ActivitySpecificationException - If the file does not exist.
ActivityExecutionException - If there was a problem deleting the file.

create

private void create()
             throws ActivitySpecificationException,
                    ActivityExecutionException
Create a file.

Throws:
ActivitySpecificationException - If the file already exists.
ActivityExecutionException - If there was a problem creating the file.