MiG.oneclick
Class File

java.lang.Object
  extended by MiG.oneclick.File
All Implemented Interfaces:
java.io.Serializable

public class File
extends java.lang.Object
implements java.io.Serializable

This class provides fileaccess for the MiGOneClick framework.

See Also:
Serialized Form

Field Summary
static int CLOSED
           
static int R
          Used to open file in mode READ
static int RW
          Used to open file in mode READ/WRITE (File is truncated)
static int RWW
          Used to open file in mode READ/UPDATE
static int W
          Used to open file in mode WRITE (File is truncated)
static int WW
          Used to open file in mode UPDATE
 
Constructor Summary
File(java.lang.String server, java.lang.String iosessionid, java.lang.String filename, int mode)
          Creates a File object.
File(java.lang.String server, java.lang.String iosessionid, java.lang.String filename, int mode, boolean disable_https_trustmanager)
          Creates a File object, possible without a trustmanager.
 
Method Summary
 boolean close()
          Closes the file, if the file is opened in write mode a flush() is invoked.
 boolean flush()
          Flushes a file opened for write to the MiG server.
 int getBlockSize()
          For DEBUG
 java.lang.String getErrorMessages()
          Returns the ErrorMessage buffer as a String.
 java.lang.String getFilename()
          Returns the filename of the file.
 int getFlushCount()
          Returns the number of flushes performed on this file.
 int getMode()
          Returns the mode in which the file was opend
 java.util.Vector[] getTransferLog()
          Returns the transferlog
 int read()
          Reads the next byte of data from the file.
 void resetErrorMessages()
          Clears the File ErrorMessage buffer.
 boolean seek(long newfilepos)
          Seeks to the specified position in the file.
 void setIOsessionid(java.lang.String iosessionid)
          Changes the session of an allready opend file.
 void startTransferLogging()
          Starts logging of the Transferrates
 boolean write(int b)
          Writes a byte to the file, see read() for describtion of why the byte is represented as an int.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLOSED

public static final int CLOSED
See Also:
Constant Field Values

R

public static final int R
Used to open file in mode READ

See Also:
Constant Field Values

W

public static final int W
Used to open file in mode WRITE (File is truncated)

See Also:
Constant Field Values

WW

public static final int WW
Used to open file in mode UPDATE

See Also:
Constant Field Values

RW

public static final int RW
Used to open file in mode READ/WRITE (File is truncated)

See Also:
Constant Field Values

RWW

public static final int RWW
Used to open file in mode READ/UPDATE

See Also:
Constant Field Values
Constructor Detail

File

public File(java.lang.String server,
            java.lang.String iosessionid,
            java.lang.String filename,
            int mode)
Creates a File object.

Parameters:
server - URL to the server containing the files to access.
iosessionid - The MiG iosessionid.

File

public File(java.lang.String server,
            java.lang.String iosessionid,
            java.lang.String filename,
            int mode,
            boolean disable_https_trustmanager)
Creates a File object, possible without a trustmanager.

Parameters:
server - URL to the MiG server containing the files to access.
iosessionid - The MiG iosessionid.
disable_https_trustmanager - If true, this disables the https trustmanager, this is needed if the server uses a non-authorized https certificate.
Method Detail

read

public int read()
Reads the next byte of data from the file.

Returns:
-1 if EOF is reached or something went wrong. If something went wrong the getErrorMessages() method can be used to retrieve information on what happend. Actual data is returned as a value 0-255, the 'rocket scientist' who defined java's primitive types did'nt find any use for signed types. Therefor we are forced to use the first 8 bit of a int to simulate a signed byte.

flush

public boolean flush()
Flushes a file opened for write to the MiG server.

Returns:
boolean indicating if everyting went ok. If false is returned a message describing the error can be retrieved by the getErrorMessages() method.

write

public boolean write(int b)
Writes a byte to the file, see read() for describtion of why the byte is represented as an int.

Returns:
boolean indicating the status of the write. If something went wrong the getErrorMessages() method can be used to retrieve information on what happend.

seek

public boolean seek(long newfilepos)
Seeks to the specified position in the file.

Parameters:
newfilepos - Indicating the new fileposition relativly to the beginning of the file.
Returns:
boolean indicating the status of the seek. If something went wrong the getErrorMessages() method can be used to retrieve information on what happend.

close

public boolean close()
Closes the file, if the file is opened in write mode a flush() is invoked.

Returns:
boolean indicating the status of the close. If something went wrong the getErrorMessages() method can be used to retrieve information on what happend.

setIOsessionid

public void setIOsessionid(java.lang.String iosessionid)
Changes the session of an allready opend file. Used with checkpointing of opend files


getMode

public int getMode()
Returns the mode in which the file was opend


getFilename

public java.lang.String getFilename()
Returns the filename of the file.


getFlushCount

public int getFlushCount()
Returns the number of flushes performed on this file.


startTransferLogging

public void startTransferLogging()
Starts logging of the Transferrates


getTransferLog

public java.util.Vector[] getTransferLog()
Returns the transferlog


resetErrorMessages

public void resetErrorMessages()
Clears the File ErrorMessage buffer.


getErrorMessages

public java.lang.String getErrorMessages()
Returns the ErrorMessage buffer as a String.


getBlockSize

public int getBlockSize()
For DEBUG