Business Components

oracle.jbo.domain
Class BlobDomain

java.lang.Object
  |
  +--oracle.jbo.domain.BlobDomain

public class BlobDomain
extends java.lang.Object
implements BlobDomainInterface, XMLDomainInterface, java.io.Serializable

This class provides a lightweight wrapper for oracle.sql.BLOB, the Java representation of the BLOB database type. This wrapper allows an instance of the oracle.sql.BLOB to be used as a domain object.

Since:
JDeveloper 3.0
See Also:
Serialized Form

Constructor Summary
BlobDomain()
          Constructor for this object.
BlobDomain(oracle.sql.BLOB blob)
          Constructor for this object.
BlobDomain(oracle.sql.BLOB blob, byte[] blobData)
          Creates an instance of this class with data as described in blobData and using the transaction context from blob to use the blob-locator in the database.
BlobDomain(BlobDomain blob, byte[] blobData)
          Creates an instance of this class with data as described in blobData and using the transaction context from blob to use the blob-locator in the database.
BlobDomain(byte[] data)
          Constructor for this class.
 
Method Summary
static oracle.sql.BLOB createEmptyBLOB(java.lang.Object context)
          Creates an empty Blob object.
 boolean equals(java.lang.Object obj)
          Tests for equality between this and obj.
 java.lang.Object getData()
          Internal: Applications should not use this method.
 org.w3c.dom.Node getXMLContentNode(org.w3c.dom.Document xmlDoc)
          Creates the XML node in the given XML document for this domain's data.
static XMLDomainFactory getXMLDomainFactory(java.lang.Class attrClass)
          Internal: Applications should not use this method.
protected  java.lang.String getXMLElementTag()
          Returns this class name as an XML-element tag for this Struct domain object.
 void loadFromDatabase(Transaction xAct)
          Internal: Applications should not use this method.
 void prepareForDML(java.lang.Object context)
          Internal: Applications should not use this method.
 java.lang.String printXMLDefinition(java.util.Hashtable allDefs, java.io.PrintWriter pw, boolean bContainees)
          Prints the DTD information for this domain in the given print writer.
 void saveToDatabase(Transaction xAct)
          Internal: Applications should not use this method.
 void saveToDatabase(Transaction xAct, java.lang.Object emptySQLObject)
          Internal: Applications should not use this method.
 void setBytes(byte[] blobData)
          Sets the blob data for this object.
 void setContext(DomainOwnerInterface owner, Transaction trans, java.lang.Object ctx)
          Internal: Applications should not use this method.
 void shareBLOB(BlobDomain newBlob)
          Internal: Applications should not use this method.
 byte[] toByteArray()
          Converts this BLOB contents into a byte array.
 java.lang.String toString()
          For testing purposes only: converts this BlobDomain object to a string.
 void useBLOB(oracle.sql.BLOB newBlob)
          Internal: Applications should not use this method.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlobDomain

public BlobDomain()
Constructor for this object.

BlobDomain

public BlobDomain(oracle.sql.BLOB blob)
Constructor for this object. This is for use by JDBC. This constructor uses the transaction context from blob to use the blob-locator in the database.
Parameters:
blob - the BLOB from which to construct the BlobDomain.

BlobDomain

public BlobDomain(byte[] data)
Constructor for this class. Creates an instance of this class with data as described in blobData.
Parameters:
blobData - data for the BLOB.

BlobDomain

public BlobDomain(oracle.sql.BLOB blob,
                  byte[] blobData)
Creates an instance of this class with data as described in blobData and using the transaction context from blob to use the blob-locator in the database.

Parameters:
blob - transaction context for the BLOB locator, as a BLOB object.
blobData - data for the BLOB.

BlobDomain

public BlobDomain(BlobDomain blob,
                  byte[] blobData)
Creates an instance of this class with data as described in blobData and using the transaction context from blob to use the blob-locator in the database.

This constructor should be used by applications using the framework to create BlobDomain objects.

Parameters:
blob - transaction context for the BLOB locator as a BlobDomain object.
blobData - data for the BLOB.
Method Detail

shareBLOB

public void shareBLOB(BlobDomain newBlob)
Internal: Applications should not use this method.

If this object does not have a transaction context, it obtains the transaction data from newBlob.

Parameters:
newBlob - name of the Blob which will share its translaction data.

useBLOB

public void useBLOB(oracle.sql.BLOB newBlob)
Internal: Applications should not use this method.

If this object does not have a transaction context, shares the transaction and blob-locator from newBlob.

Parameters:
newBlob - name of the Blob that will share its transaction context and Blob locator data.

setBytes

public void setBytes(byte[] blobData)
Sets the blob data for this object. This method gets its data from a ByteArrayOutputStream.

Parameters:
blobData - data to fill the Blob.

loadFromDatabase

public void loadFromDatabase(Transaction xAct)
                      throws java.lang.Exception
Internal: Applications should not use this method.

Uses the given transaction context to load data from the database.

Specified by:
loadFromDatabase in interface BlobDomainInterface
Parameters:
xAct - name of the transaction context.

setContext

public void setContext(DomainOwnerInterface owner,
                       Transaction trans,
                       java.lang.Object ctx)
Internal: Applications should not use this method.

Sets the transaction context for this Blob.


getData

public java.lang.Object getData()
Internal: Applications should not use this method.

Returns BLOB that contains data for this object.

Tags copied from interface: DomainInterface
Returns:
a formatted value object.

saveToDatabase

public void saveToDatabase(Transaction xAct)
                    throws java.sql.SQLException
Internal: Applications should not use this method.

Uses the given transaction context to store data back into the database using the blob-locator which should be set before this method is invoked.

Specified by:
saveToDatabase in interface BlobDomainInterface
Parameters:
xAct - name of the transaction context.

saveToDatabase

public void saveToDatabase(Transaction xAct,
                           java.lang.Object emptySQLObject)
                    throws java.sql.SQLException
Internal: Applications should not use this method.

Uses the given transaction context to store data back into the database using the blob-locator which should be set before this method is invoked.

Specified by:
saveToDatabase in interface BlobDomainInterface

prepareForDML

public void prepareForDML(java.lang.Object context)
Internal: Applications should not use this method.

Specified by:
prepareForDML in interface BlobDomainInterface
Parameters:
context - an internal framework context.

createEmptyBLOB

public static oracle.sql.BLOB createEmptyBLOB(java.lang.Object context)
Creates an empty Blob object.

Parameters:
context - an internal framework context.

toString

public java.lang.String toString()
For testing purposes only: converts this BlobDomain object to a string.
Overrides:
toString in class java.lang.Object
Returns:
this BlobDomain as a string.

toByteArray

public byte[] toByteArray()
Converts this BLOB contents into a byte array.
Returns:
a byte array containing the contents of the BLOB.

equals

public boolean equals(java.lang.Object obj)
Tests for equality between this and obj. Converts all the data into a String and compares the two strings. This is a default implementation of equals which could be overridden to perform more scalable application-specific comparisons.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the data item to compare against.

getXMLElementTag

protected java.lang.String getXMLElementTag()
Returns this class name as an XML-element tag for this Struct domain object. Override this method to return a custom XML-element tag for this domain.

getXMLContentNode

public org.w3c.dom.Node getXMLContentNode(org.w3c.dom.Document xmlDoc)
Creates the XML node in the given XML document for this domain's data.

Specified by:
getXMLContentNode in interface XMLDomainInterface
Parameters:
xmlDoc - name of the XML document.

printXMLDefinition

public java.lang.String printXMLDefinition(java.util.Hashtable allDefs,
                                           java.io.PrintWriter pw,
                                           boolean bContainees)
Prints the DTD information for this domain in the given print writer. Returns the DTD string to be added to this domain's container entity/domain.

Specified by:
printXMLDefinition in interface XMLDomainInterface
Parameters:
allDefs - name of hashtable containing key-value pairs of XML tags and their values.
pw - printwriter on which the information should be printed.
bContainees - whether this domain container has containees.

getXMLDomainFactory

public static XMLDomainFactory getXMLDomainFactory(java.lang.Class attrClass)
Internal: Applications should not use this method.

Business Components