Oracle8i interMedia Audio, Image, and Video Java Client User's Guide and Reference
Release 8.1.5

A67296-01

Library

Product

Contents

Index

Prev Next

4
ORDSource Reference Information

Oracle8i interMedia Audio, Image, and Video Java Client contains information about the ORDSource:

Methods invoked at the ORDSource level that are handed off for processing to the server-side source plug-in have byte[ ] ctx as a context parameter. The space for the parameter is created by the client (in the reference examples, 4000 bytes of space), but the content of the context parameter is generated by the server. The context parameter is passed from the client to the server for the processing of context information.


Note:

In the current release, not all source plug-ins will use or generate the context parameter, but if you include the parameter as previously described, your application should work with any current or future source plug-in.  


See Oracle8i interMedia Audio, Image, and Video User's Guide and Reference for more information.

4.1 Object Types

Oracle8i interMedia Audio, Image, and Video Java Client describes the ORDSource object type, which supports access to a variety of sources of multimedia data.


ORDSource Object Type

The ORDSource object type supports access to data sources locally in a BLOB within an Oracle database, externally from a BFILE on a local file system, externally from a URL on an HTTP server, externally from streaming multimedia data on a media server, or externally from a user-defined source on another server.


Note:

In the following code, the methods have the default protection, which means that they can be called only by other methods in the package.  


This object type is defined as follows:

package oracle.ord.media;
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
import oracle.sql.*;

public class OrdSource {

     int MAX_CHUNKSIZE = 32300;
     
     BindToTableParams bindParams = null;
     String containerType;
     Connection connection;
     boolean lock = false;
     
     BLOB localData = null;
     String srcType;
     String srcLocation;
     String srcName;
     Timestamp updateTime;
     int local;
     
     OrdSource( )
     { } 
     
     void setLock(boolean lockOption)
     { }
     
     boolean isLocked( )
     { }
     
     void setConnection(Connection the_connecton)
     { }
     
     Connection getConnection( )
     { }
     
     String getSQLConstructor(boolean updateOption, String mmObjName,
          String srcObjName)
     { }
     
     String getUpdateStr(String mmObjName, String srcObjName)
     { }
     
     void flush( )
     throws SQLException
     { }
     
     void setBindParams(BindToTableParams bParams)
     { }
     
     void setContainerType(String type)
     { }
     
     String getContainerType( )
     { }
     
     String defineSQLResults(String var)
     { }
     
     int declareSQLResults(int start, OracleCallableStatement stmt)
     throws SQLException
     { }
     
     String setSQLParams(String var)
     { }
     
     int bindInSQLParams(int start, OracleCallableStatement stmt)
     throws SQLException
     { }
     
     int getSQLResults(int start, OracleCallableStatement stmt)
     throws SQLException
     { }
     
     void refresh(boolean forUpdate)
     throws SQLException
     { }
     
     void setLocal( )
     { }
     
     void clearLocal( )
     { }
     
     boolean isLocal( )
     { }
     
     Timestamp getUpdateTime( )
     { }
     
     void setUpdateTime( )
     throws SQLException
     { }
     
     void setSourceInformation(String sourceType, String sourceLocation,
          String sourceName)
     { }
     
     void setSourceType(String sourceType)
     { }
     
     void setSourceLocation(String sourceLocation)
     { }
     
     void setSourceName(String sourceName)
     { }
     
     String getSourceInformation( )
     { }
     
     String getSourceType( )
     { }
     
     String getSourceLocation( )
     { }
     
     String getSourceName( )
     { }
     
     BLOB importData(byte[ ] ctx, BLOB dlob, StringBuffer mimetype,
          StringBuffer format)
     throws SQLException
     { }
     
     BLOB importFrom(byte[ ] ctx, BLOB dlob, StringBuffer mimetype,
          StringBuffer format, String sourceType, String sourceLocation,
          String sourceName)
     throws SQLException
     { }
     
     void export(byte[ ] ctx, String sourceType, String sourceLocation,
          String sourceName)
     throws SQLException
     { }
     
     int getContentLength( )
     throws SQLException
     { }
     
     String getSourceAddress( )
     { }
     
     BLOB getLocalContent( )
     throws SQLException
     { }
     
     BLOB getContentInTempLob(byte[ ] ctx, BLOB blob,
          StringBuffer mimetype, StringBuffer format)
     throws SQLException
     { }
     
     BLOB getContentInTempLob(byte[ ] ctx, BLOB blob, StringBuffer mimetype,
          StringBuffer format, int duration, boolean cache)
     throws SQLException
     { }
     
     void deleteLocalContent( )
     throws SQLException
     { }
     
     int read(byte[ ] ctx, int startPos, int numBytes, byte[ ] buffer)
     throws SQLException
     { }
     
     int write(byte[ ] ctx, int startPos, int numBytes, byte[ ] buffer)
     throws SQLException
     { }
     
     int open(byte[ ] userArg, byte[ ] ctx)
     throws SQLException
     { }
     
     int close(byte[ ] ctx)
     throws SQLException
     { }
     
     int trim(byte[ ] ctx, int newLen)
     throws SQLException
     { }
     
     BFILE getBFILE( )
     throws SQLException
     { }
     
     byte[ ] processCommand(byte[ ] ctx, String command, String argList,
          byte[ ] result)
     throws SQLException
     { }
}

where the class attributes are defined as:

4.2 Methods

This section presents ORDSource reference information on the methods used for source data manipulation. These methods are described in the following groupings:

ORDSource Methods Associated with the bindParams Attribute

ORDSource Methods Associated with the containerType Attribute

ORDSource Methods Associated with the connection Attribute

ORDSource Methods Associated with the lock Attribute

ORDSource Methods Associated with the srcName, srcType, and srcLocation Attributes

ORDSource Methods Associated with the updateTime Attribute

ORDSource Methods Associated with the local Attribute

ORDSource Methods Associated with Communication Between Client and Server

ORDSource Methods Associated with the SQL Type

ORDSource Methods Associated with Access Operations

ORDSource Methods Associated with Content Read/Write Operations

ORDSource Methods Associated with Import and Export Operations

ORDSource Methods Associated with Source Content Operations

ORDSource Methods Associated with Processing Commands to the External Source

4.2.1 ORDSource Methods Associated with the bindParams Attribute

This section presents reference information on the ORDSource methods associated with the bindParams attribute.


setBindParams( ) Method

Format

void setBindParams(BindToTableParams bParams)

Scope

package

Description

Sets the data location parameters.

Parameter

bParams

The binding parameter values. For more information on the BindToTableParams object, see "BindToTableParams Object Type" and Section 3.3.

Returns

None.

Exceptions

None.

Usage

None.

4.2.2 ORDSource Methods Associated with the containerType Attribute

This section presents reference information on the ORDSource methods associated with the containerType attribute.


setContainerType( ) Method

Format

void setContainerType(String type)

Scope

package

Description

Sets the object container type to ORDAudio, ORDImage, ORDVideo, or ORDVir.

The containerType attribute indicates the type of the object in which the ORDSource object is embedded.

Parameter

type

The value of the object type.

Returns

None.

Exceptions

None.

Usage

None.


getContainerType( ) Method

Format

String getContainerType( )

Scope

package

Description

Gets the container type of the ORDSource object.

Parameter

None.

Returns

This method returns the object type.

Exceptions

None.

Usage

None.

4.2.3 ORDSource Methods Associated with the connection Attribute

This section presents reference information on the ORDSource methods associated with the connection attribute.


setConnection( ) Method

Format

void setConnection(Connection the_connection)

Scope

package

Description

Sets the connection to the database.

Parameter

the_connection

The connection object.

Returns

None.

Exceptions

None.

Usage

None.


getConnection( ) Method

Format

Connection getConnection( )

Scope

package

Description

Gets the connection to the database.

Parameter

None.

Returns

This method returns the connection.

Exceptions

None.

Usage

None.

4.2.4 ORDSource Methods Associated with the lock Attribute

This section presents reference information on the ORDSource methods associated with the lock attribute.


setLock( ) Method

Format

void setLock(boolean lockOption)

Scope

package

Description

Sets the lock value.

A value of true means the corresponding object on the server side can be updated. A value of false means the corresponding object on the server side cannot be updated.

Parameter

lockOption

The lock value.

Returns

None.

Exceptions

None.

Usage

None.


isLocked( ) Method

Format

boolean isLocked( )

Scope

package

Description

Gets the lock value.

A value of true means the corresponding object on the server side cannot be updated. A value of false means the corresponding object on the server side cannot be updated.

Parameter

None.

Returns

This method returns the value of the lock.

Exceptions

None.

Usage

None.

4.2.5 ORDSource Methods Associated with the srcName, srcType, and srcLocation Attributes

This section presents reference information on the ORDSource methods associated with the srcName, srcType, and srcLocation attributes.


setSourceInformation( ) Method

Format

void setSourceInformation(String sourceType, String sourceLocation, 
                          String sourceName)

Scope

package

Description

Sets information about the client-side ORDSource object data source.

Parameters

sourceType

The source type.

sourceLocation

The source location.

sourceName

The source name.

Returns

None.

Exceptions

None.

Usage

None.


setSourceType( ) Method

Format

void SetSourceType(String sourceType)

Scope

package

Description

Sets the client-side ORDSource object source type.

Parameter

sourceType

The source type.

Returns

None.

Exceptions

None.

Usage

None.


setSourceLocation( ) Method

Format

void setSourceLocation(String sourceLocation)

Scope

package

Description

Sets the client-side ORDSource object source location.

Parameter

sourceLocation

The source location.

Returns

None.

Exceptions

None.

Usage

None.


setSourceName( ) Method

Format

void setSourceName(String sourceName)

Scope

package

Description

Sets the client-side ORDSource object source name.

Parameter

sourceName

The source name.

Returns

None.

Exceptions

None.

Usage

None.


getSourceInformation( ) Method

Format

String getSourceInformation( )

Scope

package

Description

Gets the client-side ORDSource object source information.

Parameter

None.

Returns

This method returns the source information in the following format: srcType://srcLocation/srcName.

Exceptions

None.

Usage

None.


getSourceType( ) Method

Format

String getSourceType( )

Scope

package

Description

Gets the client-side ORDSource object source type

Parameter

None.

Returns

This method returns the source type.

Exceptions

None.

Usage

None.


getSourceLocation( ) Method

Format

String getSourceLocation( )

Scope

package

Description

Gets the client-side ORDSource object source location.

Parameter

None.

Returns

This method returns the source location.

Exceptions

None.

Usage

None.


getSourceName( ) Method

Format

String getSourceName( )

Scope

package

Description

Gets the client-side ORDSource object source name.

Parameter

None.

Returns

This method returns the source name.

Exceptions

None.

Usage

None.

4.2.6 ORDSource Methods Associated with the updateTime Attribute

This section presents reference information on the ORDSource methods associated with the updateTime attribute.


setUpdateTime( ) Method

Format

void setUpdateTime( )
throws SQLException

Scope

package

Description

Sets the updated time of both the server-side and client-side ORDSource objects.

Parameter

None.

Returns

None.

Exceptions

java.sql.SQLException

Usage

None.


getUpdateTime( ) Method

Format

Timestamp getUpdateTime( )

Scope

package

Description

Gets the last updated time of the client-side ORDSource object.

Parameter

None.

Returns

This method returns the value of the last update time.

Exceptions

None.

Usage

None.

4.2.7 ORDSource Methods Associated with the local Attribute

This section presents reference information on the ORDSource methods associated with the local attribute.


setLocal( ) Method

Format

void setLocal( )

Scope

package

Description

Sets the client-side ORDSource local attribute to true, which indicates that the localData attribute is valid.

Parameter

None.

Returns

None.

Exceptions

None.

Usage

None.


isLocal( ) Method

Format

boolean isLocal( )

Scope

package

Description

Gets the client-side ORDSource object local attribute.

Parameter

None.

Returns

This method returns the value of the local variable.

Exceptions

None.

Usage

None.


clearLocal( ) Method

Format

void clearLocal( )

Scope

package

Description

Clears the client-side ORDSource object local attribute.

Parameter

None.

Returns

None.

Exceptions

None.

Usage

None.

4.2.8 ORDSource Methods Associated with Communication Between Client and Server

This section presents reference information on the ORDSource methods associated with communication between the client and the server.


refresh( ) Method

Format

void refresh(boolean forUpdate)
throws SQLException

Scope

package

Description

Sends information from the server-side object to the client-side object with or without locking the database row.

Parameter

forUpdate

The indicator for whether or not the option has been refreshed for update. A value of true indicates that the object has been refreshed for update; otherwise, the value is false.

Returns

None.

Exceptions

java.sql.SQLException

Usage

None.


flush( ) Method

Format

void flush( )
throws SQLException

Scope

package

Description

Copies the client-side object attribute values to the server-side object.

Parameter

None.

Returns

None.

Exceptions

java.sql.SQLException

Usage

None.


getUpdateStr( ) Method

Format

String getUpdateStr(String mmObjName, String srcObjName)

Scope

package

Description

Gets the update String in order to update the database object.

Parameters

mmObjName

The multimedia object variable.

srcObjName

The source object variable.

Returns

This method returns the SQL string to update an ORDSource instance.

Exceptions

None.

Usage

None.

4.2.9 ORDSource Methods Associated with the SQL Type

This section presents reference information on the ORDSource methods associated with the SQL type.


getSQLConstructor( ) Method

Format

String getSQLConstructor(boolean updateOption, String mmObjName,
                         String srcObjName)

Scope

package

Description

Gets the SQL type constructor for the ORDSource object.

Parameters

updateOption

A variable that specifies whether or not the lock is to be taken.

mmObjName

The multimedia object variable. It is set to ORDAudio, ORDImage, or ORDVideo.

srcObjName

The source object variable

Returns

This method returns the SQL string that will bind an object instance variable of ORDSource to a database ORDSource object instance.

Exceptions

None.

Usage

None.


defineSQLResults( ) Method

Format

String defineSQLResults(String var)

Scope

package

Description

Defines the SQL results that will be used to assign values to the ORDSource object attributes.

This method is used by the refresh( ) method to assign the server-side object attribute values to the corresponding server-side object attributes.

Parameter

var

The name of the source object variable.

Returns

This method returns the SQL string that will define the SQL results.

Exceptions

None.

Usage

None.


declareSQLResults( ) Method

Format

int declareSQLResults(int start, OracleCallableStatement stmt)
throws SQLException

Scope

package

Description

Declares the types for the SQL results corresponding to the different ORDSource object attributes.

This method is used by the refresh( ) method to declare the types of the client-side object attributes that are needed in order to assign values to the attributes corresponding to the server-side object attributes.

Parameters

start

The position in the statement where the binding begins.

stmt

The Oracle callable statement that will be executed on the server side.

Returns

This method returns an integer defined as position +1, where position is the last index in the statement for which the type was declared.

Exceptions

java.sql.SQLException

Usage

None.


setSQLParams( ) Method

Format

String setSQLParams(String var)

Scope

package

Description

Sets the values of the SQL type of the ORDSource object as parameters.

This method is used by the flush( ) method to set the values of the different attributes of the server-side object with the client-side attributes.

Parameter

var

The name of the source object variable.

Returns

This method returns the SQL string that will set the different attributes of the ORDSource object.

Exceptions

None.

Usage

None.


bindInSQLParams( ) Method

Format

int bindInSQLParams(int start, OracleCallableStatement stmt)
throws SQLException

Scope

package

Description

Binds the values of the SQL type of the ORDSource object.

This method is used by the flush( ) method to set the values of the different attributes of the server-side object with the client-side attributes.

Parameters

start

The position in the statement where the binding begins.

stmt

The Oracle callable statement that will be executed on the server side.

Returns

This method returns an integer defined as position + 1, where position is the last index in the statement to which a value was bound.

Exceptions

java.sql.SQLException

Usage

None.


getSQLResults( ) Method

Format

int getSQLResults(int start, OracleCallableStatement stmt)
throws SQLException

Scope

package

Description

Gets the SQL results to assign to the attributes of the ORDSource object (srcLocation or srcType, for example).

This method is used by the refresh( ) method to assign the server-side object attribute values to the corresponding client-side object attributes.

Parameters

start

The starting position for getting results from the statement.

stmt

The Oracle callable statement that has been executed on the server side.

Returns

This method returns the SQL string that will bind a client object attribute to the corresponding database object attribute.

Exceptions

java.sql.SQLException

Usage

None.

4.2.10 ORDSource Methods Associated with Access Operations

This section presents reference information on the ORDSource methods associated with access operations.


open( ) Method

Format

int open(byte[ ] userArg, byte[ ] ctx)
throws SQLException

Scope

package

Description

Opens the server-side ORDSource object source.

Parameter

userArg

Permission-related parameters that are supplied by the user, such as READONLY.

ctx

The source plug-in context information.

Returns

This method returns 0 in case of success or an integer greater than 0 in case of failure.

Exceptions

java.sql.SQLException

Usage

None.


close( ) Method

Format

int close(byte[ ] ctx)
throws SQLException

Scope

package

Description

Closes the server-side ORDSource object source.

Parameter

ctx

The source plug-in context information.

Returns

This method returns 0 in case of success or an integer greater than 0 in case of failure.

Exceptions

java.sql.SQLException

Usage

None.


trim( ) Method

Format

int trim(byte[ ] ctx, int newLen)
throws SQLException

Scope

package

Description

Trims the server-side ORDSource object source to a given length.

Parameters

ctx

The source plug-in context information.

newLen

The new length of the content after trimming.

Returns

This method returns 0 in case of success or an integer greater than 0 in case of failure.

Exceptions

java.sql.SQLException

Usage

None.

4.2.11 ORDSource Methods Associated with Content Read/Write Operations

This section presents reference information on the ORDSource methods associated with content read and write operations.


read( ) Method

Format

int read(byte[ ] ctx, int startPos, int numBytes, byte[ ] buffer)
throws SQLException

Scope

package

Description

Reads from the server-side ORDSource object localData attribute into the buffer.

Parameters

ctx

The source plug-in context information.

startPos

The initial reading position in the BLOB.

numBytes

The number of bytes to be read.

buffer

The buffer into which the value is to be read.

Returns

This method returns the number of bytes read, or -1 in case of failure.

Exceptions

java.sql.SQLException

Usage

None.


write( ) Method

Format

int write (byte[ ] ctx, int startPos, int numBytes, byte[ ] buffer)
throws SQLException

Scope

package

Description

Writes the buffer contents into the server-side ORDSource object localData attribute.

Parameters

ctx

The source plug-in context information.

startPos

The start position for writing in the BLOB.

numBytes

The number of bytes to be written.

buffer

The buffer from which the value is to be written into the localData attribute.

Returns

This method returns the number of bytes written, or -1 in case of failure.

Exceptions

java.sql.SQLException

Usage

None.

4.2.12 ORDSource Methods Associated with Import and Export Operations

This section presents reference information on the ORDSource methods associated with import and export operations.


importData( ) Method

Format

BLOB importData(byte[ ] ctx, BLOB dlob, StringBuffer mimetype,
                StringBuffer format)
throws SQLException

Scope

package

Description

Imports data into the server-side BLOB from the source information in the server-side ORDSource object.

Parameters

ctx

The source plug-in context information.

dlob

The LOB locator into which the data is to be imported.

mimetype

The MIME type of the data.

format

The format of the data.

Returns

This method returns the BLOB locator that contains the imported data.

Exceptions

java.sql.SQLException

Usage

None.


importFrom( ) Method

Format

BLOB importFrom(byte[ ] ctx, BLOB dlob, StringBuffer mimetype,
                StringBuffer format, String sourceType,
                String sourceLocation, String sourceName)
throws SQLException

Scope

package

Description

Imports data into the server-side BLOB from a data source specified by the parameters.

Parameters

ctx

The source plug-in context information.

dlob

The LOB locator into which the data is to be imported.

mimetype

The MIME type of the data.

format

The format of the data.

sourceType

The type of the source from which the data is imported.

sourceLocation

The location of the source from which the data is imported.

sourceName

The name of the source from which the data is imported.

Returns

This method returns the LOB locator that contains the imported data.

Exceptions

java.sql.SQLException

Usage

None.


export( ) Method

Format

void export(byte[ ] ctx, String sourceType, String sourceLocation,
            String sourceName)
throws SQLException

Scope

package

Description

Exports data from the server-side ORDSource object to an external source.

Parameters

ctx

The source plug-in context information.

sourceType

The type of the source into which the data will be exported.

sourceLocation

The location of the source into which the data will be exported.

sourceName

The name of the source into which the data will be exported.

Returns

None.

Exceptions

java.sql.SQLException

Usage

None.

4.2.13 ORDSource Methods Associated with Source Content Operations

This section presents reference information on the ORDSource methods associated with source content operations.


getContentLength( ) Method

Format

int getContentLength( )
throws SQLException

Scope

package

Description

Gets the content length of the server-side ORDSource object localData attribute.

Parameter

None.

Returns

This method returns the content length of the source data, in bytes.

Exceptions

java.sql.SQLException

Usage

None.


getSourceAddress( ) Method

Format

String getSourceAddress( )

Scope

package

Description

Returns the client-side ORDSource object source address.

Parameter

None.

Returns

This method returns the source address in the format
srcType://srcLocation/srcName.

Exceptions

None.

Usage

None.


getLocalContent( ) Method

Format

BLOB getLocalContent( )
throws SQLException

Scope

package

Description

Returns the server-side ORDSource object LOB locator and copies the server side LOB locator to the client side.

Parameter

None.

Returns

This method returns the LOB locator.

Exceptions

java.sql.SQLException

Usage

None.


getContentInTempLOB(byte[ ], BLOB, StringBuffer, StringBuffer) Method

Format

BLOB getContentInTempLob(byte[ ] ctx, BLOB blob, StringBuffer mimetype,
                         StringBuffer format)
throws SQLException

Scope

package

Description

Gets the server-side ORDSource object localData content in the temporary BLOB, using the default values of duration = 10 and cache = true.

Parameters

ctx

The source plug-in context information.

blob

The value of the temporary BLOB before the call.

mimetype

The MIME type of the data in the temporary BLOB.

format

The format of the data in the temporary BLOB.

Returns

This method returns the content of the temporary BLOB after the call.

Exceptions

java.sql.SQLException

Usage

None.


getContentInTempLOB(byte[ ], BLOB, StringBuffer, StringBuffer, int, boolean) Method

Format

BLOB getContentInTempLob(byte[ ] ctx, BLOB blob, StringBuffer mimetype, 
                         StringBuffer format, int duration, boolean cache)
throws SQLException

Scope

package

Description

Gets the server-side ORDSource object localData content in the temporary LOB.

Parameters

ctx

The source plug-in context information.

blob

The value of the temporary BLOB before the call.

mimetype

The MIME type of the data in the temporary BLOB.

format

The format of the data in the temporary BLOB.

duration

The duration of the call.

cache

The indicator of whether or not to use caching.

Returns

This method returns the content of the temporary BLOB after the call.

Exceptions

java.sql.SQLException

Usage

None.


deleteLocalContent( ) Method

Format

void deleteLocalContent( )
throws SQLException

Scope

package

Description

Deletes the contents of the server-side ORDSource object localData attribute.

Parameter

None.

Returns

None.

Exceptions

java.sql.SQLException

Usage

None.


getBFILE( ) Method

Format

BFILE getBFILE( )
throws SQLException

Scope

package

Description

Gets the server-side ORDSource object BFILE.

This method calls the server-side method getBFILE( ) in the ORDSource object.

Parameter

None.

Returns

This method returns the BFILE.

Exceptions

java.sql.SQLException

Usage

None.

4.2.14 ORDSource Methods Associated with Processing Commands to the External Source

This section presents reference information on the ORDSource methods associated with processing commands to the external source.


processCommand( ) Method

Format

byte[ ] processCommand(byte[ ] ctx, String command, String arglist, byte[ ] 
result)
throws SQLException

Scope

package

Description

Calls the server-side processCommand( ) method.

For more information on the commands that can be processed, see Oracle8i interMedia Audio, Image, and Video User's Guide and Reference.

Parameters

ctx

The source plug-in context information.

command

The command to be processed.

arglist

The argument list for the command to be processed.

result

The result of executing the command.

Returns

This method returns the result of executing the command.

Exceptions

java.sql.SQLException

Usage

None.




Prev

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index