org.firebirdsql.gds.impl.jni
Class JniGDSImpl

java.lang.Object
  extended by org.firebirdsql.gds.impl.AbstractGDS
      extended by org.firebirdsql.gds.impl.jni.BaseGDSImpl
          extended by org.firebirdsql.gds.impl.jni.JniGDSImpl
All Implemented Interfaces:
Externalizable, Serializable, GDS
Direct Known Subclasses:
EmbeddedGDSImpl, LocalGDSImpl, NativeGDSImpl

public abstract class JniGDSImpl
extends BaseGDSImpl

See Also:
Serialized Form

Field Summary
static String JAYBIRD_JNI_LIBRARY
          Name of the JNI library able to communicate with the client or embedded server library.
 
Fields inherited from class org.firebirdsql.gds.impl.jni.BaseGDSImpl
DESCRIBE_DATABASE_INFO_BLOCK, isc_api_handle
 
Constructor Summary
protected JniGDSImpl()
          Default constructor for subclasses only.
protected JniGDSImpl(GDSType gdsType)
          Create instance of this class.
 
Method Summary
protected  void attemptToLoadAClientLibraryFromList(String[] clientLibraryList)
          Attempts too load a Firebird client or embedded server library.
protected  void finalize()
           
protected static void initJNIBridge()
          Init the JNI bridge for this class.
 void native_isc_attach_database(byte[] file_name, IscDbHandle db_handle, byte[] dpbBytes)
           
 byte[] native_isc_blob_info(isc_blob_handle_impl handle, byte[] items, int buffer_length)
           
 void native_isc_cancel_events(IscDbHandle db_handle, EventHandleImp eventHandle)
           
 void native_isc_close_blob(IscBlobHandle blob)
           
 void native_isc_commit_retaining(IscTrHandle tr_handle)
           
 void native_isc_commit_transaction(IscTrHandle tr_handle)
           
 void native_isc_create_blob2(IscDbHandle db, IscTrHandle tr, IscBlobHandle blob, byte[] dpbBytes)
           
 void native_isc_create_database(byte[] file_name, IscDbHandle db_handle, byte[] dpbBytes)
           
 void native_isc_database_info(IscDbHandle db_handle, int item_length, byte[] items, int buffer_length, byte[] buffer)
           
 void native_isc_detach_database(IscDbHandle db_handle)
           
 void native_isc_drop_database(IscDbHandle db_handle)
           
 void native_isc_dsql_alloc_statement2(IscDbHandle db_handle, IscStmtHandle stmt_handle)
           
 void native_isc_dsql_allocate_statement(IscDbHandle db_handle, IscStmtHandle stmt_handle)
           
 XSQLDA native_isc_dsql_describe_bind(IscStmtHandle stmt_handle, int da_version)
           
 XSQLDA native_isc_dsql_describe(IscStmtHandle stmt_handle, int da_version)
           
 void native_isc_dsql_exec_immed2(IscDbHandle db_handle, IscTrHandle tr_handle, byte[] statement, int dialect, XSQLDA in_xsqlda, XSQLDA out_xsqlda)
           
 void native_isc_dsql_execute2(IscTrHandle tr_handle, IscStmtHandle stmt_handle, int da_version, XSQLDA in_xsqlda, XSQLDA out_xsqlda)
           
 boolean native_isc_dsql_fetch(IscStmtHandle stmt_handle, int da_version, XSQLDA xsqlda, int fetchSize)
           
 void native_isc_dsql_free_statement(IscStmtHandle stmt_handle, int option)
           
 XSQLDA native_isc_dsql_prepare(IscTrHandle tr_handle, IscStmtHandle stmt_handle, byte[] statement, int dialect)
           
 void native_isc_dsql_set_cursor_name(IscStmtHandle stmt_handle, String cursor_name, int type)
           
 byte[] native_isc_dsql_sql_info(IscStmtHandle stmt_handle, byte[] items, int buffer_length)
           
 long native_isc_event_block(EventHandleImp eventHandle, String eventName)
           
 void native_isc_event_counts(EventHandleImp eventHandle)
           
protected  void native_isc_finalize(int isc_api_handle)
           
 byte[] native_isc_get_segment(IscBlobHandle blob, int maxread)
           
 void native_isc_open_blob2(IscDbHandle db, IscTrHandle tr, IscBlobHandle blob, byte[] dpbBytes)
           
 void native_isc_prepare_transaction(IscTrHandle tr_handle)
           
 void native_isc_prepare_transaction2(IscTrHandle tr_handle, byte[] bytes)
           
 void native_isc_put_segment(IscBlobHandle blob_handle, byte[] buffer)
           
 int native_isc_que_events(IscDbHandle db_handle, EventHandleImp eventHandle, EventHandler handler)
           
 void native_isc_reconnect_transaction(IscDbHandle dbHandle, IscTrHandle tr_handle, byte[] txId)
           
 void native_isc_rollback_retaining(IscTrHandle tr_handle)
           
 void native_isc_rollback_transaction(IscTrHandle tr_handle)
           
 void native_isc_seek_blob(isc_blob_handle_impl handle, int position, int mode)
           
 void native_isc_service_attach(String service, IscSvcHandle serviceHandle, byte[] serviceParameterBuffer)
           
 void native_isc_service_detach(IscSvcHandle serviceHandle)
           
 void native_isc_service_query(IscSvcHandle serviceHandle, byte[] sendServiceParameterBuffer, byte[] requestServiceParameterBuffer, byte[] resultBuffer)
           
 void native_isc_service_start(IscSvcHandle serviceHandle, byte[] serviceParameterBuffer)
           
 void native_isc_start_transaction(IscTrHandle tr_handle, IscDbHandle db_handle, byte[] tpb)
           
 byte[] native_isc_transaction_info(IscTrHandle tr_handle, byte[] info, int bufferLength)
           
 void nativeInitilize(String sharedLibraryName)
          Attempt to load a specified library.
 
Methods inherited from class org.firebirdsql.gds.impl.jni.BaseGDSImpl
createBlobParameterBuffer, createDatabaseParameterBuffer, createEventHandle, createIscBlobHandle, createIscDbHandle, createIscStmtHandle, createIscSvcHandle, createIscTrHandle, createServiceParameterBuffer, createServiceRequestBuffer, getByteArrayForString, getServerUrl, getSqlCounts, getZeroTerminatedArray, iscAttachDatabase, iscBlobInfo, iscCancelEvents, iscCloseBlob, iscCommitRetaining, iscCommitTransaction, iscCreateBlob2, iscCreateDatabase, iscDatabaseInfo, iscDetachDatabase, iscDropDatabase, iscDsqlAllocateStatement, iscDsqlDescribe, iscDsqlDescribeBind, iscDsqlExecImmed2, iscDsqlExecImmed2, iscDsqlExecImmed2, iscDsqlExecute, iscDsqlExecute2, iscDsqlExecuteImmediate, iscDsqlExecuteImmediate, iscDsqlExecuteImmediate, iscDsqlFetch, iscDsqlFreeStatement, iscDsqlPrepare, iscDsqlPrepare, iscDsqlPrepare, iscDsqlSetCursorName, iscDsqlSqlInfo, iscEventBlock, iscEventCounts, iscExpandDpb, iscGetSegment, iscOpenBlob2, iscPrepareTransaction, iscPrepareTransaction2, iscPutSegment, iscQueueEvents, iscReconnectTransaction, iscRollbackRetaining, iscRollbackTransaction, iscSeekBlob, iscServiceAttach, iscServiceDetach, iscServiceQuery, iscServiceStart, iscStartTransaction, iscTransactionInformation, iscVaxInteger, iscVaxInteger2, newTransactionParameterBuffer, readSQLData
 
Methods inherited from class org.firebirdsql.gds.impl.AbstractGDS
close, getGdsType, getType, readExternal, readResolve, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAYBIRD_JNI_LIBRARY

public static final String JAYBIRD_JNI_LIBRARY
Name of the JNI library able to communicate with the client or embedded server library.

See Also:
Constant Field Values
Constructor Detail

JniGDSImpl

protected JniGDSImpl(GDSType gdsType)
Create instance of this class. This constructor attempts to load Jaybird JNI library. Subclasses are responsible for initializing JNI layer by calling nativeInitilize(String) method.

Parameters:
gdsType - type of GDS module being created.

JniGDSImpl

protected JniGDSImpl()
Default constructor for subclasses only. If subclass uses this constructor, it must ensure that correct type is returned from AbstractGDS.getType() method.

Method Detail

initJNIBridge

protected static void initJNIBridge()
                             throws UnsatisfiedLinkError
Init the JNI bridge for this class.

Throws:
UnsatisfiedLinkError - if JNI bridge cannot be initialized.

attemptToLoadAClientLibraryFromList

protected void attemptToLoadAClientLibraryFromList(String[] clientLibraryList)
Attempts too load a Firebird client or embedded server library. Method tries all specified libraries one by one, and when the nativeInitilize(String) method does not throw an exception, it assumes that initialization was successful.

Parameters:
clientLibraryList - list of library names including file extension that will be tried.

nativeInitilize

public void nativeInitilize(String sharedLibraryName)
Attempt to load a specified library. JNI layer tries to load the specified library and to resolve the needed entry points. If this fails, and exception is thrown (instance of java.lang.Throwable). If no exception was thrown, we assume that initialization succeeded.

Parameters:
sharedLibraryName - name of the shared library including file extension.

native_isc_attach_database

public void native_isc_attach_database(byte[] file_name,
                                       IscDbHandle db_handle,
                                       byte[] dpbBytes)
Specified by:
native_isc_attach_database in class BaseGDSImpl

native_isc_blob_info

public byte[] native_isc_blob_info(isc_blob_handle_impl handle,
                                   byte[] items,
                                   int buffer_length)
                            throws GDSException
Specified by:
native_isc_blob_info in class BaseGDSImpl
Throws:
GDSException

native_isc_close_blob

public void native_isc_close_blob(IscBlobHandle blob)
                           throws GDSException
Specified by:
native_isc_close_blob in class BaseGDSImpl
Throws:
GDSException

native_isc_commit_retaining

public void native_isc_commit_retaining(IscTrHandle tr_handle)
                                 throws GDSException
Specified by:
native_isc_commit_retaining in class BaseGDSImpl
Throws:
GDSException

native_isc_commit_transaction

public void native_isc_commit_transaction(IscTrHandle tr_handle)
                                   throws GDSException
Specified by:
native_isc_commit_transaction in class BaseGDSImpl
Throws:
GDSException

native_isc_create_blob2

public void native_isc_create_blob2(IscDbHandle db,
                                    IscTrHandle tr,
                                    IscBlobHandle blob,
                                    byte[] dpbBytes)
Specified by:
native_isc_create_blob2 in class BaseGDSImpl

native_isc_create_database

public void native_isc_create_database(byte[] file_name,
                                       IscDbHandle db_handle,
                                       byte[] dpbBytes)
Specified by:
native_isc_create_database in class BaseGDSImpl

native_isc_database_info

public void native_isc_database_info(IscDbHandle db_handle,
                                     int item_length,
                                     byte[] items,
                                     int buffer_length,
                                     byte[] buffer)
                              throws GDSException
Specified by:
native_isc_database_info in class BaseGDSImpl
Throws:
GDSException

native_isc_detach_database

public void native_isc_detach_database(IscDbHandle db_handle)
                                throws GDSException
Specified by:
native_isc_detach_database in class BaseGDSImpl
Throws:
GDSException

native_isc_drop_database

public void native_isc_drop_database(IscDbHandle db_handle)
                              throws GDSException
Specified by:
native_isc_drop_database in class BaseGDSImpl
Throws:
GDSException

native_isc_dsql_alloc_statement2

public void native_isc_dsql_alloc_statement2(IscDbHandle db_handle,
                                             IscStmtHandle stmt_handle)
                                      throws GDSException
Specified by:
native_isc_dsql_alloc_statement2 in class BaseGDSImpl
Throws:
GDSException

native_isc_dsql_allocate_statement

public void native_isc_dsql_allocate_statement(IscDbHandle db_handle,
                                               IscStmtHandle stmt_handle)
                                        throws GDSException
Specified by:
native_isc_dsql_allocate_statement in class BaseGDSImpl
Throws:
GDSException

native_isc_dsql_describe

public XSQLDA native_isc_dsql_describe(IscStmtHandle stmt_handle,
                                       int da_version)
                                throws GDSException
Specified by:
native_isc_dsql_describe in class BaseGDSImpl
Throws:
GDSException

native_isc_dsql_describe_bind

public XSQLDA native_isc_dsql_describe_bind(IscStmtHandle stmt_handle,
                                            int da_version)
                                     throws GDSException
Specified by:
native_isc_dsql_describe_bind in class BaseGDSImpl
Throws:
GDSException

native_isc_dsql_exec_immed2

public void native_isc_dsql_exec_immed2(IscDbHandle db_handle,
                                        IscTrHandle tr_handle,
                                        byte[] statement,
                                        int dialect,
                                        XSQLDA in_xsqlda,
                                        XSQLDA out_xsqlda)
                                 throws GDSException
Specified by:
native_isc_dsql_exec_immed2 in class BaseGDSImpl
Throws:
GDSException

native_isc_dsql_execute2

public void native_isc_dsql_execute2(IscTrHandle tr_handle,
                                     IscStmtHandle stmt_handle,
                                     int da_version,
                                     XSQLDA in_xsqlda,
                                     XSQLDA out_xsqlda)
                              throws GDSException
Specified by:
native_isc_dsql_execute2 in class BaseGDSImpl
Throws:
GDSException

native_isc_dsql_fetch

public boolean native_isc_dsql_fetch(IscStmtHandle stmt_handle,
                                     int da_version,
                                     XSQLDA xsqlda,
                                     int fetchSize)
                              throws GDSException
Specified by:
native_isc_dsql_fetch in class BaseGDSImpl
Throws:
GDSException

native_isc_dsql_free_statement

public void native_isc_dsql_free_statement(IscStmtHandle stmt_handle,
                                           int option)
                                    throws GDSException
Specified by:
native_isc_dsql_free_statement in class BaseGDSImpl
Throws:
GDSException

native_isc_dsql_prepare

public XSQLDA native_isc_dsql_prepare(IscTrHandle tr_handle,
                                      IscStmtHandle stmt_handle,
                                      byte[] statement,
                                      int dialect)
                               throws GDSException
Specified by:
native_isc_dsql_prepare in class BaseGDSImpl
Throws:
GDSException

native_isc_dsql_set_cursor_name

public void native_isc_dsql_set_cursor_name(IscStmtHandle stmt_handle,
                                            String cursor_name,
                                            int type)
                                     throws GDSException
Specified by:
native_isc_dsql_set_cursor_name in class BaseGDSImpl
Throws:
GDSException

native_isc_dsql_sql_info

public byte[] native_isc_dsql_sql_info(IscStmtHandle stmt_handle,
                                       byte[] items,
                                       int buffer_length)
                                throws GDSException
Specified by:
native_isc_dsql_sql_info in class BaseGDSImpl
Throws:
GDSException

native_isc_get_segment

public byte[] native_isc_get_segment(IscBlobHandle blob,
                                     int maxread)
                              throws GDSException
Specified by:
native_isc_get_segment in class BaseGDSImpl
Throws:
GDSException

native_isc_open_blob2

public void native_isc_open_blob2(IscDbHandle db,
                                  IscTrHandle tr,
                                  IscBlobHandle blob,
                                  byte[] dpbBytes)
Specified by:
native_isc_open_blob2 in class BaseGDSImpl

native_isc_prepare_transaction

public void native_isc_prepare_transaction(IscTrHandle tr_handle)
                                    throws GDSException
Specified by:
native_isc_prepare_transaction in class BaseGDSImpl
Throws:
GDSException

native_isc_prepare_transaction2

public void native_isc_prepare_transaction2(IscTrHandle tr_handle,
                                            byte[] bytes)
                                     throws GDSException
Specified by:
native_isc_prepare_transaction2 in class BaseGDSImpl
Throws:
GDSException

native_isc_put_segment

public void native_isc_put_segment(IscBlobHandle blob_handle,
                                   byte[] buffer)
                            throws GDSException
Specified by:
native_isc_put_segment in class BaseGDSImpl
Throws:
GDSException

native_isc_rollback_retaining

public void native_isc_rollback_retaining(IscTrHandle tr_handle)
                                   throws GDSException
Specified by:
native_isc_rollback_retaining in class BaseGDSImpl
Throws:
GDSException

native_isc_rollback_transaction

public void native_isc_rollback_transaction(IscTrHandle tr_handle)
                                     throws GDSException
Specified by:
native_isc_rollback_transaction in class BaseGDSImpl
Throws:
GDSException

native_isc_seek_blob

public void native_isc_seek_blob(isc_blob_handle_impl handle,
                                 int position,
                                 int mode)
                          throws GDSException
Specified by:
native_isc_seek_blob in class BaseGDSImpl
Throws:
GDSException

native_isc_service_attach

public void native_isc_service_attach(String service,
                                      IscSvcHandle serviceHandle,
                                      byte[] serviceParameterBuffer)
                               throws GDSException
Specified by:
native_isc_service_attach in class BaseGDSImpl
Throws:
GDSException

native_isc_service_detach

public void native_isc_service_detach(IscSvcHandle serviceHandle)
                               throws GDSException
Specified by:
native_isc_service_detach in class BaseGDSImpl
Throws:
GDSException

native_isc_service_query

public void native_isc_service_query(IscSvcHandle serviceHandle,
                                     byte[] sendServiceParameterBuffer,
                                     byte[] requestServiceParameterBuffer,
                                     byte[] resultBuffer)
                              throws GDSException
Specified by:
native_isc_service_query in class BaseGDSImpl
Throws:
GDSException

native_isc_service_start

public void native_isc_service_start(IscSvcHandle serviceHandle,
                                     byte[] serviceParameterBuffer)
                              throws GDSException
Specified by:
native_isc_service_start in class BaseGDSImpl
Throws:
GDSException

native_isc_start_transaction

public void native_isc_start_transaction(IscTrHandle tr_handle,
                                         IscDbHandle db_handle,
                                         byte[] tpb)
                                  throws GDSException
Specified by:
native_isc_start_transaction in class BaseGDSImpl
Throws:
GDSException

native_isc_reconnect_transaction

public void native_isc_reconnect_transaction(IscDbHandle dbHandle,
                                             IscTrHandle tr_handle,
                                             byte[] txId)
                                      throws GDSException
Specified by:
native_isc_reconnect_transaction in class BaseGDSImpl
Throws:
GDSException

native_isc_transaction_info

public byte[] native_isc_transaction_info(IscTrHandle tr_handle,
                                          byte[] info,
                                          int bufferLength)
                                   throws GDSException
Specified by:
native_isc_transaction_info in class BaseGDSImpl
Throws:
GDSException

native_isc_que_events

public int native_isc_que_events(IscDbHandle db_handle,
                                 EventHandleImp eventHandle,
                                 EventHandler handler)
                          throws GDSException
Specified by:
native_isc_que_events in class BaseGDSImpl
Throws:
GDSException

native_isc_event_block

public long native_isc_event_block(EventHandleImp eventHandle,
                                   String eventName)
                            throws GDSException
Specified by:
native_isc_event_block in class BaseGDSImpl
Throws:
GDSException

native_isc_event_counts

public void native_isc_event_counts(EventHandleImp eventHandle)
                             throws GDSException
Specified by:
native_isc_event_counts in class BaseGDSImpl
Throws:
GDSException

native_isc_cancel_events

public void native_isc_cancel_events(IscDbHandle db_handle,
                                     EventHandleImp eventHandle)
                              throws GDSException
Specified by:
native_isc_cancel_events in class BaseGDSImpl
Throws:
GDSException

native_isc_finalize

protected void native_isc_finalize(int isc_api_handle)
                            throws GDSException
Throws:
GDSException

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 2001-2010. All Rights Reserved.