jsdai.lang
Class ExternalData

java.lang.Object
  extended byjsdai.lang.ExternalData

public abstract class ExternalData
extends java.lang.Object

An ExternalData object encapsulates data for an entity instance which is not covered by the attribute values of the entity instance. Because of this the external data is not covered by the underlying Express schema. It is up to JSDAI application to take advantage of this and define the meaning of this data.
The data is loaded and stored using InputStream and OutputStream thus allowing to handle big chunks of data available in a file.
An ExternalData object is always combined with an entity instance ant thus only available when corresponding entity instance is available. An ExternalData object belongs to the SdaiModel to which the entity instance belongs to. If access to the SdaiModel is ended the ExternalData object becomes invalid.
This object can be obtained from EEntity.getExternalData(). The state of the object can become invalid if external data is deleted by calling EEntity.removeExternalData().


Method Summary
 EEntity getInstance()
          Gets the instance this external data belongs to.
 java.lang.String getName()
          Gets the name of this external data.
 void loadToStream(java.io.OutputStream stream)
          Loads data in this object to specified stream.
 void setName(java.lang.String name)
          Sets the name of this external data.
 void storeFromStream(java.io.InputStream stream)
          Stores data from specified stream to this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public EEntity getInstance()
Gets the instance this external data belongs to.

Returns:
The owning instance

loadToStream

public void loadToStream(java.io.OutputStream stream)
                  throws SdaiException
Loads data in this object to specified stream. The valid transaction has to be running for this method to succeed. The stream is never closed. This is responsibility of the application.

Parameters:
stream - the stream to load data to.
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

storeFromStream

public void storeFromStream(java.io.InputStream stream)
                     throws SdaiException
Stores data from specified stream to this object. The valid transaction has to be running for this method to succeed. This methods doesn't perform actual operation but keeps the stream for later use. Actual storing occurs during transaction committing. The stream is closed after transaction commit or abort within calls SdaiTransaction#abort(), SdaiTransaction#endTransactionAccessAbort(), SdaiTransaction#commit(), SdaiTransaction#endTransactionAccessCommit(), or SdaiTransaction#endTransactionAccessCommit(String). If loadToStream is invoked after call to storeFromStream then provided stream has to support mark/reset, ie. stream.markSupported() has to return true and calls to stream.mark(0) and stream.reset() have to be functional. Use jsdai.io.ResettableFileInputStream for this purpose as file input.

Parameters:
stream - the stream to get data from. This stream has to be valid until the end of transaction.
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations
See Also:
SdaiTransaction.abort(), SdaiTransaction.endTransactionAccessAbort(), SdaiTransaction.commit(), SdaiTransaction.endTransactionAccessCommit(), SdaiTransaction.endTransactionAccessCommit(String), jsdai.io.ResettableFileInputStream

getName

public java.lang.String getName()
                         throws SdaiException
Gets the name of this external data. The valid transaction has to be running for this method to succeed.

Returns:
The name of this external data
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

setName

public void setName(java.lang.String name)
             throws SdaiException
Sets the name of this external data. ExternalData object name can be used as a file name when data is exported from JSDAI. The valid transaction has to be running for this method to succeed.

Parameters:
name - The new name of this external data
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

Copyright © LKSoftWare GmbH, 1999-2008