com.crystaldecisions.sdk.occa.infostore
Interface IRemoteFile

All Superinterfaces:
IFile

public interface IRemoteFile
extends IFile

This interface represents a remote file object on the File Repository Server.

This interface defines two categories of operations:

For the proper use of this interface, use the inherited methods IFile.commit() and IFile.abort() to do the following:

Note: the operations defined are "two-phase", in other words, nothing will happen until the operation is successfully committed.


Method Summary
 boolean append(byte[] stream)
           Appends the remote file using the supplied byte stream.
 boolean append(java.lang.String localFile)
           Appends the remote file using the local file.
 boolean download(byte[] stream)
           Downloads the remote file to the specified byte stream.
 boolean download(java.io.OutputStream stream)
          Download the remote file to the specified output stream.
 boolean download(java.lang.String localFile)
           Downloads the remote file to the specified local file.
 java.lang.String getFilePath()
           Returns the remote file's path on the File Repository Server.
 java.io.InputStream getInputStream()
          Return the InputStream for this remote file object.
 java.lang.String getLocalFilePath()
           Returns the path of the local copy of the file.
 java.lang.String getRootPath()
           Returns the root of the remote file's path.
 IStreamingDownloadFile getStreamingDownloadFile(int chunkSize)
           Returns the interface for downloading a streaming file.
 IStreamingFile getStreamingFile()
          Deprecated. Please use IRemoteFile.getStreamingDownloadFile(int) instead.
 IStreamingUploadFile getStreamingUploadFile()
           Returns the interface for uploading a streaming file.
 IStreamingUploadFile getStreamingUploadFile(long size)
           Returns the interface for uploading a streaming file.
 java.lang.String getURL()
           Returns the URL of the remote file object.
 boolean overwrite(byte[] stream)
           Overwrites the remote file using the supplied byte stream.
 boolean overwrite(java.lang.String localFile)
           Overwrites the remote file using the local file.
 boolean overwrite(java.lang.String localFile, boolean deleteLocalFile)
           Overwrites the remote file using the local file.
 void setFallback(boolean fallback)
          Enables or disables fallback when file is retrieved from the FRS.
 
Methods inherited from interface com.crystaldecisions.sdk.occa.infostore.IFile
abort, commit, getActualName, getDestRelativePath, getName, getSize
 

Method Detail

getURL

java.lang.String getURL()

Returns the URL of the remote file object.

Returns:
A String containing the URL of the file object.

getFilePath

java.lang.String getFilePath()
                             throws SDKException

Returns the remote file's path on the File Repository Server.

Returns:
The remote file's path.
Throws:
SDKException - This is thrown if the process is unsuccessful.

getRootPath

java.lang.String getRootPath()
                             throws SDKException

Returns the root of the remote file's path.

Returns:
The root of the remote file's path,
Throws:
SDKException - This is thrown if the process is unsuccessful.

getLocalFilePath

java.lang.String getLocalFilePath()
                                  throws SDKException

Returns the path of the local copy of the file.

Returns:
The path of the local copy of the file.
Throws:
SDKException - This is thrown if the process is unsuccessful.

download

boolean download(java.lang.String localFile)
                 throws SDKException

Downloads the remote file to the specified local file.

Note: This method will throw an exception if the user does not have the appropriate rights for the InfoObject associated with the file that is being downloaded. If you need download right away, please call getStreamingDownloadFile instead. eg. in a webfarm case
This will acquire a lock from FileServer, so make sure IFiles commit or abort is called to release the lock.

Parameters:
localFile - The local file's path.
Returns:
true if there is no pending transaction and false if there is already a pending transaction.
Throws:
SDKException - This is thrown if the download process is unsuccessful.

download

boolean download(byte[] stream)
                 throws SDKException

Downloads the remote file to the specified byte stream.

Note: This method will throw an exception if the user does not have the appropriate rights for the InfoObject associated with the file that is being downloaded. If you need download right away, please call getStreamingDownloadFile instead. eg. in a webfarm case
This will acquire a lock from FileServer, so make sure IFiles commit or abort is called to release the lock.

Parameters:
stream - The byte stream that the remote fill will be downloaded to.
Returns:
true if there is no pending transaction and false if there is already a pending transaction.
Throws:
SDKException - This is thrown if the download process is unsuccessful.

download

boolean download(java.io.OutputStream stream)
                 throws SDKException
Download the remote file to the specified output stream.

Note: This method will throw an exception if the user does not have the appropriate rights for the InfoObject associated with the file that is being downloaded. If you need download right away, please call getStreamingDownloadFile instead. eg. in a webfarm case
This will acquire a lock from FileServer, so make sure IFiles commit or abort is called to release the lock.

Parameters:
stream - The OutputStream to be downloaded to
Throws:
SDKException

overwrite

boolean overwrite(java.lang.String localFile)
                  throws SDKException

Overwrites the remote file using the local file.
This will acquire a lock from FileServer, so make sure IFiles commit or abort is called to release the lock.

Parameters:
localFile - The local file that will replace the remote file.
Returns:
true if there is no pending transaction and false if there is already a pending transaction.
Throws:
SDKException - This is thrown if the overwrite procedure is unsuccessful.

overwrite

boolean overwrite(java.lang.String localFile,
                  boolean deleteLocalFile)
                  throws SDKException

Overwrites the remote file using the local file.
This will acquire a lock from FileServer, so make sure IFiles commit or abort is called to release the lock.

Parameters:
localFile - The local file that will replace the remote file.
deleteLocalFile - If true, the local file will be deleted after committed
Returns:
true if there is no pending transaction and false if there is already a pending transaction.
Throws:
SDKException - This is thrown if the overwrite procedure is unsuccessful.
Since:
4.0

overwrite

boolean overwrite(byte[] stream)
                  throws SDKException

Overwrites the remote file using the supplied byte stream.
This will acquire a lock from FileServer, so make sure IFiles commit or abort is called to release the lock.

Parameters:
stream - The byte stream that will be used to replace the remote file.
Returns:
true if there is no pending transaction and false if there is already a pending transaction.
Throws:
SDKException - This is thrown if the overwrite procedure is unsuccessful.

getStreamingFile

IStreamingFile getStreamingFile()
                                throws SDKException
Deprecated. Please use IRemoteFile.getStreamingDownloadFile(int) instead.

Returns the interface for downloading a streaming file.

Returns:
A IStreamingFile interface.
Throws:
SDKException - This is thrown if the process is unsuccessful.

getStreamingDownloadFile

IStreamingDownloadFile getStreamingDownloadFile(int chunkSize)
                                                throws SDKException

Returns the interface for downloading a streaming file.

Parameters:
chunkSize - The size of the chunk the streaming download will use(in bytes). 0 indicates use the server default one. This value can't be greater than 64K.
Returns:
A IStreamingFile interface.
Throws:
SDKException - This is thrown if the process is unsuccessful.

getStreamingUploadFile

IStreamingUploadFile getStreamingUploadFile()
                                            throws SDKException

Returns the interface for uploading a streaming file.

Returns:
A IStreamingUploadFile interface.
Throws:
SDKException - This is thrown if the process is unsuccessful.

getStreamingUploadFile

IStreamingUploadFile getStreamingUploadFile(long size)
                                            throws SDKException

Returns the interface for uploading a streaming file.

Parameters:
size - The size of the file that will be uploaded. This will be used to check disk availability on frs If you don't know the size of the file, put in 0
Returns:
A IStreamingUploadFile interface.
Throws:
SDKException - This is thrown if the process is unsuccessful.

getInputStream

java.io.InputStream getInputStream()
                                   throws SDKException
Return the InputStream for this remote file object.

Returns:
Throws:
SDKException

append

boolean append(java.lang.String localFile)
               throws SDKException

Appends the remote file using the local file.
This will acquire a lock from FileServer, so make sure IFiles commit or abort is called to release the lock.

Parameters:
localFile - The local file that will replace the remote file.
Returns:
true if there is no pending transaction and false if there is already a pending transaction.
Throws:
SDKException - This is thrown if the overwrite procedure is unsuccessful.

append

boolean append(byte[] stream)
               throws SDKException

Appends the remote file using the supplied byte stream.
This will acquire a lock from FileServer, so make sure IFiles commit or abort is called to release the lock.

Parameters:
stream - The byte stream that will be used to replace the remote file.
Returns:
true if there is no pending transaction and false if there is already a pending transaction.
Throws:
SDKException - This is thrown if the overwrite procedure is unsuccessful.

setFallback

void setFallback(boolean fallback)
Enables or disables fallback when file is retrieved from the FRS. If true, the FRS looks for other versions of the same file if the requested version (as noted by its GUID) is not found.

If not explicitly set, fallback is enabled.

Parameters:
fileFallback - true to enable fallback, false to disable.