webservices/wsframework/inc/senmessagehandler.inl
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2005 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:        Inlines for the Handler ECOM plug-ins
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 // Interface's (abstract base class's) static factory method implementation.
       
    26 // Asks ECOM plugin framework to instantiate appropriate concrete plug-in
       
    27 // implementation.
       
    28 //
       
    29 // Instantiates the default message handler plug-in
       
    30 inline CSenMessageHandler* CSenMessageHandler::NewL(MSenHandlerContext& aCtx)
       
    31     {
       
    32     const TUid KSenDefaultMessageHandlerPluginUid = {0x20000397};
       
    33 
       
    34     TAny* constructorParameters = reinterpret_cast<TAny*>(&aCtx);
       
    35 
       
    36     // Find implementation behind KTestHandlerPluginUid
       
    37     TAny* intf = REComSession::CreateImplementationL(KSenDefaultMessageHandlerPluginUid, 
       
    38                                                      _FOFF (CSenMessageHandler, 
       
    39                                                      iDtor_ID_Key), 
       
    40                                                      constructorParameters);
       
    41 
       
    42     if(intf)
       
    43         {
       
    44         _LIT8(KSenDefaultMessageHandlerPluginName, "urn:com.nokia.serene:handlers:message:default");
       
    45         CSenMessageHandler* handler = reinterpret_cast <CSenMessageHandler*> (intf);
       
    46         CleanupStack::PushL(handler);
       
    47         handler->iName = KSenDefaultMessageHandlerPluginName().AllocL();
       
    48         handler->InitL(aCtx);
       
    49         CleanupStack::Pop(); // handler
       
    50         }
       
    51 
       
    52     return reinterpret_cast <CSenMessageHandler*> (intf);
       
    53     }
       
    54 
       
    55 // Interface's (abstract base class's) static factory method implementation.
       
    56 // Asks ECOM plugin framework to instantiate appropriate concret plug-in
       
    57 // implementation.
       
    58 inline CSenMessageHandler* CSenMessageHandler::NewL(const TDesC8& aCue, 
       
    59                                                     MSenHandlerContext& aCtx)
       
    60     {
       
    61 #ifndef RD_SEN_COMPILE_SIS_PACKAGE_FILES    
       
    62     const TUid KSenMessageHandlerInterfaceUid = {0x20000393};
       
    63 #else
       
    64     const TUid KSenMessageHandlerInterfaceUid = {0x10282C5C};
       
    65 #endif    
       
    66 
       
    67     TEComResolverParams resolverParams;
       
    68     resolverParams.SetDataType(aCue);
       
    69     resolverParams.SetWildcardMatch(EFalse);
       
    70 
       
    71     TAny* constructorParameters = reinterpret_cast<TAny*>(&aCtx);
       
    72 
       
    73     // Find implementation for our interface.
       
    74     // - KCSenMessageHandlerInterfaceUid is the UID of Handler ECOM interface.
       
    75     // - This call will leave, if the plugin architecture cannot find
       
    76     //   implementation.
       
    77     // - The returned pointer points to one of our interface implementation
       
    78     //   instances.
       
    79     TAny* intf = REComSession::CreateImplementationL(KSenMessageHandlerInterfaceUid,
       
    80                                                      _FOFF (CSenMessageHandler, 
       
    81                                                      iDtor_ID_Key), 
       
    82                                                      constructorParameters, 
       
    83                                                      resolverParams); 
       
    84 
       
    85     if(intf)
       
    86         {
       
    87         CSenMessageHandler* handler = reinterpret_cast <CSenMessageHandler*> (intf);
       
    88         CleanupStack::PushL(handler);
       
    89         handler->iName = aCue.AllocL();
       
    90         handler->InitL(aCtx);
       
    91         CleanupStack::Pop(); // handler
       
    92         }
       
    93     return reinterpret_cast<CSenMessageHandler*> (intf);
       
    94     }
       
    95 
       
    96 
       
    97 // Interface's (abstract base class's) destructor
       
    98 inline CSenMessageHandler::~CSenMessageHandler()
       
    99     {
       
   100     // Any member data must be released here. 
       
   101     delete iName; 
       
   102 
       
   103     // Inform the ECOM framework that this specific instance of the
       
   104     // interface has been destroyed.
       
   105     REComSession::DestroyedImplementation(iDtor_ID_Key);
       
   106     }
       
   107 
       
   108 inline CSenMessageHandler::CSenMessageHandler(MSenHandlerContext& aCtx)
       
   109         :iHandlerContext(aCtx)        
       
   110         {
       
   111         }
       
   112 
       
   113 inline SenHandler::THandlerType CSenMessageHandler::Type() const
       
   114     {
       
   115     return SenHandler::EMessageHandler;
       
   116     }
       
   117 
       
   118 inline TPtrC8 CSenMessageHandler::Name() const
       
   119     {
       
   120     if(iName)
       
   121         return *iName;
       
   122     else
       
   123         return KNullDesC8();
       
   124     }
       
   125 
       
   126 
       
   127 // End of File