javaextensions/iapinfo/javasrc.s60/com/nokia/mid/iapinfo/CommsTable.java
changeset 69 773449708c84
parent 21 2a9601315dfc
child 66 2455ef1f5bbc
--- a/javaextensions/iapinfo/javasrc.s60/com/nokia/mid/iapinfo/CommsTable.java	Wed Aug 18 09:43:15 2010 +0300
+++ b/javaextensions/iapinfo/javasrc.s60/com/nokia/mid/iapinfo/CommsTable.java	Thu Sep 02 20:20:40 2010 +0300
@@ -19,6 +19,7 @@
 
 import com.nokia.mj.impl.rt.support.Finalizer;
 import com.nokia.mj.impl.gcf.utils.NativeError;
+import com.nokia.mj.impl.utils.Logger;
 
 //import com.nokia.mj.impl.vmport.VmPort;
 
@@ -131,13 +132,6 @@
 
         iTableName = tableName;
 
-        // create native peer
-        iHandle = _construct();
-        if (iHandle < NativeError.KErrNone)
-        {
-            throw new CommDBException("Native constructor failed!", ERROR_NONE,
-                                      iHandle);
-        }
         // we need this so we can do some cleanup when we are garbage collected
         iFinalizer = createFinalizer();
         state = CREATED;
@@ -146,18 +140,20 @@
     /**
      * Opens the corresponding CommDB table.
      */
-    public void open() throws CommDBException
+    public void open(int aNativeSessionHandle) throws CommDBException
     {
 
-        int err = _open(iHandle, iTableName);
-        if (NativeError.KErrNone == err)
+        iHandle = _open(aNativeSessionHandle, iTableName);
+        Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo, "iHandle ="+iHandle);
+
+        if (iHandle > 0)
         {
             state = OPENED;
             readFieldValues();
         }
         else
         {
-            throw new CommDBException("Open failed!", ERROR_OPEN_FAILED, err);
+            throw new CommDBException("Open failed!", ERROR_OPEN_FAILED, iHandle);
         }
 
     }
@@ -185,6 +181,7 @@
     {
 
         int rec = 0;
+
         rec = _findByName(iHandle, recordName);
         if (rec >= 0)
         {
@@ -230,6 +227,7 @@
      */
     public int getRecordCount() throws CommDBException
     {
+        Logger.LOG(Logger.EJavaIapInfo,Logger.EInfo,"+getRecordCount()");
         return _getRecordCount(iHandle);
     }
 
@@ -326,13 +324,6 @@
     /* Native funcions */
     /*----------------------------------------------------------------*/
     /*
-     * Creates native peer.
-     *
-     * @return handle for native peer
-     */
-    private static native int _construct();
-
-    /*
      * Destructs native peer.
      *
      * @param aHandle - handle for native peer
@@ -346,7 +337,7 @@
      *
      * @return - error code
      */
-    private static native int _open(int aHandle, String tableName);
+    private static native int _open(int aSessionHandle, String tableName);
 
     /*
      * Close the actual CommDB table.