Oracle9i Business Components for Java InterMedia API Reference
Oracle9i JDeveloper (9.0.4)
B10394-01

oracle.ord.im
Interface OrdDomainIOInterface

All Known Implementing Classes:
OrdAudioDomain, OrdDocDomain, OrdImageDomain, OrdVideoDomain

public interface OrdDomainIOInterface

An interface for interMedia (IM) Business Components for Java (BC4J) domain objects, which have a common set of loading and retrieving related APIs.

The IM BC4J domain classes include OrdImageDomain, OrdAudioDomain, OrdVideoDomain and OrdDocDomain. They derive from the interMedia Java Classes: OrdImage, OrdAudio, OrdVideo and OrdDoc respectively. Most methods in this interface can be found in the interMedia Java Classes. The exceptions are the following:

Among these methods, getBFileDomain and getContentAsBlobDomain are added to support tier transparent access from BC4J applications to the content stored in the database BLOB and BFILE. getContentSource and setContentSource are added for deferred loading purposes. setContentLength and setProperties are added for the purpose of uniformity and simplicity.

The methods in this interface can be categorized into three types:

  1. Domain attributes setters and getters:
  2. Content analyzing and manipulating methods:
  3. Content loading and retrieving methods:
Since:
JDev5.0

Method Summary
 void clearContentSource()
          Internal: Applications should not use this method.
 void clearLocal()
          Clears the attribute called local to indicate that the content data is stored externally.
 void deleteContent()
          Deletes any data stored in the database BLOB specified by the localData attribute.
 oracle.jbo.domain.BFileDomain getBFileDomain()
          Returns a BFileDomain object which wraps the BFILE locator obtained from the getBFILE method.
 oracle.jbo.domain.BlobDomain getContentAsBlobDomain()
          Returns a BlobDomain object which wraps the BLOB locator from the localData attribute.
 int getContentLength()
          Returns the length of the content.
 OrdContentSource getContentSource()
          Gets the content source which was previously set by the setContentSource method.
 byte[] getDataInByteArray()
          Returns a byte array containing the data from the database BLOB specified by the localData attribute.
 boolean getDataInFile(java.lang.String filename)
          Writes the data from the database BLOB specified by the localData attribute to a local file.
 java.io.InputStream getDataInStream()
          Returns an InputStream from which the data in the database BLOB specified by the localData attribute can be read.
 java.lang.String getMimeType()
          Returns the mimeType attribute.
 java.lang.String getSourceLocation()
          Returns the srcLocation attribute.
 java.lang.String getSourceName()
          Returns the srcName attribute.
 java.lang.String getSourceType()
          Returns the srcType attribute.
 java.sql.Timestamp getUpdateTime()
          Returns the updateTime attribute.
 boolean isLocal()
          Determines whether the content data is stored locally in the database in a BLOB specified by the localData attribute.
 boolean loadDataFromByteArray(byte[] byteArray)
          Loads data from a byte array into the database BLOB specified by the localData attribute.
 boolean loadDataFromFile(java.lang.String filename)
          Loads data from a file into the database BLOB specified by the localData attribute.
 boolean loadDataFromInputStream(java.io.InputStream inpStream)
          Loads data from an InputStream into the database BLOB specified by the localData attribute.
 void setContentLength(int newContentLength)
          Sets the contentLength attribute.
 void setContentSource(OrdContentSource source)
          Sets the content source for deferred loading.
 void setContentSourceOnly(OrdContentSource source)
          Internal: Applications should not use this method.
 void setLocal()
          Sets the attribute called local to indicate that the content data is stored locally in the database in a BLOB > specified by the localData attribute.
 void setMimeType(java.lang.String MimeType)
          Sets the mimeType attribute.
 void setProperties()
          Parses the multimedia content properties and sets the attributes in the interMedia BC4J domain object.
 void setSource(java.lang.String srcType, java.lang.String srcLocation, java.lang.String srcName)
          Sets the srcType, srcLocation, and srcName attributes.
 void setUpdateTime(java.sql.Timestamp currentTime)
          Sets the updateTime attribute.

 

Method Detail

getContentAsBlobDomain

public oracle.jbo.domain.BlobDomain getContentAsBlobDomain()
                                                    throws java.sql.SQLException
Returns a BlobDomain object which wraps the BLOB locator from the localData attribute.
Returns:
a BlobDomain object
Throws:
java.sql.SQLException - if an error occurs in calling getContent method.
See Also:
OrdImage.getContent(), OrdAudio.getContent(), OrdVideo.getContent(), OrdDoc.getContent()

getBFileDomain

public oracle.jbo.domain.BFileDomain getBFileDomain()
                                             throws java.sql.SQLException
Returns a BFileDomain object which wraps the BFILE locator obtained from the getBFILE method.
Returns:
a BFileDomain object
Throws:
java.sql.SQLException - if an error occurs in calling getBFILE method.
See Also:
OrdImage.getBFILE(), OrdAudio.getBFILE(), OrdVideo.getBFILE(), OrdDoc.getBFILE()

clearLocal

public void clearLocal()
                throws java.sql.SQLException
Clears the attribute called local to indicate that the content data is stored externally.
Throws:
java.sql.SQLException - if an error occurs when accessing the attribute called local.

isLocal

public boolean isLocal()
                throws java.sql.SQLException
Determines whether the content data is stored locally in the database in a BLOB specified by the localData attribute.
Returns:
true if the data is stored locally in the database in a BLOB; otherwise, returns false
Throws:
java.sql.SQLException - if an error occurs when accessing the attribute called local.

setLocal

public void setLocal()
              throws java.sql.SQLException
Sets the attribute called local to indicate that the content data is stored locally in the database in a BLOB > specified by the localData attribute.
Throws:
java.sql.SQLException - if an error occurs when accessing the attribute called local.

setSource

public void setSource(java.lang.String srcType,
                      java.lang.String srcLocation,
                      java.lang.String srcName)
               throws java.sql.SQLException
Sets the srcType, srcLocation, and srcName attributes.
Parameters:
srcType - the source type, for example, "FILE", "HTTP".
srcLocation - the source location, for example, MEDIA_DIR, www.xyzcoimages.com/public.
srcName - the source name, for example, media_content.dat
Throws:
java.sql.SQLException - if an error occurs when accessing the srcType, srcLocation, or srcName attributes.

getSourceType

public java.lang.String getSourceType()
                               throws java.sql.SQLException
Returns the srcType attribute. For example, "FILE" or "HTTP".
Returns:
the srcType attribute as a String.
Throws:
java.sql.SQLException - if an error occurs when accessing the srcType attribute.

getSourceLocation

public java.lang.String getSourceLocation()
                                   throws java.sql.SQLException
Returns the srcLocation attribute. For example, IMAGES_DIR or www.xyzcoimages.com/public.
Returns:
the srcLocation attribute as a String.
Throws:
java.sql.SQLException - if an error occurs when accessing the srcLocation attribute.

getSourceName

public java.lang.String getSourceName()
                               throws java.sql.SQLException
Returns the srcName attribute. For example, scenery1.jpg.
Returns:
the srcName attribute as a String.
Throws:
java.sql.SQLException - if an error occurs when accessing the srcName attribute.

setUpdateTime

public void setUpdateTime(java.sql.Timestamp currentTime)
                   throws java.sql.SQLException
Sets the updateTime attribute. This method sets the updateTime attribute to the specified time, or to the database server's current SYSDATE time if currentTime is specified as null.
Parameters:
currentTime - the update time in a java.sql.Timestamp, or null to set the update time to the database server's current SYSDATE time.
Throws:
java.sql.SQLException - if an error occurs when executing the corresponding setUpdateTime method in the database.

getUpdateTime

public java.sql.Timestamp getUpdateTime()
                                 throws java.sql.SQLException
Returns the updateTime attribute.
Returns:
the lastUpdate attribute as a java.sql.Timestamp.
Throws:
java.sql.SQLException - if an error occurs when accessing the updateTime attribute.

setContentLength

public void setContentLength(int newContentLength)
                      throws java.sql.SQLException
Sets the contentLength attribute.
Note

This method only sets contentLength attribute for OrdImageDomain and OrdDocDomain objects. It does nothing for OrdAudioDomain and OrdVideoDomain objects.

Throws:
java.sql.SQLException - if an error occurs when accessing the contentLength attribute.
See Also:
OrdImage.setContentLength(int), OrdDoc.setContentLength(int)

getContentLength

public int getContentLength()
                     throws java.sql.SQLException
Returns the length of the content.

For OrdImageDomain and OrdDocDomain classes, this method returns the contentLength attribute. For interMedia OrdAudioDomain and OrdVideoDomain classes, this method calls the corresponding getContentLength method in the database.

Returns:
the content length as an int.
Throws:
java.sql.SQLException - if an error occurs when accessing the contentLength attribute (for OrdImageDomain and OrdDocDomain) or when executing the corresponding getContentLength method in the database (for OrdAudioDomain and OrdVideoDomain).
See Also:
OrdImage.getContentLength(), OrdDoc.getContentLength(), OrdAudio.getContentLength(), OrdVideo.getContentLength()

setMimeType

public void setMimeType(java.lang.String MimeType)
                 throws java.sql.SQLException
Sets the mimeType attribute.
Throws:
java.sql.SQLException - if an error occurs when accessing the mimeType attribute.

getMimeType

public java.lang.String getMimeType()
                             throws java.sql.SQLException
Returns the mimeType attribute.
Returns:
the mimeType attribute as a String.
Throws:
java.sql.SQLException - if an error occurs when accessing the mimeType attribute.

setProperties

public void setProperties()
                   throws java.sql.SQLException
Parses the multimedia content properties and sets the attributes in the interMedia BC4J domain object. An attribute is set to null if the corresponding property cannot be extracted for a specific media format. This method throws a SQLException if the multimedia format is not recognized.

See each implementation classes' setProperties comments for detailed information.

Throws:
java.sql.SQLException - if an error occurs when executing the corresponding setProperties method in the database.
See Also:
OrdImageDomain.setProperties(), OrdAudioDomain.setProperties(), OrdVideoDomain.setProperties(), OrdDocDomain.setProperties()

deleteContent

public void deleteContent()
                   throws java.sql.SQLException
Deletes any data stored in the database BLOB specified by the localData attribute.
Throws:
java.sql.SQLException - if an error occurs when executing the corresponding deleteContent method in the database.

loadDataFromFile

public boolean loadDataFromFile(java.lang.String filename)
                         throws java.sql.SQLException,
                                java.io.IOException
Loads data from a file into the database BLOB specified by the localData attribute. Before loading the data, this method calls the following methods:
Parameters:
filename - name of the file from which to load data
Returns:
true if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns false.
Throws:
java.sql.SQLException - if an error occurs when accessing an object attribute or when executing a method in the database.
java.io.IOException - if an error occurs when reading the data file.

loadDataFromInputStream

public boolean loadDataFromInputStream(java.io.InputStream inpStream)
                                throws java.sql.SQLException,
                                       java.io.IOException
Loads data from an InputStream into the database BLOB specified by the localData attribute. Before loading the data, this method calls the following methods:
Parameters:
inpStream - the InputStream from which to load data
Returns:
true if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns false.
Throws:
java.sql.SQLException - if an error occurs when accessing an object attribute or when executing a method in the database.
java.io.IOException - if an error occurs when reading the InputStream.

loadDataFromByteArray

public boolean loadDataFromByteArray(byte[] byteArray)
                              throws java.sql.SQLException,
                                     java.io.IOException
Loads data from a byte array into the database BLOB specified by the localData attribute. Before loading the data, this method calls the following methods:
Returns:
true if the data is loaded successfully; otherwise, an exception is raised if an error occurs. This method never returns false.
Throws:
java.sql.SQLException - if an error occurs when accessing an object attribute or when executing a method in the database.
java.io.IOException - if an error occurs reading the byte array.

getDataInFile

public boolean getDataInFile(java.lang.String filename)
                      throws java.sql.SQLException,
                             java.io.IOException
Writes the data from the database BLOB specified by the localData attribute to a local file.
Parameters:
filename - name of the file to which the data is to be written.
Returns:
true if the data is written to the file successfully; otherwise, an exception is raised if an error occurs. This method never returns false.
Throws:
java.sql.SQLException - if an error occurs when accessing an object attribute.
java.io.IOException - if an error occurs when reading the data from the BLOB or when writing the data to the output file.

getDataInStream

public java.io.InputStream getDataInStream()
                                    throws java.sql.SQLException
Returns an InputStream from which the data in the database BLOB specified by the localData attribute can be read.
Returns:
an InputStream from which the data can be read.
Throws:
java.sql.SQLException - if an error occurs when accessing an object attribute.

getDataInByteArray

public byte[] getDataInByteArray()
                          throws java.sql.SQLException,
                                 java.io.IOException,
                                 java.lang.OutOfMemoryError
Returns a byte array containing the data from the database BLOB specified by the localData attribute.
Returns:
a byte[] array containing the data.
Throws:
java.sql.SQLException - if an error occurs when accessing an object attribute.
java.io.IOException - if an error occurs when reading the data from the BLOB.
java.lang.OutOfMemoryError - if sufficient memory cannot be allocated to hold the data.

setContentSource

public void setContentSource(OrdContentSource source)
Sets the content source for deferred loading. Three predefined content source implementations support loading content from a file, a byte array, or a OrdHttpUploadFile object. The loading of content from the client into the database doesn't happen inside this method. It's deferred to the next postChanges method call.

If the source parameter is null, this method just resets the previously set content source.

In 3Tier environment, this method registers the domain object in the client post listener list so the content won't be replicated from CT to MT. The content will be streamed to the database directly after the postChanges.

Parameters:
source - the content source for the deferred loading
See Also:
OrdContentSource

getContentSource

public OrdContentSource getContentSource()
Gets the content source which was previously set by the setContentSource method.
Returns:
the content source object

setContentSourceOnly

public void setContentSourceOnly(OrdContentSource source)
Internal: Applications should not use this method.

clearContentSource

public void clearContentSource()
Internal: Applications should not use this method.

Oracle9i Business Components for Java InterMedia API Reference
Oracle9i JDeveloper (9.0.4)
B10394-01

Copyright © 2001,2003, Oracle. All Rights Reserved.