webservices/wsframework/inc/msenservicemanager.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_SERVICE_MANAGER_H
       
    26 #define M_SEN_SERVICE_MANAGER_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include <e32std.h>
       
    30 #include <flogger.h> // RFileLogger
       
    31 #include <badesca.h> // CDesCArray etc
       
    32 
       
    33 #include "msentransportfactory.h"
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CSenXmlReader;
       
    37 class MSenServiceDescription;
       
    38 class MSenIdentityManager;
       
    39 class MSenRemoteServiceConsumer;
       
    40 class CSenWSDescription;
       
    41 class CSenServiceSession;
       
    42 class CSenIdentityProvider;
       
    43 class CSenBaseFragment;
       
    44 class MSenProviderPolicy;
       
    45 class MSenConsumerPolicy;
       
    46 class RStringPool;
       
    47 class CSenInternalCredential;
       
    48 class RSenCredentialPtr;
       
    49 
       
    50 // DATA TYPES
       
    51 typedef RPointerArray<CSenWSDescription> RWSDescriptionArray;
       
    52 typedef RPointerArray<CSenInternalCredential> RSenCredentialArray;
       
    53 typedef RArray<RSenCredentialPtr> RSenCredentialPtrArray;
       
    54 
       
    55 // CLASS DECLARATION
       
    56 
       
    57 /**
       
    58 * MSenServiceManager represents the client side interface of a
       
    59 * CoreServiceManager
       
    60 * The methods defined in this interface may executed from a client
       
    61 * (ServiceConnection) via the server-side session (SenClientSession).
       
    62 * Note that the singleton CoreServiceManager also has a number of public
       
    63 * methods (defined in MSenCoreServiceManager interface) that are used by
       
    64 * e.g. plug-ins, that are expected to operate in the same process as the
       
    65 * CoreServiceManager.
       
    66 */
       
    67 class MSenServiceManager : public MSenTransportFactory
       
    68     {
       
    69     public:
       
    70     
       
    71         // New functions
       
    72         
       
    73         /**
       
    74         * @param aServiceConnection is the ServiceConnection to 
       
    75         * be initialized. Method attempts to initialize connection
       
    76         * according to a pattern, which this service manager receives.
       
    77         * Pattern is spesified by some service consumer (WSC app's), 
       
    78         * which requests a new connection to be initialized.
       
    79         * Therefore, the new connection should be to a service that
       
    80         * has a service description matching with the pattern.
       
    81         * @param aPattern is a - typically partial - service description
       
    82         * that is used as a search pattern.
       
    83         * @param aErrorMsg may contain the error message (SOAP-ENV or SOAP 
       
    84         * fault) in case that this function is returning an error from service
       
    85         * @return KErrNone or a system-wide error code, if error occurred.
       
    86         */
       
    87         virtual TInt InitServiceConnectionL( MSenRemoteServiceConsumer& aServiceConsumer,
       
    88                                              CSenWSDescription& aPattern,
       
    89                                              HBufC8*& aErrorMsg) = 0;
       
    90         /**
       
    91         * Search for services whose service descriptions using a contract URI.
       
    92         * @param   aMatches is the list into which 0 or more ServiceDescriptions
       
    93         * will be appended, if one or more matches are found. Onership of the
       
    94         * appended pointers is not transferred to the caller.
       
    95         * @param   aContract is the URI which specifies the searhed contract.
       
    96         * @return KErrNone if successful, or otherwise a system-wide error code.
       
    97         */
       
    98         virtual TInt ServiceDescriptionsL( RWSDescriptionArray& aMatches,
       
    99                                            const TDesC8& aContract ) = 0;
       
   100         
       
   101         /**
       
   102         * Search for services with a matching ServiceDescription,
       
   103         * which can contain any combination of contract, endpoint and facets.
       
   104         * @param   aMatches is the list into which 0 or more service descriptions
       
   105         * will be appended. Ownership of appended pointers is not transferred to
       
   106         * the caller.
       
   107         * @param aPattern is the service description used as "search pattern", 
       
   108         * as a kind of "search mask". This means, that it is typically a "partial"
       
   109         * service description, which fields include only those fields that need
       
   110         * to match - the content of other fields (elements) is not relevant to
       
   111         * the caller.
       
   112         * @return KErrNone if successful, or otherwise a system-wide error code.
       
   113         */
       
   114         virtual TInt ServiceDescriptionsL( RWSDescriptionArray& aMatches,
       
   115                                            MSenServiceDescription& aPattern ) = 0;
       
   116 
       
   117         /**
       
   118         * Used by applications to inform the Service Manager about a service,
       
   119         * for example about an Authentication Service, which typically cannot
       
   120         * be discovered through other means.
       
   121         * @param aServiceDescription which is being registered.
       
   122         * @return KErrNone if registration was successful or otherwise:
       
   123         *  a system error
       
   124         */
       
   125         virtual TInt RegisterServiceDescriptionL( CSenWSDescription* apServiceDescription ) = 0;
       
   126 
       
   127         /**
       
   128         * Used by application to to inform the Service Manager about a service
       
   129         * which no longer is available. The ServiceManager will remove the
       
   130         * service from its database as soon as it is no longer used.
       
   131         * @param aServiceDescription
       
   132         * @return KErrNone if registration succeeded or otherwise some system-wide
       
   133         * error code.
       
   134         */
       
   135         virtual TInt UnregisterServiceDescriptionL( MSenServiceDescription& aServiceDescription ) = 0;
       
   136 
       
   137         /**
       
   138         * Method attempts to find new framework using given FrameworkId. If framework ECOM
       
   139         * is found, the a pointer to it's configuration reader (fragment) is returned, or
       
   140         * NULL otherwise.
       
   141         */
       
   142         virtual CSenBaseFragment* InstallFrameworkL( const TDesC8& aFrameworkId ) = 0;
       
   143 
       
   144         /**
       
   145         * Return the XML reader instance used and owned by this Core Service Manager
       
   146         */
       
   147         virtual CSenXmlReader* XMLReader() = 0;
       
   148 
       
   149         /**
       
   150         * @return totally randomly generated (but not cryptographically strong)
       
   151         * GUID. The GUID is based on the MD5 hash of a random number and the 
       
   152         * current time. 
       
   153         */
       
   154         virtual HBufC8* RandomGuidL() = 0;
       
   155 
       
   156         /*
       
   157         * @return pointer to the file logger owned by this Core Service Manager
       
   158         */
       
   159         virtual RFileLogger* Log() const = 0;
       
   160 
       
   161         virtual void IncrementConnections() = 0;
       
   162         virtual void DecrementConnections() = 0;
       
   163 
       
   164         /**
       
   165         * Register an IdentityProvider for the current active Identity.
       
   166         * Ownerships is transferred. Method is typically implemented
       
   167         * by some Identity Manager which this Core Service Manager knows.
       
   168         * @param aIdp a registered IdentityProvider
       
   169         * @return KErrNone or system-wide error code.
       
   170         */
       
   171         virtual TInt RegisterIdentityProviderL( CSenIdentityProvider* aIdp ) = 0;
       
   172 
       
   173         /**
       
   174         * Unregister an IdentityProvider for the current active Identity.
       
   175         * Method is typically implemented by some Identity Manager which 
       
   176         * this Core Service Manager knows.
       
   177         * @param aIdp an unregistered IdentityProvider
       
   178         * @return true if successful.
       
   179         */
       
   180         virtual TBool UnregisterIdentityProviderL( CSenIdentityProvider& aIdp ) = 0;
       
   181 
       
   182         /**
       
   183         * Associate a service to an IdentityProvider.
       
   184         * @param aServiceID the contract or endpoint of a service
       
   185         * @param aProviderID the id of an IdentityProvider
       
   186         * @return true if successful. Failure may be caused by non-existence
       
   187         * of the IdentityProvider for the current user.
       
   188         */
       
   189         virtual TBool AssociateServiceL( const TDesC8& aServiceID,
       
   190                                          const TDesC8& providerID ) = 0;
       
   191 
       
   192         /**
       
   193          * Dissociate a service from an IdentityProvider.
       
   194          * @param aServiceID the contract or endpoint of a service
       
   195          * @param aProviderID the id of an IdentityProvider
       
   196          * @return true if successful. Failure may be caused by non-existence
       
   197          * of the IdentityProvider for the current user.
       
   198          */
       
   199         virtual TBool DissociateServiceL( const TDesC8& aServiceID,
       
   200                                           const TDesC8& aProviderID ) = 0;
       
   201 
       
   202         virtual void SetShowPasswordDialog( const TBool aState ) = 0;
       
   203 
       
   204         /**
       
   205          *  Check if there is an existing service description with identical data
       
   206          *  already in the database. The service description in the database can
       
   207          *  contain more information than the pattern, but all the pattern 
       
   208          *  information MUST match exactly for a match.
       
   209          *  @param  aContains contains the boolean value in return, ETrue if found,
       
   210          *          EFalse if not
       
   211          *  @param  aPattern the service description data to be searched.
       
   212          *  @return KErrNone or other system-wide Symbian error codes.
       
   213          */
       
   214         virtual TInt ContainsServiceDescriptionL( TBool& aContains,
       
   215                                                   CSenWSDescription& aPattern ) = 0;
       
   216 
       
   217         /**
       
   218          *  Check if there is an existing identity provider with identical data
       
   219          *  already in the database. The identity provider in the database can
       
   220          *  contain more information than the pattern identity provider, 
       
   221          *  but all the pattern information MUST match exactly for a match.
       
   222          *  @param  aContains contains the boolean value in return, ETrue if found,
       
   223          *          EFalse if not
       
   224          *  @param  aPattern the identity provider data to be searched.
       
   225          *  @return KErrNone or other system-wide Symbian error codes.
       
   226          */
       
   227         virtual TInt ContainsIdentityProviderL( TBool& aContains,
       
   228                                                 CSenIdentityProvider& aIDP) = 0;
       
   229 
       
   230         /**
       
   231         * Notifies all framework plug-ins about certain event
       
   232         * @param aEvent is the event code passed to all plug-ins
       
   233         * @return some system-wide error code, if an error occurred
       
   234         */
       
   235         virtual TInt NotifyFrameworksL( const TInt aEvent ) = 0;
       
   236 
       
   237         /**
       
   238         * Notifies all framework plug-ins about certain event and
       
   239         * object.
       
   240         * @param aEvent is the event code passed to all plug-ins
       
   241         * @param aArgument is an additional object pointer may be
       
   242         * passed. NULL is also accepted.
       
   243         * @return some system-wide error code, if an error occurred
       
   244         */
       
   245         virtual TInt NotifyFrameworksL( const TInt aEvent, 
       
   246                                         TAny* aArgument ) = 0;
       
   247 
       
   248 
       
   249         /**
       
   250         * Notifies only those frameworks plug-ins, which match
       
   251         * with given framework ID (aFrameworkID)
       
   252         * @param aEvent is the event code passed to certain plug-ins
       
   253         * @param aFrameworkID spesifies which frameworks are need to
       
   254         * be notified. Note, that if aFrameworkID is KNullDesC8 
       
   255         * (zero-length),then all known framework plug-ins are notified
       
   256         * about the event.
       
   257         * @return some system-wide error code, if an error occurred
       
   258         */
       
   259         virtual TInt NotifyFrameworksL( const TDesC8& aFrameworkID,
       
   260                                         const TInt aEvent ) = 0;
       
   261 
       
   262         /**
       
   263         * Notifies only those frameworks plug-ins, which match
       
   264         * with given framework ID (aFrameworkID) and 
       
   265         * an additional object pointer may be passed
       
   266         * NULL is also accepted
       
   267         * @param aEvent is the event code passed to certain plug-ins
       
   268         * @param aFrameworkID spesifies which frameworks are need to
       
   269         * be notified. Note, that if aFrameworkID is KNullDesC8 
       
   270         * (zero-length),then all known framework plug-ins are notified
       
   271         * about the event.
       
   272         * @param aArgument is an additional object pointer may be
       
   273         * passed. NULL is also accepted.
       
   274         * @return some system-wide error code, if an error occurred
       
   275         */
       
   276         virtual TInt NotifyFrameworksL( const TDesC8& aFrameworkID,
       
   277                                         const TInt aEvent,
       
   278                                         TAny* aArgument ) = 0;
       
   279 
       
   280         /**
       
   281         * Calculates the size of service descriptions, in bytes.
       
   282         * Internally, this method calls WriteAsXMLToL() from each
       
   283         * service description instance found inside aArray.
       
   284         *
       
   285         * @param aArray contains the service descriptions, which
       
   286         * size in XML is requested.
       
   287         * @return total amount of bytes that XML representation of
       
   288         *         service descriptions included in aArray take.
       
   289         *
       
   290         * In case of error, this method will leaves and passes on
       
   291         * the system-wide error code in question.
       
   292         */
       
   293         virtual TInt SizeOfServiceDescriptionsL( RWSDescriptionArray& aArray ) = 0;
       
   294         
       
   295         /**
       
   296         * Calculates the size of credentials, in bytes.
       
   297         * Internally, this method calls WriteAsXMLToL() from each
       
   298         * credential instance found inside aArray.
       
   299         *
       
   300         * @param aArray contains the credentials, which size in
       
   301         *               XML is requested.
       
   302         * @return       total amount of bytes that XML representation
       
   303         *               of credentials included in aArray take.
       
   304         *
       
   305         * In case of error, this method will leaves and passes on
       
   306         * the system-wide error code in question.
       
   307         */
       
   308         virtual TInt SizeOfCredentialsL( RSenCredentialArray& aArray ) = 0;
       
   309         virtual TInt SizeOfIdentityProvidersL(const RPointerArray<CSenIdentityProvider>& aArray) = 0;
       
   310 
       
   311 
       
   312         /**
       
   313         * Getter for WSF-wide string pool. Any subcomponent utilizing
       
   314         * a string pool based API should use this instance, which is
       
   315         * owned by service manager implementation behind this interface.
       
   316         * @return RStringPool reference to string pool owned by the manager
       
   317         *
       
   318         */
       
   319         virtual RStringPool& StringPool() = 0;
       
   320 
       
   321         /**
       
   322         * Method attempts to add an entry to the list of active hostlet connection
       
   323         * endpoints.
       
   324         * @param aEndpoint is the identifier, typically some URN, representing the
       
   325         *        endpoint. It is expected to be locally unique. MSenRemoteHostlet
       
   326         *        implementations typically call this method to figure out whether
       
   327         *        the endpoint proposed by actual Hostlet Connection is available
       
   328         *        or not. In case of error, that error is then normally propagated
       
   329         *        all the way back to the public API, so that constructor -- 
       
   330         *        CSenHostletConnection::NewL will leave.
       
   331         * @return KErrNone if add succeeded
       
   332         *         KErrSenEndpointReserved, if the endpoint is already allocated 
       
   333         *         for some other hostlet connection.
       
   334         * Note: KErrSenEndpointReserved is defined in SenHostletConnection.h
       
   335         */
       
   336 //        virtual TInt AddActiveHostletConnectionEndpointL(const TDesC8& aEndpoint) = 0;
       
   337 
       
   338         /**
       
   339         * Removes entry from the list of active hostlet connection endpoints.
       
   340         * @param aEndpoint is the identifier, typically some URN, representing the
       
   341         *        endpoint. MSenRemoteHostlet impelemtations typically call this method
       
   342         *        when the hostlet connection (server-side session) is being de-allocated.
       
   343         * @return KErrNone if add succeeded
       
   344         *         KErrSenEndpointReserved, if the endpoint is already allocated 
       
   345         *         for some other hostlet connection.
       
   346         * Note: KErrSenEndpointReserved is defined in SenHostletConnection.h
       
   347         */
       
   348 //        virtual TInt RemoveActiveHostletConnectionEndpoint(const TDesC8& aEndpoint) = 0;
       
   349 
       
   350         virtual TInt NextTransactionId() = 0;
       
   351         
       
   352 		virtual TInt CredentialsL( const CSenWSDescription& aPattern,
       
   353 								   RSenCredentialArray& aCredentials ) = 0;
       
   354 
       
   355 		virtual TInt CredentialsL( const CSenWSDescription& aPattern,
       
   356 								   const CSenIdentityProvider& aIdP,
       
   357 								   RSenCredentialArray& aCredentials ) = 0;
       
   358 
       
   359 		virtual TInt CredentialsL( const CSenWSDescription& aPattern,
       
   360 								   RSenCredentialPtrArray& aCredentials ) = 0;
       
   361 
       
   362 		virtual TInt CredentialsL( const CSenWSDescription& aPattern,
       
   363 								   const CSenIdentityProvider& aIdP,
       
   364 								   RSenCredentialPtrArray& aCredentials ) = 0;
       
   365 
       
   366 		virtual RSenCredentialPtr AddCredentialL( CSenInternalCredential* apCredential,
       
   367 		                                           TInt& aErrorTo ) = 0;
       
   368 
       
   369 		virtual RSenCredentialPtr AddCredentialL( CSenIdentityProvider* apIdP,
       
   370 									               CSenInternalCredential* apCredential,
       
   371 									               TInt& aErrorTo ) = 0;
       
   372 
       
   373 		virtual RSenCredentialPtr AddCredentialL( const TDesC8& aCredential,
       
   374 		                                           TInt& aErrorTo ) = 0;
       
   375 
       
   376 		virtual RSenCredentialPtr AddCredentialL( CSenIdentityProvider* apIdP,
       
   377 									               const TDesC8& aCredential,
       
   378 									               TInt& aErrorTo ) = 0;
       
   379 
       
   380 		virtual TInt RemoveCredentialsL( const CSenWSDescription& aPattern ) = 0;
       
   381 
       
   382 		virtual TInt RemoveCredentialsL( const CSenWSDescription& aPattern,
       
   383 										 const CSenIdentityProvider& aIdP ) = 0;
       
   384         
       
   385         virtual TInt RemoveCredentialsL(const TDesC8& aProviderId) = 0;
       
   386 										
       
   387         virtual TInt RemoveCredentialL( TInt aInternalCredentialId ) = 0; //codescannerwarnings
       
   388         
       
   389         virtual RSenCredentialPtr CredentialL( TInt aInternalCredentialId,
       
   390                                                TInt& aErrorTo ) = 0;
       
   391 
       
   392         virtual RSenCredentialPtr UpdateCredentialL( TInt aInternalCredentialId,
       
   393                                                      CSenInternalCredential* apCredential,
       
   394                                                      TInt& aErrorTo ) = 0;
       
   395         
       
   396         virtual RSenCredentialPtr UpdateCredentialL( TInt aInternalCredentialId,
       
   397                                                      const TDesC8& aCredential,
       
   398                                                      TInt& aErrorTo ) = 0;
       
   399 										
       
   400         virtual TInt FindMatchingIdentityProviderL( CSenIdentityProvider &aIdp,
       
   401                                                     CSenIdentityProvider*& apMatch ) = 0;
       
   402                                                    
       
   403         virtual TInt UpdateIdentityProviderL( CSenIdentityProvider& aIdp ) = 0;
       
   404         
       
   405         virtual TInt NextConnectionID() = 0;
       
   406     };
       
   407 
       
   408 #endif // M_SEN_SERVICE_MANAGER_H
       
   409 
       
   410 // End of File