javaextensions/location/landmarks/src/landmarkstore.cpp
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  JNI implementation of LandmarkStore class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // INTERNAL INCLUDES
       
    20 #include "javax_microedition_location_LandmarkStore.h"
       
    21 #include "logger.h"
       
    22 #include "jstringutils.h"
       
    23 #include "lapijnicommon.h"
       
    24 #include "clapilandmark.h"
       
    25 #include "clapilandmarkstore.h"
       
    26 #include "mlapicategorymanager.h"
       
    27 #include "tlapisearchcriteria.h"
       
    28 #include "lapipanics.h"
       
    29 #include "locationfunctionserver.h"
       
    30 
       
    31 using namespace java::location;
       
    32 
       
    33 LOCAL_C void AddLandmarkL(CLAPILandmarkStore* aLandmarkStore,
       
    34                           CLAPILandmark* aLandmark, const TDesC* aCategory)
       
    35 {
       
    36     JELOG2(EJavaLocation);
       
    37     MLAPICategoryManager* categoryManager = aLandmarkStore->CategoryManagerL();
       
    38     // Category argument can be null
       
    39     if (aCategory && categoryManager)
       
    40     {
       
    41         TRAPD(err, categoryManager->AddLandmarkToCategoryL(*aLandmark,
       
    42                 *aCategory));
       
    43         // The landmark was not found from the store. Add new
       
    44         if (err == KErrNotFound)
       
    45         {
       
    46             aLandmarkStore->AddLandmarkL(*aLandmark);
       
    47             categoryManager->AddLandmarkToCategoryL(*aLandmark, *aCategory);
       
    48             err = KErrNone;
       
    49         }
       
    50         // Leave if some other error occured
       
    51         User::LeaveIfError(err);
       
    52     }
       
    53     else
       
    54     {
       
    55         // No category information. Add a new landmark
       
    56         aLandmarkStore->AddLandmarkL(*aLandmark);
       
    57     }
       
    58 
       
    59 }
       
    60 
       
    61 /*
       
    62  * Class:     javax_microedition_location_LandmarkStore
       
    63  * Method:    _addLandmark
       
    64  * Signature: (III)I
       
    65  */
       
    66 JNIEXPORT jint
       
    67 JNICALL Java_javax_microedition_location_LandmarkStore__1addLandmark(
       
    68     JNIEnv* aJniEnv,
       
    69     jobject /*aPeer*/,
       
    70     jint aEventSourceHandle,
       
    71     jint aStoreHandle,
       
    72     jint aLandmarkHandle,
       
    73     jstring aCategory)
       
    74 {
       
    75     JELOG2(EJavaLocation);
       
    76 
       
    77     LocationFunctionServer* eventSource =
       
    78         reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
       
    79     CLAPILandmarkStore* landmarkStore =
       
    80         reinterpret_cast< CLAPILandmarkStore*>(aStoreHandle);
       
    81     CLAPILandmark* landmark =
       
    82         reinterpret_cast< CLAPILandmark*>(aLandmarkHandle);
       
    83 
       
    84     const JStringUtils category(*aJniEnv, aCategory);
       
    85     const TDesC* categoryArg = (aCategory ? &category : NULL);
       
    86 
       
    87     TInt error = eventSource->ExecuteTrap(
       
    88                      AddLandmarkL,
       
    89                      landmarkStore,
       
    90                      landmark,
       
    91                      categoryArg);
       
    92 
       
    93     LOG1(EJavaLocation,EInfo, "Java_javax_microedition_location_LandmarkStore__1addLandmark - error %d", error);
       
    94 
       
    95     return error;
       
    96 }
       
    97 
       
    98 LOCAL_C void LandmarksL(JNIEnv* aJniEnv, CLAPILandmarkStore* aLandmarkStore,
       
    99                         TUint* aAttributes, TLAPISearchCriteria* aSearchCriteria,
       
   100                         jintArray* aLandmarkHandles)
       
   101 {
       
   102     JELOG2(EJavaLocation);
       
   103 
       
   104     // Get items using the specified search criteria
       
   105     CArrayPtr<CLAPILandmark>* landmarks = aLandmarkStore->LandmarksL(
       
   106                                               *aAttributes, aSearchCriteria);
       
   107     // No need to push the array to the cleanup stack since it is
       
   108     // used from non-leaving context
       
   109     *aLandmarkHandles = CreateHandleArray(*aJniEnv, *landmarks);
       
   110     // Reset the items since the ownership is transferred to Java side
       
   111     landmarks->Reset();
       
   112     // Delete the empty array
       
   113     delete landmarks;
       
   114     // Leave if the result array is null
       
   115     __ASSERT_ALWAYS(aLandmarkHandles, User::Leave(KErrNoMemory));
       
   116 }
       
   117 
       
   118 /*
       
   119  * Class:     javax_microedition_location_LandmarkStore
       
   120  * Method:    _getLandmarks
       
   121  * Signature: (II[I)[I
       
   122  */
       
   123 JNIEXPORT jintArray
       
   124 JNICALL Java_javax_microedition_location_LandmarkStore__1getLandmarks(
       
   125     JNIEnv* aJniEnv,
       
   126     jobject /*aPeer*/,
       
   127     jint aEventSourceHandle,
       
   128     jint aStoreHandle,
       
   129     jintArray aError)
       
   130 {
       
   131     JELOG2(EJavaLocation);
       
   132 
       
   133     LocationFunctionServer* eventSource =
       
   134         reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
       
   135     CLAPILandmarkStore* landmarkStore =
       
   136         reinterpret_cast< CLAPILandmarkStore*>(aStoreHandle);
       
   137 
       
   138     // VM will own the result array
       
   139     jintArray handles(NULL);
       
   140     // Criteria is null so all landmark should be returned
       
   141     TLAPISearchCriteria* criteria(NULL);
       
   142     // Initialize only the name from each landmark
       
   143     TUint initializedAttributes = ELAPILmAttrName;
       
   144 
       
   145     TInt error = eventSource->ExecuteTrap(
       
   146                      LandmarksL,
       
   147                      eventSource->getValidJniEnv(),
       
   148                      landmarkStore,
       
   149                      &initializedAttributes,
       
   150                      criteria,
       
   151                      &handles);
       
   152 
       
   153     LOG1(EJavaLocation,EInfo, "Java_javax_microedition_location_LandmarkStore__1getLandmarks - error %d", error);
       
   154 
       
   155     // Set error code if LandmarksL leaved. KErrNone if successful
       
   156     SetJavaErrorCode(*aJniEnv, aError, error);
       
   157     return handles; // NULL indicates an error
       
   158 }
       
   159 
       
   160 /*
       
   161  * Class:     javax_microedition_location_LandmarkStore
       
   162  * Method:    _getLandmarksFromCategory
       
   163  * Signature: (IILjava/lang/String;Ljava/lang/String;[I)[I
       
   164  */
       
   165 JNIEXPORT jintArray
       
   166 JNICALL Java_javax_microedition_location_LandmarkStore__1getLandmarksFromCategory(
       
   167     JNIEnv* aJniEnv,
       
   168     jobject /*aPeer*/,
       
   169     jint aEventSourceHandle,
       
   170     jint aStoreHandle,
       
   171     jstring aCategory,
       
   172     jstring aName,
       
   173     jintArray aError)
       
   174 {
       
   175     JELOG2(EJavaLocation);
       
   176 
       
   177     LocationFunctionServer* eventSource =
       
   178         reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
       
   179     CLAPILandmarkStore* landmarkStore =
       
   180         reinterpret_cast< CLAPILandmarkStore*>(aStoreHandle);
       
   181 
       
   182     // VM will own the result array
       
   183     jintArray handles(NULL);
       
   184     // Resolve name argument. NULL indicates a wild card
       
   185     const JStringUtils name(*aJniEnv, aName);
       
   186     const TDesC* nameArg = (aName ? &name : NULL);
       
   187     // Resolve category argument. NULL indicates a wild card
       
   188     const JStringUtils category(*aJniEnv, aCategory);
       
   189     const TDesC* categoryArg = (aCategory ? &category : NULL);
       
   190 
       
   191     TLAPISearchCriteria criteria;
       
   192     criteria.SetCategoryName(categoryArg);
       
   193     criteria.SetText(nameArg);
       
   194     criteria.SetTextAttributes(ELAPILmAttrName);
       
   195 
       
   196     // Initialize name information to each item. Category information
       
   197     // cannot be currently obtained using the Java landmark so there
       
   198     // is no need to initialize it
       
   199     TUint initializedAttributes = ELAPILmAttrName;
       
   200 
       
   201     TInt error = eventSource->ExecuteTrap(
       
   202                      LandmarksL,
       
   203                      eventSource->getValidJniEnv(),
       
   204                      landmarkStore,
       
   205                      &initializedAttributes,
       
   206                      &criteria,
       
   207                      &handles);
       
   208 
       
   209     LOG1(EJavaLocation,EInfo, "Java_javax_microedition_location_LandmarkStore__1getLandmarksFromCategory - error %d", error);
       
   210 
       
   211     // Set error code if LandmarksL leaved. KErrNone if successful. Invalid search
       
   212     // arguments will return null result with no errors
       
   213     error = error == KErrArgument ? KErrNone : error;
       
   214     SetJavaErrorCode(*aJniEnv, aError, error);
       
   215     return handles; // NULL indicates an error
       
   216 }
       
   217 
       
   218 /*
       
   219  * Class:     javax_microedition_location_LandmarkStore
       
   220  * Method:    _getLandmarksFromArea
       
   221  * Signature: (IILjava/lang/String;DDDD[I)[I
       
   222  */
       
   223 JNIEXPORT jintArray
       
   224 JNICALL Java_javax_microedition_location_LandmarkStore__1getLandmarksFromArea(
       
   225     JNIEnv* aJniEnv,
       
   226     jobject /*aPeer*/,
       
   227     jint aEventSourceHandle,
       
   228     jint aStoreHandle,
       
   229     jstring aCategory,
       
   230     jdouble aMinLatitude,
       
   231     jdouble aMaxLatitude,
       
   232     jdouble aMinLongitude,
       
   233     jdouble aMaxLongitude,
       
   234     jintArray aError)
       
   235 {
       
   236     JELOG2(EJavaLocation);
       
   237 
       
   238     LocationFunctionServer* eventSource =
       
   239         reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
       
   240     CLAPILandmarkStore* landmarkStore =
       
   241         reinterpret_cast< CLAPILandmarkStore*>(aStoreHandle);
       
   242 
       
   243     // VM will own the result array
       
   244     jintArray handles(NULL);
       
   245     const JStringUtils category(*aJniEnv, aCategory);
       
   246     const TDesC* categoryArg = (aCategory ? &category : NULL);
       
   247 
       
   248     TLAPISearchCriteria criteria;
       
   249     criteria.SetCategoryName(categoryArg);
       
   250     criteria.SetArea(aMinLatitude, aMaxLatitude, aMinLongitude, aMaxLongitude);
       
   251 
       
   252     // Initialize name and position to each item. Category information
       
   253     // cannot be currently obtained using the Java landmark so there
       
   254     // is no need to initialize it
       
   255     TUint initializedAttributes = ELAPILmAttrName | ELAPILmAttrPosition;
       
   256 
       
   257     TInt error = eventSource->ExecuteTrap(
       
   258                      LandmarksL,
       
   259                      eventSource->getValidJniEnv(),
       
   260                      landmarkStore,
       
   261                      &initializedAttributes,
       
   262                      &criteria,
       
   263                      &handles);
       
   264 
       
   265     LOG1(EJavaLocation,EInfo, "Java_javax_microedition_location_LandmarkStore__1getLandmarksFromArea - error %d", error);
       
   266 
       
   267     // Set error code if LandmarksL leaved. KErrNone if successful. Invalid search
       
   268     // arguments will return null result with no errors
       
   269     error = error == KErrArgument ? KErrNone : error;
       
   270     SetJavaErrorCode(*aJniEnv, aError, error);
       
   271     return handles; // NULL indicates an error
       
   272 }
       
   273 
       
   274 LOCAL_C void RemoveLandmarkFromCategoryL(CLAPILandmarkStore* aLandmarkStore,
       
   275         CLAPILandmark* aLandmark, const TDesC* aCategoryName)
       
   276 {
       
   277     JELOG2(EJavaLocation);
       
   278     __ASSERT_DEBUG(aCategoryName, LAPIError::Panic(ELAPIPanicNullArgument));
       
   279     MLAPICategoryManager* categoryManager = aLandmarkStore->CategoryManagerL();
       
   280     if (categoryManager)
       
   281     {
       
   282         // Remove the landmark from the category if it is possible
       
   283         categoryManager->RemoveLandmarkFromCategoryL(*aLandmark, *aCategoryName);
       
   284     }
       
   285 }
       
   286 
       
   287 /*
       
   288  * Class:     javax_microedition_location_LandmarkStore
       
   289  * Method:    _removeLandmarkFromCategory
       
   290  * Signature: (IIILjava/lang/String;)I
       
   291  */
       
   292 JNIEXPORT jint JNICALL
       
   293 Java_javax_microedition_location_LandmarkStore__1removeLandmarkFromCategory(
       
   294     JNIEnv* aJniEnv,
       
   295     jobject /*aPeer*/,
       
   296     jint aEventSourceHandle,
       
   297     jint aStoreHandle,
       
   298     jint aLandmarkHandle,
       
   299     jstring aCategory)
       
   300 {
       
   301     JELOG2(EJavaLocation);
       
   302 
       
   303     LocationFunctionServer* eventSource =
       
   304         reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
       
   305     CLAPILandmarkStore* landmarkStore =
       
   306         reinterpret_cast< CLAPILandmarkStore*>(aStoreHandle);
       
   307     CLAPILandmark* landmark =
       
   308         reinterpret_cast< CLAPILandmark*>(aLandmarkHandle);
       
   309 
       
   310     const JStringUtils category(*aJniEnv, aCategory);
       
   311 
       
   312     TInt error = eventSource->ExecuteTrap(
       
   313                      RemoveLandmarkFromCategoryL,
       
   314                      landmarkStore,
       
   315                      landmark,
       
   316                      static_cast< const TDesC*>(&category));
       
   317 
       
   318     return error;
       
   319 }
       
   320 
       
   321 LOCAL_C void UpdateLandmarkL(CLAPILandmarkStore* aLandmarkStore,
       
   322                              CLAPILandmark* aLandmark)
       
   323 {
       
   324     aLandmarkStore->UpdateLandmarkL(*aLandmark);
       
   325 }
       
   326 
       
   327 /*
       
   328  * Class:     javax_microedition_location_LandmarkStore
       
   329  * Method:    _updateLandmark
       
   330  * Signature: (III)I
       
   331  */
       
   332 JNIEXPORT jint
       
   333 JNICALL Java_javax_microedition_location_LandmarkStore__1updateLandmark(
       
   334     JNIEnv* /*aJniEnv*/,
       
   335     jobject /*aPeer*/,
       
   336     jint aEventSourceHandle,
       
   337     jint aStoreHandle,
       
   338     jint aLandmarkHandle)
       
   339 {
       
   340     JELOG2(EJavaLocation);
       
   341 
       
   342     LocationFunctionServer* eventSource =
       
   343         reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
       
   344     CLAPILandmarkStore* landmarkStore =
       
   345         reinterpret_cast< CLAPILandmarkStore*>(aStoreHandle);
       
   346     CLAPILandmark* landmark =
       
   347         reinterpret_cast< CLAPILandmark*>(aLandmarkHandle);
       
   348 
       
   349     TInt error = eventSource->ExecuteTrap(
       
   350                      UpdateLandmarkL,
       
   351                      landmarkStore,
       
   352                      landmark);
       
   353 
       
   354     LOG1(EJavaLocation,EInfo, "Java_javax_microedition_location_LandmarkStore__1updateLandmark - error %d", error);
       
   355 
       
   356     return error;
       
   357 }
       
   358 
       
   359 LOCAL_C void DeleteLandmarkL(CLAPILandmarkStore* aLandmarkStore,
       
   360                              CLAPILandmark* aLandmark)
       
   361 {
       
   362     aLandmarkStore->RemoveLandmarkL(*aLandmark);
       
   363 }
       
   364 
       
   365 /*
       
   366  * Class:     javax_microedition_location_LandmarkStore
       
   367  * Method:    _deleteLandmark
       
   368  * Signature: (III)I
       
   369  */
       
   370 JNIEXPORT jint
       
   371 JNICALL Java_javax_microedition_location_LandmarkStore__1deleteLandmark(
       
   372     JNIEnv* /*aJniEnv*/,
       
   373     jobject /*aPeer*/,
       
   374     jint aEventSourceHandle,
       
   375     jint aStoreHandle,
       
   376     jint aLandmarkHandle)
       
   377 {
       
   378     JELOG2(EJavaLocation);
       
   379 
       
   380     LocationFunctionServer* eventSource =
       
   381         reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
       
   382     CLAPILandmarkStore* landmarkStore =
       
   383         reinterpret_cast< CLAPILandmarkStore*>(aStoreHandle);
       
   384     CLAPILandmark* landmark =
       
   385         reinterpret_cast< CLAPILandmark*>(aLandmarkHandle);
       
   386 
       
   387     TInt error = eventSource->ExecuteTrap(
       
   388                      DeleteLandmarkL,
       
   389                      landmarkStore,
       
   390                      landmark);
       
   391 
       
   392     LOG1(EJavaLocation,EInfo, "Java_javax_microedition_location_LandmarkStore__1deleteLandmark - error %d", error);
       
   393 
       
   394     // Ignore errors indicating that the landmark has already been ignored
       
   395     return error == KErrNotFound ? KErrNone : error;
       
   396 }
       
   397 
       
   398 LOCAL_C void ListCategoriesL(JNIEnv* aJniEnv,
       
   399                              CLAPILandmarkStore* aLandmarkStore, jobjectArray* aCategories)
       
   400 {
       
   401     JELOG2(EJavaLocation);
       
   402 
       
   403     // Get an array of landmark store uris from the manager
       
   404     MLAPICategoryManager* categoryManager = aLandmarkStore->CategoryManagerL();
       
   405     // Supports category handling
       
   406     if (categoryManager)
       
   407     {
       
   408         const CDesCArray& categories = categoryManager->ListCategoriesL();
       
   409         // Create a java object array from the category names. Java-side takes
       
   410         // the ownership of the new object array
       
   411         *aCategories = CopyToNewJavaStringArrayL(*aJniEnv, categories);
       
   412     }
       
   413 }
       
   414 
       
   415 /*
       
   416  * Class:     javax_microedition_location_LandmarkStore
       
   417  * Method:    _listCategories
       
   418  * Signature: (II[I)[Ljava/lang/String;
       
   419  */
       
   420 JNIEXPORT jobjectArray
       
   421 JNICALL Java_javax_microedition_location_LandmarkStore__1listCategories(
       
   422     JNIEnv* aJniEnv,
       
   423     jobject /*aPeer*/,
       
   424     jint aEventSourceHandle,
       
   425     jint aStoreHandle,
       
   426     jintArray aError)
       
   427 {
       
   428     JELOG2(EJavaLocation);
       
   429 
       
   430     LocationFunctionServer* eventSource =
       
   431         reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
       
   432     CLAPILandmarkStore* landmarkStore =
       
   433         reinterpret_cast< CLAPILandmarkStore*>(aStoreHandle);
       
   434 
       
   435     // Ownership of the name array is transferred to Java side
       
   436     jobjectArray javaStringArray = NULL;
       
   437 
       
   438     TInt error = eventSource->ExecuteTrap(
       
   439                      ListCategoriesL,
       
   440                      eventSource->getValidJniEnv(),
       
   441                      landmarkStore,
       
   442                      &javaStringArray);
       
   443 
       
   444     SetJavaErrorCode(*aJniEnv, aError, error);
       
   445     return javaStringArray;
       
   446 }
       
   447 
       
   448 LOCAL_C void AddCategoryL(CLAPILandmarkStore* aLandmarkStore,
       
   449                           const TDesC* aCategoryName)
       
   450 {
       
   451     __ASSERT_DEBUG(aCategoryName, LAPIError::Panic(ELAPIPanicNullArgument));
       
   452     // Get the category manager and add new category if the store supports it
       
   453     MLAPICategoryManager* categoryManager = aLandmarkStore->CategoryManagerL();
       
   454     // Supports category handling
       
   455     if (categoryManager)
       
   456     {
       
   457         categoryManager->AddCategoryL(*aCategoryName);
       
   458         // Compact the store if needed
       
   459         aLandmarkStore->CompactIfNeededL();
       
   460     }
       
   461 }
       
   462 
       
   463 /*
       
   464  * Class:     javax_microedition_location_LandmarkStore
       
   465  * Method:    _addCategory
       
   466  * Signature: (IILjava/lang/String;)I
       
   467  */
       
   468 JNIEXPORT jint JNICALL Java_javax_microedition_location_LandmarkStore__1addCategory(
       
   469     JNIEnv* aJniEnv,
       
   470     jobject /*aPeer*/,
       
   471     jint aEventSourceHandle,
       
   472     jint aStoreHandle,
       
   473     jstring aCategory)
       
   474 {
       
   475     JELOG2(EJavaLocation);
       
   476 
       
   477     LocationFunctionServer* eventSource =
       
   478         reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
       
   479     CLAPILandmarkStore* landmarkStore =
       
   480         reinterpret_cast< CLAPILandmarkStore*>(aStoreHandle);
       
   481 
       
   482     // Store name must not be null
       
   483     const JStringUtils categoryName(*aJniEnv, aCategory);
       
   484 
       
   485     TInt error = eventSource->ExecuteTrap(
       
   486                      AddCategoryL,
       
   487                      landmarkStore,
       
   488                      static_cast< const TDesC*>(&categoryName));
       
   489 
       
   490     LOG1(EJavaLocation,EInfo, "Java_javax_microedition_location_LandmarkStore__1addCategory error %d", error);
       
   491 
       
   492     return error;
       
   493 }
       
   494 
       
   495 LOCAL_C void DeleteCategoryL(CLAPILandmarkStore* aLandmarkStore,
       
   496                              const TDesC* aCategoryName)
       
   497 {
       
   498     __ASSERT_DEBUG(aCategoryName, LAPIError::Panic(ELAPIPanicNullArgument));
       
   499     // Get the category manager and add new category if the store supports it
       
   500     MLAPICategoryManager* categoryManager = aLandmarkStore->CategoryManagerL();
       
   501     // Supports category handling
       
   502     if (categoryManager)
       
   503     {
       
   504         categoryManager->RemoveCategoryL(*aCategoryName);
       
   505 
       
   506     }
       
   507 }
       
   508 
       
   509 /*
       
   510  * Class:     javax_microedition_location_LandmarkStore
       
   511  * Method:    _deleteCategory
       
   512  * Signature: (IILjava/lang/String;)I
       
   513  */
       
   514 JNIEXPORT jint JNICALL Java_javax_microedition_location_LandmarkStore__1deleteCategory(
       
   515     JNIEnv* aJniEnv,
       
   516     jobject /*aPeer*/,
       
   517     jint aEventSourceHandle,
       
   518     jint aStoreHandle,
       
   519     jstring aCategory)
       
   520 {
       
   521     JELOG2(EJavaLocation);
       
   522 
       
   523     LocationFunctionServer* eventSource =
       
   524         reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
       
   525     CLAPILandmarkStore* landmarkStore =
       
   526         reinterpret_cast< CLAPILandmarkStore*>(aStoreHandle);
       
   527 
       
   528     // Store name must not be null
       
   529     const JStringUtils categoryName(*aJniEnv, aCategory);
       
   530 
       
   531     TInt error = eventSource->ExecuteTrap(
       
   532                      DeleteCategoryL,
       
   533                      landmarkStore,
       
   534                      static_cast< const TDesC*>(&categoryName));
       
   535 
       
   536     LOG1(EJavaLocation,EInfo,
       
   537          "Java_javax_microedition_location_LandmarkStore__1deleteCategory error %d", error);
       
   538 
       
   539     return error;
       
   540 }
       
   541 
       
   542 LOCAL_C void DisposeObject(CLAPILandmarkStore* aLandmarkStore)
       
   543 {
       
   544     delete aLandmarkStore;
       
   545 }
       
   546 /*
       
   547  * Class:     javax_microedition_location_LandmarkStore
       
   548  * Method:    _dispose
       
   549  * Signature: (II)V
       
   550  */
       
   551 JNIEXPORT void
       
   552 JNICALL Java_javax_microedition_location_LandmarkStore__1dispose(
       
   553     JNIEnv* /*aJniEnv*/,
       
   554     jobject /*aPeer*/,
       
   555     jint aEventSourceHandle,
       
   556     jint aManagerHandle)
       
   557 {
       
   558     JELOG2(EJavaLocation);
       
   559 
       
   560     LocationFunctionServer* eventSource =
       
   561         reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
       
   562     CLAPILandmarkStore* object =
       
   563         reinterpret_cast< CLAPILandmarkStore*>(aManagerHandle);
       
   564 
       
   565     eventSource->ExecuteV(
       
   566         DisposeObject,
       
   567         object);
       
   568 }
       
   569 
       
   570 // End of file