LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.peer.util
Class LyBlobFileHandler

java.lang.Object
  extended by leon.peer.util.LyBlobFileHandler

public class LyBlobFileHandler
extends java.lang.Object

This class offers methods for fectching content from a 'blob' or embeded document in a data provider and is used by leon.data.LyYFileValue to handle attachments.

See Also:
LyFileValue, LyObject

Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LyBlobFileHandler()
          Default constructor.
 
Method Summary
 java.lang.String fetchAttachment(LyObject object, LyField field, java.lang.String dir, java.lang.String fieldInfoId, java.lang.String origFileName)
          Fetch attachment from the peer data provider.
 java.io.InputStream getInputStream(java.lang.String locator)
          Gets the InputStream to the underlying value which is a 'File' The attachment handler MUST be "blob", additional FILE fields types may be supported later.
 java.lang.String setInputStream(java.lang.String dir, java.lang.String fieldId, java.io.InputStream iStream)
          Sets the the content of the value which is a 'file'.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values
Constructor Detail

LyBlobFileHandler

public LyBlobFileHandler()
Default constructor.

Method Detail

getInputStream

public java.io.InputStream getInputStream(java.lang.String locator)
Gets the InputStream to the underlying value which is a 'File' The attachment handler MUST be "blob", additional FILE fields types may be supported later. The application may be able to read the content of the file. This inputStream is generated from the peer value (by the datasource)

Parameters:
internal - locator (identifier) to get the attachment.
Returns:
the inputstream to read the file or null if it could not be found.

setInputStream

public java.lang.String setInputStream(java.lang.String dir,
                                       java.lang.String fieldId,
                                       java.io.InputStream iStream)
Sets the the content of the value which is a 'file'. The content should be read from the specified InputStream, and is stored in a file or in a blob or in a specific storage depending on the data provider. When the méthod exits, the inputStream is no longer used and may be closed. The attachment handler MUST be "blob", additional FILE fields types may be supported later.

Parameters:
iStream - the inputstream used by the data provider to read the file.
dir - where to place the file
fieldId - identifier of the field (to be part of the generated temp name)
Returns:
the locator path or null if not saved.

fetchAttachment

public java.lang.String fetchAttachment(LyObject object,
                                        LyField field,
                                        java.lang.String dir,
                                        java.lang.String fieldInfoId,
                                        java.lang.String origFileName)
Fetch attachment from the peer data provider. This methods actually download or get from the blob the target attachment.

Parameters:
dir - where to place the file
fieldInfoId - identifier of the field (to be part of the generated temp name)
origFileName - identifier of the field (to be part of the generated temp name)
Returns:
the locator path if attachment was found, null otherwise

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com