webservices/wsframework/inc/sensecuritymechanism.inl
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002-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:        Defines the ECom interface for Sen Security Mechanism 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 plugin
       
    27 // implementation.
       
    28 inline CSenSecurityMechanism* CSenSecurityMechanism::NewL(MSenCoreServiceManager& aManager)
       
    29     {
       
    30     // Instantiate the default SASL plugin - AnonymousSasl
       
    31 #ifndef RD_SEN_COMPILE_SIS_PACKAGE_FILES    
       
    32     const TUid KAnonymousSaslPluginUid = {0x101F96FD};
       
    33 #else
       
    34     const TUid KAnonymousSaslPluginUid = {0x101F9734};
       
    35 #endif    
       
    36 
       
    37     TAny* constructorParameters = reinterpret_cast<TAny*>(&aManager);
       
    38 
       
    39     // Find implementation behind KAnonymousSaslPluginUid
       
    40     TAny* intf = REComSession::CreateImplementationL (KAnonymousSaslPluginUid, 
       
    41                                                       _FOFF (CSenSecurityMechanism, 
       
    42                                                       iDtor_ID_Key), 
       
    43                                                       constructorParameters);
       
    44 
       
    45     return reinterpret_cast <CSenSecurityMechanism*> (intf);
       
    46     }
       
    47 
       
    48 // Interface's (abstract base class's) static factory method implementation.
       
    49 // Asks ECOM plugin framework to instantiate appropriate concret plugin
       
    50 // implementation.
       
    51 inline CSenSecurityMechanism* CSenSecurityMechanism::NewL(const TDesC8& aMatch, 
       
    52                                                           MSenCoreServiceManager& aManager)
       
    53     {
       
    54 #ifndef RD_SEN_COMPILE_SIS_PACKAGE_FILES
       
    55     const TUid KCSenSecurityMechanismInterfaceUid = {0x101F96FC};
       
    56 #else
       
    57     const TUid KCSenSecurityMechanismInterfaceUid = {0x101F9733};
       
    58 #endif
       
    59 
       
    60     TEComResolverParams resolverParams;
       
    61     resolverParams.SetDataType(aMatch);
       
    62     resolverParams.SetWildcardMatch(EFalse);
       
    63 
       
    64     TAny* constructorParameters = reinterpret_cast<TAny*>(&aManager);
       
    65 
       
    66     // Find implementation for our interface.
       
    67     // - KCSenSecurityMechanismInterfaceUid is the UID of
       
    68     //  SASL SECURITY MECHANISM ECOM interface.         
       
    69     //
       
    70     // - This call will leave, if the plugin architecture 
       
    71     // cannot find implementation.
       
    72     // - The returned pointer points to one of our interface implementation
       
    73     //   instances.
       
    74     TAny* intf = REComSession::CreateImplementationL (KCSenSecurityMechanismInterfaceUid,
       
    75                                                       _FOFF (CSenSecurityMechanism, 
       
    76                                                       iDtor_ID_Key), 
       
    77                                                       constructorParameters, 
       
    78                                                       resolverParams); 
       
    79 
       
    80     return reinterpret_cast<CSenSecurityMechanism*> (intf);
       
    81     }
       
    82 
       
    83 
       
    84 // Interface's (abstract base class's) destructor
       
    85 inline CSenSecurityMechanism::~CSenSecurityMechanism()
       
    86     {
       
    87     // we need to call this, because destroying is too late
       
    88     // in virtual destructor in super class (virtual destructor & ECOM)
       
    89     // If superclass resets the contents, the memory will be in illegal
       
    90     // state in case that there is ONE or MORE password transform ECOM
       
    91     // instancies inside this array(!) -> this will cause crash in 
       
    92     // unknown location, typically in next destructor.
       
    93     iTransforms.ResetAndDestroy(); // were owned
       
    94 
       
    95     // Inform the ECOM framework that this specific instance of the
       
    96     // interface has been destroyed.
       
    97     REComSession::DestroyedImplementation (iDtor_ID_Key);
       
    98     }
       
    99 
       
   100 inline CSenSecurityMechanism::CSenSecurityMechanism(MSenCoreServiceManager& aServiceManager)
       
   101         :iServiceManager(aServiceManager)
       
   102         {
       
   103         }
       
   104 
       
   105 // End of File