webservices/wsframework/inc/senserviceinvocationframework.h
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:    Header declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef SERVICE_INVOCATION_FRAMEWORK_INTERFACE_H
       
    26 #define SERVICE_INVOCATION_FRAMEWORK_INTERFACE_H
       
    27 
       
    28 // INCLUDES
       
    29 #include <ecom/ecom.h>
       
    30 
       
    31 #include "msenserviceinvocationframework.h"
       
    32 
       
    33 // CONTANTS
       
    34 const TInt KErrSenReinitRequired = -30304;
       
    35 const TInt KErrSenResendRequired = -30316;
       
    36 const TInt KErrSenFailedAuthentication  = -30320;
       
    37 //const TInt KErrSenResendComplete = -30322; 
       
    38 
       
    39 // Default events
       
    40 const TInt KSenEventWsfReady                            = 1;
       
    41 const TInt KSenEventSessionsDbReadBegin                 = 100;
       
    42 const TInt KSenEventSessionsDbReadComplete              = 101;
       
    43 const TInt KSenEventSessionsDbWriteBegin                = 102;
       
    44 const TInt KSenEventSessionsDbWriteComplete             = 103;
       
    45 const TInt KSenEventIdWsfSessionValidatorRequested      = 200;
       
    46 const TInt KSenEventConsumerReleasesSession             = 300;
       
    47 const TInt KSenEventConsumerAdded                       = 301;
       
    48 const TInt KSenEventConsumerRemoved                     = 302;
       
    49 const TInt KSenEventRegisterNewServiceDescription       = 400;
       
    50 const TInt KSenEventRegisterIdentityProvider            = 500;
       
    51 const TInt KSenEventUnregisterIdentityProvider          = 501;
       
    52 
       
    53 // FORWARD DECLARATIONS
       
    54 class CSenSecurityMechanism;
       
    55 struct TSifData;
       
    56 
       
    57 /**
       
    58  * Class: CSIF (ServiceInvocationFramework ECOM interface)
       
    59  * Custom ECOM interface definition. This interface is used by
       
    60  * clients to find specific instance implementation(s).
       
    61  */
       
    62 class CSIF : public CSenBaseFragment, public MSIF
       
    63     {
       
    64     public: // Constructors and destructor
       
    65         
       
    66         /**
       
    67         * Wraps ECom object instantiation, which returns the
       
    68         * default interface implementation.
       
    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. They are the familiar
       
    73         * EPOC NewL's, which create instance of classes.
       
    74         */
       
    75         static CSIF* NewL( MSenCoreServiceManager& aManager );
       
    76 
       
    77         /**
       
    78         * Wraps ECom object instantitation, which returns the
       
    79         * interface implementation matching to given aCue.
       
    80         * IMPLEMENTATION_INFO::default_data.
       
    81         * For details, see EcomSIFDefinition.inl comments.
       
    82         * Note: This is not a "normal" NewL method, since normally NewL
       
    83         *       methods are only defined for concrete classes.
       
    84         * Note that the implementations of this interface ALSO
       
    85         * provide NewL methods. They are the familiar EPOC
       
    86         * NewL's, which create instance of classes.
       
    87         * @param  aCue is the "name" of the requested implementation.
       
    88         *         Implementations advertise their cue as specified
       
    89         *         in their resource file field
       
    90         */
       
    91         static CSIF* NewL( const TDesC8& aCue, MSenCoreServiceManager& aManager );
       
    92 
       
    93         /**
       
    94          * Destructor.
       
    95          */
       
    96         virtual ~CSIF();
       
    97 
       
    98         // New functions
       
    99         
       
   100         /**
       
   101         * Try to find one or more services that match the given
       
   102         * ServiceDescription. Register ServiceDescriptions for these to the
       
   103         * owner of the framework, i.e. to the ServiceManager. Return the
       
   104         * number of ServiceDescriptions that were added.
       
   105         * @param    aPattern - A ServiceDescriptin that should be treated
       
   106         *           as a pattern
       
   107         * @param    aErrorMsg will be allocated to provide detailed
       
   108         *           information about error, if available (like SOAP fault)
       
   109         * @return   On success, returns a positive number: - a total count 
       
   110         *           of matching ServiceDescriptions that were added.
       
   111         *           In case of error, the returned value will be negative:
       
   112         *           - one of the system-wide error codes.
       
   113         */
       
   114         virtual TInt AddServiceDescriptionL( MSenServiceDescription& aPattern,
       
   115                                              MSenRemoteServiceConsumer& aRemoteConsumer,
       
   116                                              HBufC8*& aErrorMsg ) = 0;
       
   117 
       
   118         /**
       
   119         * Set the ServiceManager to which this instance reports.
       
   120         * The (singleton) ServiceManager calls this method when
       
   121         * it instantiates a framework.
       
   122         * @param aServiceManager The singleton ServiceManager in the system.
       
   123         */
       
   124         virtual void SetManager( MSenCoreServiceManager& aServiceManager ) = 0;
       
   125 
       
   126         /**
       
   127         * The CoreServiceManager asks for this BaseFragment upon startup
       
   128         * in order to give this framework a chance to read its configuration
       
   129         * information from the central ServiceManager configuration document.
       
   130         * @return CSenBaseFragment - an object that can do SAX based parsing of a XML fragment
       
   131         * that contains framework specific configuration information.
       
   132         */
       
   133         virtual CSenBaseFragment& ConfigParser() = 0;
       
   134 
       
   135         /**
       
   136         * This method may be called to pass certain events to the SIF 
       
   137         * plug-in.
       
   138         * There may be few common events in WSF scope plus other, plug-in 
       
   139         * specific events.
       
   140         * Plug-ins can themselves decide, whether or not to take action
       
   141         * on notified event. For example, ID-WSF plug-in might be interested
       
   142         * to assign "session validators" (AS and DS clients) to the newly
       
   143         * instantiated sessions, after it has been notified, that all sessions
       
   144         * have been parsed into memory (de-serialized) from sensessions.xml
       
   145         * database.
       
   146         */
       
   147         virtual TInt OnEvent( const TInt aEvent, TAny* aArgument ) = 0;
       
   148 
       
   149         /**
       
   150         * Getter for SIF specific extension interface, which caller
       
   151         * typically class-casts to pre-known type
       
   152         * @return pointer to plug-in specific interface, or NULL
       
   153         *         if interface extension is NOT implemented.
       
   154         */
       
   155         virtual TAny* ExtendedInterface() = 0;
       
   156         
       
   157         /**
       
   158          * @return a string that is the unique for this implementation. Note that there might be multiple
       
   159          * frameworks, which all implement same TYPE (framework ID is the same), but which have different
       
   160          * design. This might mean that they implement different VERSION of the framework. It is recommended
       
   161          * that framework CUE is the ECOM cue of the framework, and that it is in form of URN (unique resource
       
   162          * name). 
       
   163          * This default, inline implementation is returning the ECOM cue value of this plug-in.
       
   164          */
       
   165         virtual TPtrC8 Cue() const;        
       
   166     private:
       
   167 
       
   168         struct TSifData
       
   169             {
       
   170             /** Instance identifier key. When instance of an
       
   171             * implementation is created by ECOM framework, the
       
   172             * framework will assign UID for it. The UID is used in
       
   173             * destructor to notify framework that this instance is
       
   174             * being destroyed and resources can be released.
       
   175             */
       
   176             TUid iDtor_ID_Key;
       
   177             
       
   178             /*
       
   179             * This equals to ECOM's data type (== "cue" of the plug-in)
       
   180             */
       
   181             HBufC8* iCue;
       
   182             //HBufC8* iReserved;
       
   183             //HBufC8* iReserved*;
       
   184             inline void Close();
       
   185             };        
       
   186 
       
   187     private: // Data
       
   188         TSifData* iData;
       
   189     };
       
   190     
       
   191 // Inline includes the implementation of the instantiation
       
   192 // functions and destructor
       
   193 #include "senserviceinvocationframework.inl"
       
   194 
       
   195 #endif // SERVICE_INVOCATION_FRAMEWORK_INTERFACE_H
       
   196 
       
   197 // End of File
       
   198