Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.0.0)

E17483-01

oracle.jbo.domain
Class BaseLobDomain

java.lang.Object
  extended by oracle.jbo.domain.BaseLobDomain
All Implemented Interfaces:
java.io.Serializable, MarshalledDomain, oracle.jdbc.internal.ObjectData, ORAData
Direct Known Subclasses:
BlobDomain, ClobDomain, GenericBlob, GenericClob

public abstract class BaseLobDomain
extends java.lang.Object
implements java.io.Serializable, ORAData, MarshalledDomain

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

Nested Class Summary
protected  class BaseLobDomain.BlobOutputStream
           
 
Field Summary
protected  java.lang.Object lob
           
protected  boolean mClient
           
protected  BaseLobDomain.BlobOutputStream mData
           
protected  boolean mDataModified
           
protected  java.lang.String mIndexString
           
protected  boolean mNeedsServerSync
           
protected  DomainOwnerInterface mOwner
           
protected  java.lang.Integer relIdx
           
protected  Transaction xAct
           
 
Constructor Summary
protected BaseLobDomain()
          Constructor for this object.
protected BaseLobDomain(BaseLobDomain nblob, 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.
protected BaseLobDomain(byte[] data)
          Constructor for this class.
protected BaseLobDomain(java.lang.Object blob)
          Constructor for this object.
protected BaseLobDomain(java.lang.Object 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.
protected BaseLobDomain(ResponseValues respVals)
           
 
Method Summary
 void closeCharacterStream()
           
 void closeInputStream()
           
 void closeOutputStream()
           
 boolean equals(java.lang.Object obj)
          Tests for equality between this and obj.
 java.io.Reader getCharacterStream()
           
 java.lang.Object getData()
          Internal: Applications should not use this method.
 java.io.InputStream getInputStream()
           
protected  java.io.InputStream getInputStream(long pos, long length)
           
protected abstract  java.io.InputStream getInternalDataStream()
           
protected abstract  java.io.InputStream getInternalDataStream(long pos, long length)
           
protected abstract  java.io.OutputStream getInternalOutputStream(long pos)
           
protected abstract  java.io.InputStream getInternalStream()
           
protected abstract  java.io.InputStream getInternalStream(long pos, long length)
           
static java.lang.reflect.Method getInvokeDomainMethod()
           
abstract  long getLength()
           
 java.io.OutputStream getOutputStream()
           
protected  java.io.OutputStream getOutputStream(long pos)
           
 DomainOwnerInterface getOwner()
           
 int getOwnerAttributeIndex()
           
protected  DomainOwnerInterface getOwnerRow()
           
protected  int getRemoteBufferSize()
           
 java.lang.String getRemoteIdString()
           
protected  long getRemoteLength()
           
 long getSize()
           
 byte[] getStorageByteArray()
           
 boolean isCacheDataModified()
           
 void loadFromDatabase(Transaction xAct)
          Internal: Applications should not use this method.
 ResponseValues marshal()
           
abstract  void prepareForDML(java.lang.Object context)
           
protected abstract  byte[] readBytesFromLob(long offset, int length)
           
protected  void resetCachedData()
           
 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.
 int setBytes(long pos, byte[] blobData, int offset, int len)
           
 void setContext(DomainOwnerInterface owner, Transaction trans, java.lang.Object ctx)
          Internal: Applications should not use this method.
 void syncClientLob(LobInterface oldObj)
           
protected abstract  void syncLob(java.lang.Object otherLob)
           
 void syncServerLob(LobInterface oldObj)
           
 byte[] toByteArray()
          Converts this BLOB contents into a byte array.
 Datum toDatum(java.sql.Connection c)
          Internal: Applications should not use this method.
 java.lang.String toString()
          For testing purposes only: converts this BlobDomain object to a string.
protected abstract  void writeBytesToLob()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mData

protected transient BaseLobDomain.BlobOutputStream mData

lob

protected transient java.lang.Object lob

mOwner

protected transient DomainOwnerInterface mOwner

xAct

protected transient Transaction xAct

mDataModified

protected transient boolean mDataModified

mClient

protected transient boolean mClient

relIdx

protected transient java.lang.Integer relIdx

mIndexString

protected transient java.lang.String mIndexString

mNeedsServerSync

protected transient boolean mNeedsServerSync
Constructor Detail

BaseLobDomain

protected BaseLobDomain()
Constructor for this object.


BaseLobDomain

protected BaseLobDomain(java.lang.Object 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.

BaseLobDomain

protected BaseLobDomain(byte[] data)
Constructor for this class. Creates an instance of this class with data as described in blobData.

Parameters:
blobData - data for the BLOB.

BaseLobDomain

protected BaseLobDomain(java.lang.Object 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.

BaseLobDomain

protected BaseLobDomain(BaseLobDomain nblob,
                        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.

BaseLobDomain

protected BaseLobDomain(ResponseValues respVals)
Method Detail

toDatum

public Datum toDatum(java.sql.Connection c)
              throws java.sql.SQLException
Internal: Applications should not use this method.

Converts this Domain object back into a SQL object.

Specified by:
toDatum in interface ORAData
Parameters:
c - OracleConnection Not used.
Returns:
A Datum object.
Throws:
java.sql.SQLException - if the serialization or deserialization fails.

setBytes

public void setBytes(byte[] blobData)
Sets the blob data for this object. On the client side, if there's a context available with this object, the bytes are streamed to the middle-tier object right-away. However if there's no context object, it's assumed that there will be a setAttribute call invoked on a containing row with this object as argument to stream the bytes via piggy-back.

Parameters:
blobData - data to fill the Blob.

setBytes

public int setBytes(long pos,
                    byte[] blobData,
                    int offset,
                    int len)

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.

Parameters:
xAct - name of the transaction context.
Throws:
java.lang.Exception

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.


prepareForDML

public abstract void prepareForDML(java.lang.Object context)

readBytesFromLob

protected abstract byte[] readBytesFromLob(long offset,
                                           int length)

writeBytesToLob

protected abstract void writeBytesToLob()

getInternalOutputStream

protected abstract java.io.OutputStream getInternalOutputStream(long pos)

getInternalStream

protected abstract java.io.InputStream getInternalStream()

getInternalStream

protected abstract java.io.InputStream getInternalStream(long pos,
                                                         long length)

getInternalDataStream

protected abstract java.io.InputStream getInternalDataStream()

getInternalDataStream

protected abstract java.io.InputStream getInternalDataStream(long pos,
                                                             long length)

syncLob

protected abstract void syncLob(java.lang.Object otherLob)

getLength

public abstract long getLength()

getRemoteBufferSize

protected int getRemoteBufferSize()

getRemoteLength

protected long getRemoteLength()

getData

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


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.

Parameters:
xAct - name of the transaction context.
Throws:
java.sql.SQLException

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.

Throws:
java.sql.SQLException

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.

isCacheDataModified

public boolean isCacheDataModified()

getStorageByteArray

public byte[] getStorageByteArray()

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.

marshal

public ResponseValues marshal()
Specified by:
marshal in interface MarshalledDomain

getOutputStream

public java.io.OutputStream getOutputStream()

getOutputStream

protected java.io.OutputStream getOutputStream(long pos)

getRemoteIdString

public java.lang.String getRemoteIdString()

getOwner

public DomainOwnerInterface getOwner()

getOwnerAttributeIndex

public int getOwnerAttributeIndex()

getOwnerRow

protected DomainOwnerInterface getOwnerRow()

getInputStream

public java.io.InputStream getInputStream()

getInputStream

protected java.io.InputStream getInputStream(long pos,
                                             long length)

getCharacterStream

public java.io.Reader getCharacterStream()

resetCachedData

protected void resetCachedData()

syncClientLob

public void syncClientLob(LobInterface oldObj)

syncServerLob

public void syncServerLob(LobInterface oldObj)

getSize

public long getSize()

getInvokeDomainMethod

public static java.lang.reflect.Method getInvokeDomainMethod()

closeOutputStream

public void closeOutputStream()

closeInputStream

public void closeInputStream()

closeCharacterStream

public void closeCharacterStream()

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.0.0)

E17483-01

Copyright © 1997, 2011, Oracle. All rights reserved.