uk.org.ogsadai.client.toolkit.activity.transform
Class ZIPArchive

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.activity.RequestComponent
        |
        +--uk.org.ogsadai.client.toolkit.activity.Activity
              |
              +--uk.org.ogsadai.client.toolkit.activity.transform.ZIPArchive

public class ZIPArchive
extends Activity

This activity archives data from other activities producing a ZIP archive and also metadata about the compression.

The activity has one or more inputs - the data to be compressed - and two outputs - the compressed data and metadata about the compression. The meta data output has a format analogous to the following example:

<zipArchiveMetadata> <checksum type="adler32" value="7615263"/> </zipArchiveMetadata>

Author:
The OGSA-DAI Project Team

Field Summary
private static int ARCHIVED_OUTPUT_INDEX
          Index of archived output.
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static java.lang.String INPUT_NAME
          Input name
private  ZIPChecksum mChecksumType
          ZIP checksum type.
private  java.lang.String mComment
          User-understandable comment.
private static int META_DATA_OUTPUT_INDEX
          Index of meta data output.
private  int mLevel
          ZIP archive level.
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
ZIPArchive()
          Constructs a request to ZIP archive data from another activities.
 
Method Summary
 void addEntry(ActivityOutput input)
          Sets the input of this activity to be the output from another activity that will provide the data to be tokenized.
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 ActivityOutput getArchivedDataOutput()
          Gets the activity's archived data output.
 java.lang.String getChecksumType()
          Gets the checksum type from the activity's meta data output.
 long getChecksumValue()
          Gets the checksum value from the activity's meta data output.
 ActivityOutput getMetaDataOutput()
          Gets the activity's meta data output.
 void setChecksumType(ZIPChecksum checksumType)
          Sets the ZIP checksum type.
 void setComment(java.lang.String comment)
          Sets the ZIP archive comment.
 void setLevel(int level)
          Sets the ZIP archive level.
 
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

ARCHIVED_OUTPUT_INDEX

private static final int ARCHIVED_OUTPUT_INDEX
Index of archived output.

See Also:
Constant Field Values

META_DATA_OUTPUT_INDEX

private static final int META_DATA_OUTPUT_INDEX
Index of meta data output.

See Also:
Constant Field Values

INPUT_NAME

private static final java.lang.String INPUT_NAME
Input name

See Also:
Constant Field Values

mComment

private java.lang.String mComment
User-understandable comment.


mChecksumType

private ZIPChecksum mChecksumType
ZIP checksum type.


mLevel

private int mLevel
ZIP archive level.

Constructor Detail

ZIPArchive

public ZIPArchive()
Constructs a request to ZIP archive data from another activities.

addEntry should be called to set the activity that provides input to this activity and setChecksumType to set the type of the checksum.

Method Detail

setChecksumType

public void setChecksumType(ZIPChecksum checksumType)
Sets the ZIP checksum type.

Parameters:
checksumType - The checksum type.
Throws:
java.lang.IllegalArgumentException - If type is null.

setComment

public void setComment(java.lang.String comment)
Sets the ZIP archive comment.

Parameters:
comment - A human-readable comment associated with the archive.
Throws:
java.lang.IllegalArgumentException - If the comment is null or greater than 0xFFFF in length.

setLevel

public void setLevel(int level)
Sets the ZIP archive level.

Parameters:
level - The level of compression where 0 is the minimum and 9 the maximum.
Throws:
java.lang.IllegalArgumentException - If level is < 0 or > 9.

addEntry

public void addEntry(ActivityOutput input)
Sets the input of this activity to be the output from another activity that will provide the data to be tokenized.

Parameters:
input - Output from another activity.
Throws:
java.lang.IllegalArgumentException - If input is null.

getArchivedDataOutput

public ActivityOutput getArchivedDataOutput()
Gets the activity's archived data output.

Returns:
the archived data output.

getMetaDataOutput

public ActivityOutput getMetaDataOutput()
Gets the activity's meta data output.

Returns:
the meta data output.

getChecksumValue

public long getChecksumValue()
                      throws NoActivityOutputException,
                             DataFormatException
Gets the checksum value from the activity's meta data output.

Returns:
checksum value.
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 into a checksum value.

getChecksumType

public java.lang.String getChecksumType()
                                 throws NoActivityOutputException,
                                        DataFormatException
Gets the checksum type from the activity's meta data output.

Returns:
checksum type.
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 into a checksum type.

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
See Also:
Activity.generateXML()