javaextensions/midppush/pushcontroller/inc/pushregistry.h
changeset 21 2a9601315dfc
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef PUSHREGISTRY_H
       
    20 #define PUSHREGISTRY_H
       
    21 
       
    22 #include <string>
       
    23 #include <list>
       
    24 
       
    25 namespace java
       
    26 {
       
    27 namespace util
       
    28 {
       
    29 class Uid;
       
    30 }
       
    31 namespace push
       
    32 {
       
    33 /**
       
    34  * This interface provides native side functionality for PushRegistry java class.
       
    35  */
       
    36 
       
    37 class PushRegistry
       
    38 {
       
    39 public:
       
    40 
       
    41     virtual ~PushRegistry() {}
       
    42 
       
    43     /**
       
    44      * This operation creates ServerConnection object to the Server Connection Plugin
       
    45      * and stores new dynamic push connection to the push registry db.
       
    46      * @param aUri     Push connection URI. Cannot be empty. Syntax validation of this argument
       
    47      *                 is done in the java side by PushValidator interface.
       
    48      * @param aMidlet  Class name of the MIDlet. Cannot be empty.
       
    49      *                 Note: This operation does not validate whether value of this
       
    50      *                       argument match to the class name of the MIDlet.
       
    51      * @param aFilter  Connection URL indicating which senders are allowed to cause
       
    52      *                 the MIDlet to be launched. Cannot be empty. Syntax validation of this
       
    53      *                 argument is done in the java side by PushValidator interface.
       
    54      * @param aUid     UID of the application.
       
    55      * @param aIsUidOfThisMidlet indicates whether uid belongs to MIDlet where this
       
    56      *                           operation was called.
       
    57      * @throws         PushException with following error codes:
       
    58      *                 GENERAL_COMMS_ERROR:
       
    59      *                 sending a comms message failed.
       
    60      *                 INCORRECT_COMMS_MSG:
       
    61      *                 reading/writing to comms msg failed.
       
    62      *                 DB_ERROR:
       
    63      *                 storing dynamic push registration fails to the db.
       
    64      *                 COMMON_SRV_CONN_PLUGIN_ERROR:
       
    65     *                 creation of ServerConnection object failed.
       
    66     *                 PUSH_CONNECTION_ALREADY_EXISTS:
       
    67     *                 other push connection with same URI already exists.
       
    68     *                 note: this does not concern normal server connection.
       
    69      *                 LibraryLoaderException with following error codes:
       
    70      *                 OPENING_LIBRARY_FAILED if opening a Server Connection Plugin failed.
       
    71      *                                        E.g. in the situation where certain protocol
       
    72      *                                        is not supported.
       
    73      *                 CANNOT_FIND_FUNCTION_FAILURE if function function by "getServerConnectionFactory"
       
    74      *                                        name is not found from ServerConnection Plugin.
       
    75      */
       
    76     virtual void registerDynamicPushConn(const std::wstring& aUri,
       
    77                                          const std::wstring& aMidlet,
       
    78                                          const std::wstring& aFilter,
       
    79                                          const java::util::Uid& aUid,
       
    80                                          bool aIsUidOfThisMidlet) = 0;
       
    81 
       
    82     /**
       
    83      * This operation returns all static and dynamic push connections of the MIDlet.
       
    84      * @param aAvailable 'true' means that only active push URIs is returned.
       
    85      *                   I.e. URIs where message has arrived.
       
    86      *                   'false' means that all static and dynamic push registrations
       
    87      *                   of the MIDlet is returned.
       
    88      * @param aUid       UID of the MIDlet Suite.
       
    89      * @param aUriList   Output parameter. List of URIs.
       
    90      * @throws           This operation does not throw exceptions.
       
    91      *
       
    92      */
       
    93     virtual void listConnections(bool aAvailable,const java::util::Uid& aUid,
       
    94                                  std::list<std::wstring>& aUriList) = 0;
       
    95 
       
    96     /**
       
    97      * This operation returns filter of the push registration.
       
    98      * @param aUri push connection URI.
       
    99      * @param aSuiteUid UID of the MIDlet suite.
       
   100      * @return filter of the push registration.
       
   101      * @throws  PushException with following error codes:
       
   102      *          SRV_CONN_NOT_FOUND:
       
   103      *          Push registration does not exists.
       
   104      */
       
   105     virtual std::wstring getFilter(const std::wstring& aUri,
       
   106                                    const java::util::Uid& aSuiteUid) = 0;
       
   107 
       
   108     /**
       
   109      * This operation returns filter of the push registration.
       
   110      * @param aUri push connection URI.
       
   111      * @param aSuiteUid UID of the MIDlet suite.
       
   112      * @return filter of the push registration.
       
   113      * @throws  PushException with following error codes:
       
   114      *          SRV_CONN_NOT_FOUND:
       
   115      *          Push registration does not exists.
       
   116      */
       
   117     virtual std::wstring getClassNameOfMidlet(const std::wstring& aUri,
       
   118             const java::util::Uid& aSuiteUid) = 0;
       
   119 
       
   120     /**
       
   121      * This operation is used in the implementation of PushRegistry.getMIDlet() operation.
       
   122      * This operation checks whether this MIdlet has push registrations.
       
   123      * This operation does not thrown exception.
       
   124      * @param aUri push connection URI.
       
   125      * @param aUid UID of the application.
       
   126      * @return 'true' if aUri matches to the push connection.
       
   127      */
       
   128     virtual bool isPushConnection(const std::wstring& aUri,
       
   129                                   const java::util::Uid& aUid) = 0;
       
   130 
       
   131     /**
       
   132      * This operation deletes dynamic push registration from the db and changes
       
   133      * existing (if exists) type of the ServerConection to normal server connection.
       
   134      * @param   aUri push connection URI.
       
   135      * @param   aUid UID of the application.
       
   136      * @param aIsUidOfThisMidlet indicates whether uid belongs to MIDlet where this
       
   137            *                           operation was called.
       
   138      * @throws  PushException with following error codes:
       
   139      *          GENERAL_COMMS_ERROR:
       
   140            *          sending a comms message failed.
       
   141            *          INCORRECT_COMMS_MSG:
       
   142            *          reading/writing to comms msg failed.
       
   143            *          NOT_DYNAMIC_PUSH_URI:
       
   144      *          URI is static push URI.
       
   145            *          URI_BELONGS_TO_OTHER_MIDLET:
       
   146            *          Push registration has been reserved for other MIDlet.
       
   147            *          SRV_CONN_NOT_FOUND:
       
   148            *          Server connection is not found from the push registry db.
       
   149            *          DB_ERROR:
       
   150            *          Database error occurred.
       
   151      */
       
   152     virtual void unregisterDynamicPushConn(const std::wstring& aUri,
       
   153                                            const java::util::Uid& aUid,
       
   154                                            bool aIsUidOfThisMidlet) = 0;
       
   155 
       
   156     /**
       
   157      * This operation register a alarm time to launch a MIDlet.
       
   158      * @param aAlarmTimeInMillSecs MIDlet's launch time in milliseconds.
       
   159      * @param aSuiteUid UID of the MIDlet suite.
       
   160      * @param aClassNameOfMidlet class name of the MIDlet.
       
   161      * @param aIsUidOfThisMidlet indicates whether uid belongs to MIDlet where this
       
   162            *                           operation was called.
       
   163      * @throws  PushException with following error codes:
       
   164      *          GENERAL_COMMS_ERROR:
       
   165      *          sending a comms message failed.
       
   166      *          INCORRECT_COMMS_MSG:
       
   167      *          Incorrect comms message.
       
   168      *          INVALID_ALARM_TIME:
       
   169      *          alarm time is less than current time.
       
   170      *          DB_ERROR:
       
   171      *          Database error occurred during storing alarm time.
       
   172      */
       
   173     virtual long long registerAlarm(const long long& aAlarmTimeInMilliSecs,
       
   174                                     const java::util::Uid& aSuiteUid,
       
   175                                     const std::wstring& aClassNameOfMidlet,
       
   176                                     bool aIsUidOfThisMidlet) = 0;
       
   177 };
       
   178 
       
   179 }//end namespace push
       
   180 }//end namespace java
       
   181 
       
   182 #endif // PUSHREGISTRY_H
       
   183