epoc32/include/mw/senservicepattern.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000 (2010-03-16)
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:        Class derives the XML service description and further extends
williamr@2
    15
*                it by adding consumer policy interface implementation.
williamr@2
    16
*
williamr@2
    17
*/
williamr@2
    18
williamr@2
    19
williamr@2
    20
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
williamr@2
    25
williamr@2
    26
#ifndef SEN_SERVICE_PATTERN_H
williamr@2
    27
#define SEN_SERVICE_PATTERN_H
williamr@2
    28
williamr@2
    29
//  INCLUDES
williamr@2
    30
#include <e32base.h>
williamr@2
    31
#include <s32strm.h>
williamr@2
    32
#include <SenXmlServiceDescription.h>
williamr@2
    33
#include <MSenConsumerPolicy.h>
williamr@2
    34
williamr@2
    35
// FORWARD DECLARATIONS
williamr@2
    36
class CSenConsumerPolicy;
williamr@2
    37
williamr@2
    38
// CLASS DECLARATION
williamr@2
    39
williamr@2
    40
/**
williamr@2
    41
* Class derives the XML service description and further extends
williamr@2
    42
* it by implementing consumer policy interface.
williamr@2
    43
*
williamr@2
    44
* Service pattern is typically used by Basic Web Service consumers,
williamr@2
    45
* which often know, which policy to use in the communication with 
williamr@2
    46
* certain Web Service Provider (WSP). 
williamr@2
    47
*
williamr@2
    48
* For example, a Basic Web Service consumer application might want 
williamr@2
    49
* strictly define certain Internet Access Point (IAP) to be used when
williamr@2
    50
* initializing new service connection. Such an application can simply
williamr@2
    51
* instantiate new ServicePattern and set pre-known IAP ID into it.
williamr@2
    52
*
williamr@2
    53
* The main purpose of this class is to simplify the initialization
williamr@2
    54
* of service connections for Basic Web Services.
williamr@2
    55
*
williamr@2
    56
* It is important to note, that all the consumer policy information entered
williamr@2
    57
* via ServicePattern extending the MSenConsumerPolicy is treated
williamr@2
    58
* in "policy-per-client" terms. In other words, any consumer
williamr@2
    59
* policy information will not be stored for latter use of other
williamr@2
    60
* applications (even they might happen to use same WSP and contract!).
williamr@2
    61
*
williamr@2
    62
* This is due the nature of Service Pattern: it acts as a consumer
williamr@2
    63
* originated filter, after which a service will be resolved.
williamr@2
    64
*
williamr@2
    65
* Any service which "meets" the Service Pattern "constraints", is
williamr@2
    66
* considered as a "match", because such service accepts this
williamr@2
    67
* (search) pattern.
williamr@2
    68
*
williamr@2
    69
*  @lib SenServDesc.lib
williamr@2
    70
*  @since Series60 3.0
williamr@2
    71
*/
williamr@2
    72
class CSenServicePattern : public CSenXmlServiceDescription, public MSenConsumerPolicy
williamr@2
    73
williamr@2
    74
    {
williamr@2
    75
    public:  // Constructors and destructor
williamr@2
    76
        
williamr@2
    77
        /**
williamr@2
    78
         *  Standard 2 phase constructors
williamr@2
    79
         */
williamr@2
    80
        IMPORT_C static CSenServicePattern* NewL();
williamr@2
    81
williamr@2
    82
        /**
williamr@2
    83
         *  Standard 2 phase constructors
williamr@2
    84
         */
williamr@2
    85
        IMPORT_C static CSenServicePattern* NewLC();
williamr@2
    86
williamr@2
    87
        /**
williamr@2
    88
         *  Standard 2 phase constructor
williamr@2
    89
         *  @param aNamespaceURI    namespace URI for the service pattern.
williamr@2
    90
         */
williamr@2
    91
        IMPORT_C static CSenServicePattern* NewL(const TDesC8& aNamespaceURI);
williamr@2
    92
williamr@2
    93
        /**
williamr@2
    94
         *  Standard 2 phase constructor
williamr@2
    95
         *  @param aNamespaceURI    namespace URI for the service pattern.
williamr@2
    96
         */
williamr@2
    97
        IMPORT_C static CSenServicePattern* NewLC(const TDesC8& aNamespaceURI);
williamr@2
    98
williamr@2
    99
        /**
williamr@2
   100
         *  Standard 2 phase constructor.
williamr@2
   101
         *  @param aEndPoint    service pattern endpoint.
williamr@2
   102
         *  @param aContract    service pattern contract.
williamr@2
   103
         */
williamr@2
   104
        IMPORT_C static CSenServicePattern* NewL(   const TDesC8& aEndPoint,
williamr@2
   105
                                                    const TDesC8& aContract );
williamr@2
   106
williamr@2
   107
        /**
williamr@2
   108
         *  Standard 2 phase constructor.
williamr@2
   109
         *  @param aEndPoint    service pattern endpoint.
williamr@2
   110
         *  @param aContract    service pattern contract.
williamr@2
   111
         */
williamr@2
   112
        IMPORT_C static CSenServicePattern* NewLC(  const TDesC8& aEndPoint,
williamr@2
   113
                                                    const TDesC8& aContract );
williamr@2
   114
        
williamr@2
   115
        /**
williamr@2
   116
        * Destructor.
williamr@2
   117
        */
williamr@2
   118
        IMPORT_C virtual ~CSenServicePattern();
williamr@2
   119
williamr@2
   120
        // New functions
williamr@2
   121
        
williamr@2
   122
        /**
williamr@2
   123
        * Convenience method for writing out the consumer policy as XML
williamr@2
   124
        * in UTF-8 form.
williamr@2
   125
        * @since Series60 3.0
williamr@2
   126
        * @return consumer policy as UTF-8 form XML.
williamr@2
   127
        */ 
williamr@2
   128
        IMPORT_C HBufC8* ConsumerPolicyAsXmlL();
williamr@2
   129
        
williamr@2
   130
        // Functions from base classes
williamr@2
   131
        
williamr@2
   132
        // From CSenXmlServiceDescription 
williamr@2
   133
        
williamr@2
   134
        /**
williamr@2
   135
        * Compares that both service description and possible
williamr@2
   136
        * policy inside of it matches with this instance.
williamr@2
   137
        * @since Series60 3.0
williamr@2
   138
        * @param aPattern   the service description to compare to
williamr@2
   139
        * @return ETrue both service description and policy information
williamr@2
   140
        *         matches, otherwise EFalse. If some value is not set 
williamr@2
   141
        *         in current instance, it is not compared.
williamr@2
   142
        */
williamr@2
   143
        IMPORT_C TBool Matches(MSenServiceDescription& aServicePattern);
williamr@2
   144
        
williamr@2
   145
        /**
williamr@2
   146
        * Callback function which implements the XML content handler interface.
williamr@2
   147
        * Parses the consumer policies independently.
williamr@2
   148
        * @since Series60 3.0
williamr@2
   149
        * @param aNsUri         The namespace URI of the new element
williamr@2
   150
        * @param aLocalName     The local name of the new element
williamr@2
   151
        * @param aQName         The qualified name of the new element
williamr@2
   152
        * @param aAttributes    The attributes of the new element
williamr@2
   153
        */
williamr@2
   154
        IMPORT_C void StartElementL(const TDesC8& aNsUri,
williamr@2
   155
                                    const TDesC8& aLocalName,
williamr@2
   156
                                    const TDesC8& aQName,
williamr@2
   157
                                    const RAttributeArray& aAttributes);
williamr@2
   158
                                
williamr@2
   159
        // From MSenConsumerPolicy 
williamr@2
   160
        IMPORT_C virtual void SetConsumerIapIdL(TUint32 aIapId);
williamr@2
   161
        IMPORT_C virtual TInt ConsumerIapId(TUint32& aCurrentIapId);
williamr@2
   162
        IMPORT_C virtual void SetConsumerIdentityProviderIdsL(
williamr@2
   163
                                    CSenIdentityProviderIdArray8& aList);
williamr@2
   164
    
williamr@2
   165
        IMPORT_C virtual TInt AddConsumerIdentityProviderIdL(
williamr@2
   166
                                                        const TDesC8& aProviderId);
williamr@2
   167
williamr@2
   168
        IMPORT_C virtual const CSenIdentityProviderIdArray8&
williamr@2
   169
                                                ConsumerIdentityProviderIds8L();
williamr@2
   170
williamr@2
   171
        IMPORT_C virtual TBool AcceptsConsumerPolicy(
williamr@2
   172
                                            MSenConsumerPolicy& aPolicyPattern);
williamr@2
   173
williamr@2
   174
        IMPORT_C virtual TInt RebuildFromConsumerPolicy(
williamr@2
   175
                                                    MSenConsumerPolicy& aTemplate);
williamr@2
   176
        
williamr@2
   177
    protected:  // New functions
williamr@2
   178
        
williamr@2
   179
        /**
williamr@2
   180
        * C++ constructor.
williamr@2
   181
        * @since Series60 3.0
williamr@2
   182
        * @param aType enumeration defininng the type of this class.
williamr@2
   183
        */
williamr@2
   184
        IMPORT_C CSenServicePattern(
williamr@2
   185
                            MSenServiceDescription::TDescriptionClassType aType);
williamr@2
   186
        
williamr@2
   187
        /**
williamr@2
   188
        * Base constructor offered to sub class implementations.
williamr@2
   189
        * @since Series60 3.0
williamr@2
   190
        */
williamr@2
   191
        IMPORT_C void BaseConstructL();
williamr@2
   192
williamr@2
   193
        /**
williamr@2
   194
        * Base constructor offered to sub class implementations.
williamr@2
   195
        * @since Series60 3.0
williamr@2
   196
        * @param aNamespaceURI the localname for XML element representation
williamr@2
   197
        *        of this class.
williamr@2
   198
        */
williamr@2
   199
        IMPORT_C void BaseConstructL(const TDesC8& aNamespaceURI);
williamr@2
   200
williamr@2
   201
        /**
williamr@2
   202
        * Base constructor offered to sub class implementations.
williamr@2
   203
        * @since Series60 3.0
williamr@2
   204
        * @param aEndPoint is the actual endpoint to the service
williamr@2
   205
        * @param aContract of the service, typically some URI
williamr@2
   206
        */
williamr@2
   207
        IMPORT_C void BaseConstructL(const TDesC8& aEndPoint, const TDesC8& aContract);
williamr@2
   208
        
williamr@2
   209
	public:
williamr@2
   210
		/**
williamr@2
   211
        * Sets the Consumer SNAP ID.
williamr@2
   212
        * @param aSnapId  A TUint32 Snap ID
williamr@2
   213
        */
williamr@2
   214
        IMPORT_C void SetConsumerSnapIdL(TUint32 aSnapId);
williamr@2
   215
		/**
williamr@2
   216
        * Gets the Consumer SNAP ID.
williamr@2
   217
        * @param aCurrentSnapId  A TUint32 reference to be filled in with the
williamr@2
   218
        *                       value of the SNAP ID.
williamr@2
   219
        * @return               KErrNone if no error, or some of the system
williamr@2
   220
        *                       wide error codes.
williamr@2
   221
        */
williamr@2
   222
        IMPORT_C TInt ConsumerSnapId(TUint32& aCurrentSnapId);
williamr@2
   223
		
williamr@2
   224
    protected:  // Data
williamr@2
   225
    
williamr@2
   226
        // Consumer policy class instance, used as a delegate in parsing
williamr@2
   227
        CSenConsumerPolicy* iConsumerPolicy;
williamr@2
   228
    };
williamr@2
   229
williamr@2
   230
#endif SEN_SERVICE_PATTERN_H
williamr@2
   231
williamr@2
   232
// End of File