grinda.client
Class DataTuple

java.lang.Object
  extended by grinda.client.Tuple
      extended by grinda.client.SpecialTuple
          extended by grinda.client.DataTuple
All Implemented Interfaces:
java.lang.Cloneable

public class DataTuple
extends SpecialTuple

Tuple with associated data that are transferred outside the TupleSpace using standard protocols (e.g HTTP, FTP, GridFTP). This class should be used when the data to tranfer are too big for web services.

Version:
1.0
Author:
Sirio Capizzi

Field Summary
 
Fields inherited from class grinda.client.Tuple
fields, size
 
Constructor Summary
DataTuple()
           
DataTuple(int size)
           
DataTuple(java.lang.Object v)
           
DataTuple(java.lang.Object v1, java.lang.Object v2)
           
DataTuple(java.lang.Object v1, java.lang.Object v2, java.lang.Object v3)
           
DataTuple(java.lang.Object v1, java.lang.Object v2, java.lang.Object v3, java.lang.Object v4)
           
DataTuple(java.lang.Object v1, java.lang.Object v2, java.lang.Object v3, java.lang.Object v4, java.lang.Object v5)
           
DataTuple(java.lang.Object v1, java.lang.Object v2, java.lang.Object v3, java.lang.Object v4, java.lang.Object v5, java.lang.Object v6)
           
 
Method Summary
 void addDataURL(java.lang.String url)
          Adds an url where to find data associated with this tuple
 java.lang.Object getData()
          Get the Data Associated with this tuple
 java.lang.Object getData(int index)
          Get the Data Associated with this tuple #param index the data index
 java.io.InputStream getStream()
          Gets the stream transmitting the data
 java.io.InputStream getStream(int i)
          Gets the ith stream transmitting the data
protected  void initialize(java.lang.Object[] args)
          Support function for constructors
 void saveDataTo(int index, java.lang.String filePath, boolean append)
          Save data to a file
 void saveDataTo(java.lang.String filePath)
          Save data to a file
 void saveDataTo(java.lang.String[] filePath)
          Save data to a file
 void saveDataTo(java.lang.String[] filePath, boolean append)
          Save data to a file
 void saveDataTo(java.lang.String filePath, boolean append)
          Save data to a file
 void setPort(int port)
          Sets the port used to transmit the data
 void setProtocol(java.lang.String protocol)
          Sets the protocol used to transmit the data
 InternalTuple toInternalTuple()
          Converts this tuple to an internal tuple used to communicate with the service
 
Methods inherited from class grinda.client.SpecialTuple
getMetaInfo, setMetaInfo
 
Methods inherited from class grinda.client.Tuple
addField, addField, clone, equals, getAbsoluteTemplate, getField, getFieldClassName, getFieldCount, getFieldValue, isTemplate, removeField, setField, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataTuple

public DataTuple()

DataTuple

public DataTuple(java.lang.Object v)

DataTuple

public DataTuple(java.lang.Object v1,
                 java.lang.Object v2)

DataTuple

public DataTuple(java.lang.Object v1,
                 java.lang.Object v2,
                 java.lang.Object v3)

DataTuple

public DataTuple(java.lang.Object v1,
                 java.lang.Object v2,
                 java.lang.Object v3,
                 java.lang.Object v4)

DataTuple

public DataTuple(java.lang.Object v1,
                 java.lang.Object v2,
                 java.lang.Object v3,
                 java.lang.Object v4,
                 java.lang.Object v5)

DataTuple

public DataTuple(java.lang.Object v1,
                 java.lang.Object v2,
                 java.lang.Object v3,
                 java.lang.Object v4,
                 java.lang.Object v5,
                 java.lang.Object v6)

DataTuple

public DataTuple(int size)
Method Detail

setProtocol

public void setProtocol(java.lang.String protocol)
Sets the protocol used to transmit the data

Parameters:
protocol - a supported protocl identifier (e.g. ftp, http, stp)

setPort

public void setPort(int port)
Sets the port used to transmit the data

Parameters:
port - a port number

getData

public java.lang.Object getData()
                         throws java.lang.Exception
Get the Data Associated with this tuple

Returns:
Throws:
java.lang.Exception

getData

public java.lang.Object getData(int index)
                         throws java.lang.Exception
Get the Data Associated with this tuple #param index the data index

Returns:
Throws:
java.lang.Exception

addDataURL

public void addDataURL(java.lang.String url)
Adds an url where to find data associated with this tuple

Parameters:
url - String

getStream

public java.io.InputStream getStream()
                              throws java.lang.Exception
Gets the stream transmitting the data

Returns:
InputStream
Throws:
java.lang.Exception

getStream

public java.io.InputStream getStream(int i)
                              throws java.lang.Exception
Gets the ith stream transmitting the data

Parameters:
i - the index representing the data
Returns:
InputStream
Throws:
java.lang.Exception

saveDataTo

public void saveDataTo(int index,
                       java.lang.String filePath,
                       boolean append)
                throws java.lang.Exception
Save data to a file

Parameters:
index - the index representing the data to save
filePath - the path where to store the data represented by this tuple
append - true if the data should be appended to an existent file
Throws:
java.lang.Exception

saveDataTo

public void saveDataTo(java.lang.String[] filePath,
                       boolean append)
                throws java.lang.Exception
Save data to a file

Parameters:
index - the index representing the data to save
filePath - the path where to store the data represented by this tuple
append - true if the data should be appended to an existent file
Throws:
java.lang.Exception

saveDataTo

public void saveDataTo(java.lang.String filePath,
                       boolean append)
                throws java.lang.Exception
Save data to a file

Parameters:
filePath - the path where to store the data represented by this tuple
append - true if the data should be appended to an existent file
Throws:
java.lang.Exception

saveDataTo

public void saveDataTo(java.lang.String filePath)
                throws java.lang.Exception
Save data to a file

Parameters:
filePath - the paths where to store the data represented by this tuple
Throws:
java.lang.Exception

saveDataTo

public void saveDataTo(java.lang.String[] filePath)
                throws java.lang.Exception
Save data to a file

Parameters:
filePath - the paths where to store the data represented by this tuple
Throws:
java.lang.Exception

toInternalTuple

public InternalTuple toInternalTuple()
Converts this tuple to an internal tuple used to communicate with the service

Overrides:
toInternalTuple in class SpecialTuple
Returns:
the corresponding internal tuple

initialize

protected void initialize(java.lang.Object[] args)
Description copied from class: Tuple
Support function for constructors

Overrides:
initialize in class Tuple
Parameters:
args - Object[]


Copyright © 2006 Sirio Capizzi. All Rights Reserved.