webservices/wsidentitymanager/inc/msenidentity.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 M_SEN_IDENTITY_H
       
    26 #define M_SEN_IDENTITY_H
       
    27 
       
    28 
       
    29 #include <e32base.h>
       
    30 #include <e32des8.h>    // HBufC8
       
    31 
       
    32 #include <SenIdentityProvider.h>
       
    33 //TYPEDEFS
       
    34 typedef RPointerArray<CSenIdentityProvider> RIdentityProviderList;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 class MSenIdentity
       
    38     {
       
    39     public: // New functions
       
    40     
       
    41         /**
       
    42         * Getter for name.
       
    43         * @return name of the identity
       
    44         */
       
    45         virtual const TDesC8& Name() = 0;
       
    46 
       
    47         /**
       
    48         * Getter for user name.
       
    49         * @return user name of the identity
       
    50         */
       
    51         virtual const TDesC8& UserName() = 0;
       
    52 
       
    53         /**
       
    54         * Getter for type.
       
    55         * @return type of the identity
       
    56         */
       
    57         virtual const TDesC8& Type() = 0;
       
    58 
       
    59         /**
       
    60         * @return the default IdentityProvider of the Identity.
       
    61         */
       
    62         virtual CSenIdentityProvider* IdentityProviderL() = 0;
       
    63 
       
    64         /**
       
    65         * @param aService
       
    66         * @return the IdentityProvider that has the ServiceID
       
    67         * that best mathces the endpoint or providerID
       
    68         * of the given ServiceDescription.
       
    69         */
       
    70         virtual CSenIdentityProvider* IdentityProviderL(
       
    71                                     MSenServiceDescription& aService) = 0;
       
    72         /**
       
    73         * @param aURI
       
    74         * @return the IdentityProvider that has the ServiceID
       
    75         * that best mathces the given URI.
       
    76         */
       
    77         virtual CSenIdentityProvider* IdentityProviderL( const TDesC8& aURI ) = 0;
       
    78 
       
    79         /**
       
    80         * @param aIdpList an array of ProviderIDs
       
    81         * @param strict if set to true only an IdentityProvider from the List
       
    82         * will be returned, and null if none of the list entries is known to the
       
    83         * current active Identity.
       
    84         * @return the currently preferred IdentityProvider
       
    85         * from within the given List with ProviderIDs.
       
    86         */
       
    87         virtual CSenIdentityProvider* IdentityProviderL(
       
    88                                                 const CDesC8Array& aIdpList,
       
    89                                                 TBool aStrict) = 0;
       
    90         /**
       
    91         * @param aService
       
    92         * @param aIdpList an array of ProviderIDs
       
    93         * @param strict if set to true only an IdentityProvider from the List
       
    94         * will be returned, and null if none of the list entries is known to the
       
    95         * current active Identity.
       
    96         * @return the currently preferred IdentityProvider
       
    97         * from within the given List with ProviderIDs.
       
    98         */
       
    99         virtual CSenIdentityProvider* IdentityProviderL(
       
   100                                             MSenServiceDescription& aService,
       
   101                                             const CDesC8Array& aIdpList,
       
   102                                             TBool aStrict) = 0;
       
   103 
       
   104         /**
       
   105         * Checks if Identity already has an identity provider with given data.
       
   106         * Existing identity provider can still have more data than the pattern.
       
   107         * @param    aContains   will contain the boolean value on return. ETrue if
       
   108         *           contains, EFalse otherwise.
       
   109         * @param    aIDP    the pattern identity provider.
       
   110         * @return KErrNone or system-wide error code.
       
   111         */
       
   112         virtual TInt ContainsIdentityProviderL( TBool& aContains,
       
   113                                                 CSenIdentityProvider& aIDP) = 0;
       
   114     
       
   115         /**
       
   116         * Register an IdentityProvider for the current active Identity.
       
   117         * @param aIdp a registered IdentityProvider. Ownership of the
       
   118         * argument is transferred into this class from the caller.
       
   119         * @return KErrNone or system-wide error code.
       
   120         */
       
   121         virtual TInt RegisterIdentityProviderL( CSenIdentityProvider* aIdp ) = 0;
       
   122         
       
   123         virtual TInt UpdateIdentityProviderL(CSenIdentityProvider& aIdp) = 0;
       
   124 
       
   125         /**
       
   126         * Unregister an IdentityProvider for the current active Identity.
       
   127         * @param aIdp an unregistered IdentityProvider
       
   128         * @return   KErrNone        if everything goes OK.
       
   129         *           KErrNotFound    if correct identity provider was not found
       
   130         *           Other error codes are system-wide Symbian error codes.
       
   131         */
       
   132         virtual TInt UnregisterIdentityProviderL( CSenIdentityProvider& aIdp) = 0;
       
   133 
       
   134         /**
       
   135         * Associate a service to an IdentityProvider.
       
   136         * @param aServiceID the contract or endpoint of a service
       
   137         * @param aProviderID the id of an IdentityProvider
       
   138         * @return true if successful. Failure may be caused by non-existence
       
   139         * of the IdentityProvider for the current user.
       
   140         */
       
   141         virtual TBool AssociateServiceL( const TDesC8& aServiceID,
       
   142                                          const TDesC8& aProviderID ) = 0;
       
   143 
       
   144         /**
       
   145         * Dissociate a service from an IdentityProvider.
       
   146         * @param aServiceID the contract or endpoint of a service
       
   147         * @param aProviderID the id of an IdentityProvider
       
   148         * @return true if successful. Failure may be caused by non-existence
       
   149         * of the IdentityProvider for the current user.
       
   150         */
       
   151         virtual TBool DissociateServiceL(const TDesC8& aServiceID,
       
   152                                         const TDesC8& aProviderID ) = 0;
       
   153                                         
       
   154         virtual TInt FindMatchingIdentityProviderL(CSenIdentityProvider &aIdp,
       
   155                                                    CSenIdentityProvider*& apMatch) = 0;
       
   156 
       
   157         /**
       
   158         * Write the Identity as XML into a write stream.
       
   159         * This method is invoked by the IdentityManager when it saves
       
   160         * its state and/or configuration.
       
   161         * Identities should serialize sufficient information
       
   162         * to enabled re-instantiation from the same XML content.
       
   163         */
       
   164         virtual void WriteAsXMLToL(RWriteStream& aWriteStream) = 0;
       
   165 
       
   166         /**
       
   167         * Write the Identity as XML into 8-bit (UTF-8) buffer
       
   168         */
       
   169         virtual HBufC8* AsXmlL() = 0;
       
   170 
       
   171         /**
       
   172         * Write the Identity as XML into 8-bit (Unicode) buffer
       
   173         */
       
   174         virtual HBufC* AsXmlUnicodeL() = 0;
       
   175         
       
   176         virtual const RIdentityProviderList& IdentityProvidersL() const = 0;
       
   177     };
       
   178 
       
   179 #endif // M_SEN_IDENTITY_H
       
   180 
       
   181 // End of File