webservices/wsframework/inc/sensessionhandler.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2006 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 Handler plug-in implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef SEN_SESSION_HANDLER_H
       
    26 #define SEN_SESSION_HANDLER_H
       
    27 
       
    28 // INCLUDES
       
    29 #include <ecom/ecom.h>
       
    30 
       
    31 #include "senhandlerbase.h"     // internal Framework\inc
       
    32 #include "msenhandlercontext.h" // internal Framework\inc
       
    33 #include "msensessioncontext.h" // internal Framework\inc
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 * Custom ECOM interface definition. This interface is used by
       
    39 * clients to find specific handler plugins which implement 
       
    40 * pure virtual functions defined in MSenTranport interface.
       
    41 */
       
    42 class CSenSessionHandler : public CSenHandlerBase
       
    43     {
       
    44     public:
       
    45         
       
    46         // Constructors and destructor:
       
    47 
       
    48         /**
       
    49         * Wraps ECom object instantiation, which returns the
       
    50         * default ECOM implementation for this interface.
       
    51         * Note: This is not a "normal" NewL method, since 
       
    52         * normally NewL methods are only defined for concrete
       
    53         * classes. Note that the implementations of this interface
       
    54         * also provide NewL methods.
       
    55         * 
       
    56         * Additionally, this static constructor performs InitL()
       
    57         * using the provided handler context for the newly allocated
       
    58         * handler instance.
       
    59         *
       
    60         * @param aCtx is handle to the handler specific context
       
    61         */
       
    62         static CSenSessionHandler* NewL(MSenHandlerContext& aCtx);
       
    63 
       
    64         /**
       
    65         * Wraps ECom object instantitation, which returns the
       
    66         * interface implementation matching to given aCue,
       
    67         * IMPLEMENTATION_INFO::default_data.
       
    68         * For details, see EcomSIFDefinition.inl comments.
       
    69         * Note: This is not a "normal" NewL method, since normally NewL
       
    70         * methods are only defined for concrete classes.
       
    71         * Note that the implementations of this interface 
       
    72         * also provide NewL methods. 
       
    73         *
       
    74         * Additionally, this static constructor performs InitL()
       
    75         * using the provided handler context for the newly allocated
       
    76         * handler instance.
       
    77         *
       
    78         * @param aCue is the "name" of the requested implementation.
       
    79         *             Implementations advertise their cue as specified
       
    80         *             in their resource file field
       
    81         * @param aCtx is handle to the handler specific context
       
    82         */
       
    83         static CSenSessionHandler* NewL(const TDesC8& aCue,
       
    84                                         MSenHandlerContext& aCtx);
       
    85         /**
       
    86         * Destructor.
       
    87         */
       
    88         virtual ~CSenSessionHandler();
       
    89 
       
    90         // From MSenHandler:
       
    91         /**
       
    92         * Method is used to resolve concrete type (class)
       
    93         * for this handler instance.
       
    94         * 
       
    95         * @return the class type of this handler
       
    96         */
       
    97         inline SenHandler::THandlerType Type() const;        
       
    98         /**
       
    99         * Method is used to resolve real, system-wide
       
   100         * unique name for this handler. By default, this
       
   101         * typically returns the ECOM cue (default_data)
       
   102         * of the concrete plug-in instance.
       
   103         * 
       
   104         * @return the unique name of this handler
       
   105         */
       
   106         inline TPtrC8 Name() const;        
       
   107         
       
   108 
       
   109         // New functions:
       
   110         
       
   111         /**
       
   112         * InvokeL is the most emergent method in message handler interface.
       
   113         * Each sub-class must implement this method thus providing message
       
   114         * processing routine.
       
   115         * 
       
   116         * @param aCtx is the session context that will be accessed and 
       
   117         * typically altered by implemented handler, in order to provide
       
   118         * modifications on the layer of the session construction, validation,
       
   119         * or some other, focused area that the handler was intended to take
       
   120         * responsibility for. For example, certain handler can itself create
       
   121         * a session of its own, send message(s) to (authentication) service
       
   122         * (invoking other handlers), and finally access session context in 
       
   123         * order to update credentials. One example of such session handler
       
   124         * could be WS-TRUST client type handler, an "internal service consumer".
       
   125         * @return KErrNone or some WSF specific, or system-wide error code
       
   126         */
       
   127         virtual TInt InvokeL(MSenSessionContext& aCtx) = 0;
       
   128 
       
   129     protected:
       
   130 
       
   131         /**
       
   132         * C++ default constructor.
       
   133         * 
       
   134         * @param aCtx is handle to the handler specific context
       
   135         */
       
   136         CSenSessionHandler(MSenHandlerContext& aCtx);
       
   137 
       
   138     protected: // Data
       
   139         MSenHandlerContext& iHandlerContext;    
       
   140 
       
   141     private: // Data
       
   142         /** 
       
   143         * Instance identifier key. When instance of an implementation is created 
       
   144         * by ECOM framework, the framework will assign UID for it. 
       
   145         * The UID is used in destructor to notify framework that this instance is
       
   146         * being destroyed and resources can be released.
       
   147         */
       
   148         TUid iDtor_ID_Key;
       
   149         
       
   150         HBufC8* iName;
       
   151     };
       
   152 
       
   153 // This includes the implementation of the instantiation functions and destructor
       
   154 #include "sensessionhandler.inl"
       
   155 
       
   156 #endif // SEN_SESSION_HANDLER_H
       
   157 
       
   158 // End of File