websrv_pub/web_service_description_api/inc/MSenConsumerPolicy.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:        This abstract class defines consumer policy interface.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef M_SEN_CONSUMER_POLICY_H
       
    26 #define M_SEN_CONSUMER_POLICY_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include <e32base.h> // for CActive
       
    30 #include <badesca.h>
       
    31 #include <SenDomFragment.h>
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CSenIdentityProviderIdArray8;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 *  This abstract class defines consumer policy interface.
       
    40 *  The consumer policy sets the conditions in which some service provider 
       
    41 *  is capable to operate in. It is defining context, through which these
       
    42 *  (possibly remote) services may be contacted and used.
       
    43 *  The actual properties may include transport layer settings, like 
       
    44 *  predefined Internet Access Point (IAP) ID. In addition, consumer policy
       
    45 *  may declare, that certain service should only be contacted using certain
       
    46 *  identity provider (in ID-WSF). This can be achieved by mapping certain 
       
    47 *  list of IDP IDs to a consumer policy. 
       
    48 *  A consumer policy is effective only for a single session, and thus it
       
    49 *  applies to one service connection only. This means, that this policy
       
    50 *  information is "private", and not shared between different WSC applications
       
    51 *  using WSF, event though they might be using the same (remote) service at the
       
    52 *  same time. Consumer policy properties are not serialized in any WSF
       
    53 *  database, but resides in memory only.
       
    54 *
       
    55 *   Example structure of ConsumerPolicy XML fragment:
       
    56 *
       
    57 *   <ConsumerPolicy>
       
    58 *       <Transport>
       
    59 *           <IapId>
       
    60 *               2
       
    61 *           </IapId>
       
    62 *       </Transport>
       
    63 *       <IdentityProviderIDs strict="false">
       
    64 *           <IdentityProviderID>
       
    65 *             urn:first.example.idp.com
       
    66 *           </IdentityProviderID>
       
    67 *           <IdentityProviderID>
       
    68 *             urn:second.example.idp.com
       
    69 *           </IdentityProviderID>
       
    70 *       </IdentityProviderIDs>
       
    71 *   </ConsumerPolicy>
       
    72 *
       
    73 *  @lib SenServDesc.lib
       
    74 *  @since Series60 3.0
       
    75 */
       
    76 class MSenConsumerPolicy
       
    77     {
       
    78     public: // New functions
       
    79         
       
    80         /**
       
    81         * Setter for Internet Access Point (IAP) ID existing in CommDB.
       
    82         * @since Series60 3.0
       
    83         * @param aIapId IAP ID
       
    84         */ 
       
    85         virtual void SetConsumerIapIdL(TUint32 aIapId) = 0;
       
    86 
       
    87         /**
       
    88         * Getter for IAP ID.
       
    89         * @since Series60 3.0
       
    90         * @param aCurrentIapId  will contain the current 
       
    91         *                       Internet Access Point ID
       
    92         * @return
       
    93         *  - KErrNone if <IapId> element is found and has valid content
       
    94         *  - KErrNotFound if no <IapId> element has been found or it has
       
    95         *       no content
       
    96         *  - TLex error codes, if <IapId> element has non-numeric value,
       
    97         *    which cannot be resolved
       
    98         */ 
       
    99         virtual TInt ConsumerIapId(TUint32& aCurrentIapId) = 0;
       
   100 
       
   101         /**
       
   102         * Setter for consumer identity provider IDs. Overrides current values 
       
   103         * with the given values from the array. If an ID does not exist, it
       
   104         * will be added. 
       
   105         * @since Series60 3.0
       
   106         * @param aList  list of identity provider IDs.
       
   107         */ 
       
   108         virtual void SetConsumerIdentityProviderIdsL(
       
   109                                         CSenIdentityProviderIdArray8& aList) = 0;
       
   110 
       
   111         /**
       
   112         * Adds a new Identity provider ID value at the end of the current list
       
   113         * values. 
       
   114         * @since Series60 3.0
       
   115         * @param aProviderId unique ProviderID as UTF-8 descriptor
       
   116         * @return   KErrAlreadyExists, if a duplicate is tried to add
       
   117         *           KErrArgument if a zero-length descriptor is tried to add
       
   118         *           (aProviderId.Length() == 0)
       
   119         */
       
   120         virtual TInt AddConsumerIdentityProviderIdL(const TDesC8& aProviderId) = 0;
       
   121 
       
   122         /**
       
   123         * Rebuilds the consumer policy of this service pattern from the given
       
   124         * consumer policy.
       
   125         * @since Series60 3.0
       
   126         * @param aTemplate  the consumer policy to rebuild from.
       
   127         * @return KErrNone or other system-wide Symbian error codes.
       
   128         */
       
   129         virtual TInt RebuildFromConsumerPolicy(MSenConsumerPolicy& aTemplate) = 0;
       
   130 
       
   131         /**
       
   132         * Getter for Identity provider IDs.
       
   133         * @since Series60 3.0
       
   134         * @return a list of IDP arrays if such value(s) have been set
       
   135         *         or an empty array if no IDP:s have been specified.
       
   136         */ 
       
   137         virtual const CSenIdentityProviderIdArray8& 
       
   138                                             ConsumerIdentityProviderIds8L() = 0;
       
   139 
       
   140         /**
       
   141         * Checks if the policy of this service pattern accepts given policy.
       
   142         * @since Series60 3.0
       
   143         * @param aPolicyPattern the consumer policy to check.
       
   144         * @return ETrue if accepts, EFalse if not
       
   145         */
       
   146         virtual TBool AcceptsConsumerPolicy(MSenConsumerPolicy& aPolicyPattern) = 0;        
       
   147     };
       
   148 
       
   149 #endif //M_SEN_CONSUMER_POLICY_H
       
   150 
       
   151 // End of File
       
   152 
       
   153