SenXmlServiceDescription.h

Go to the documentation of this file.
00001 /*
00002 * ==============================================================================
00003 *  Name        : SenXmlServiceDescription.h
00004 *  Part of     : Web Services Description
00005 *  Interface   : 
00006 *  Description : Class implements the most common value object used in WSF, 
00007 *                which is used to  describe some invocable service. 
00008 *  Version     : 
00009 *
00010 *  Copyright © 2002-2005 Nokia. All rights reserved.
00011 *  This material, including documentation and any related 
00012 *  computer programs, is protected by copyright controlled by 
00013 *  Nokia. All rights are reserved. Copying, including 
00014 *  reproducing, storing, adapting or translating, any 
00015 *  or all of this material requires the prior written consent of 
00016 *  Nokia. This material also contains confidential 
00017 *  information which may not be disclosed to others without the 
00018 *  prior written consent of Nokia.
00019 * ==============================================================================
00020 */
00021 
00022 #ifndef SEN_XML_SERVICE_DESCRIPTION_H
00023 #define SEN_XML_SERVICE_DESCRIPTION_H
00024 
00025 //  INCLUDES
00026 #include <e32base.h>
00027 #include <e32des8.h>
00028 #include <e32std.h>
00029 #include <MSenServiceDescription.h>
00030 #include <MSenProviderPolicy.h>
00031 #include <SenDomFragment.h>
00032 
00033 // CONSTANTS
00034 const TInt KStateParsingCredentials         = 12;
00035 const TInt KStateParsingSingleCredential    = 122;
00036 const TInt KStateParsingProviderPolicy      = 1222;
00037 const TInt KStateParsingServicePolicy       = 12222;
00038 
00039 _LIT8( KSenAttrSoap12,                  "SOAP12"               );
00040 _LIT8( KSenAttrAddressing,              "Addressing"           );
00041 _LIT8( KSenAttrClientEntropy,           "ClientEntropy"        );
00042 _LIT8( KSenAttrTokenType,               "TokenType"            );
00043 _LIT8( KSenAttrPassportExtensions,      "PassportExtensions"   );
00044 _LIT8( KSenAttrMetadataEndpoint,        "MetadataEndpoint"     );
00045 _LIT8( KSenAttrUsernameTokenOverTLS,    "UsernameTokenOverTLS" );
00046 _LIT8( KSenAttrPromptUserInfo,          "promptUserInfo"       );
00047 
00048 // FORWARD DECLARATIONS
00049 class CSenCredential;
00050 class CSenProviderPolicy;
00051 class CSenServicePolicy;
00052 class MSenServicePolicy;
00053 
00054 // DATA TYPES
00055 typedef RPointerArray<CSenCredential> RCredentialList;
00056 
00057 // CLASS DECLARATION
00058 
00077 class CSenXmlServiceDescription : public CSenDomFragment,
00078                                   public MSenServiceDescription,
00079                                   public MSenProviderPolicy
00080     {
00081     public:  // Constructors and destructor
00082         
00087         IMPORT_C static CSenXmlServiceDescription* NewL();
00088 
00094         IMPORT_C static CSenXmlServiceDescription* NewLC();
00095 
00101         IMPORT_C static CSenXmlServiceDescription* NewL(const TDesC8& aNamespaceURI);
00102 
00109         IMPORT_C static CSenXmlServiceDescription* NewLC(const TDesC8& aNamespaceURI);
00110 
00122         IMPORT_C static CSenXmlServiceDescription* NewL(const TDesC8& aEndPoint,
00123                                                         const TDesC8& aContract);
00124 
00137         IMPORT_C static CSenXmlServiceDescription* NewLC(const TDesC8& aEndPoint,
00138                                                          const TDesC8& aContract);
00139         
00143         IMPORT_C virtual ~CSenXmlServiceDescription();
00144 
00145         // New functions
00146 
00159         IMPORT_C void SetFrameworkIdL(const TDesC8& aFrameworkID);
00160 
00168         IMPORT_C virtual const TDesC8& NewElementName();
00169         
00176         IMPORT_C  RCredentialList& Credentials();        
00177 
00178         // Functions from base classes
00179     
00180         // From MSenProviderPolicy
00181         IMPORT_C virtual void SetIapIdL(TUint32 aIapId);
00182         IMPORT_C virtual TInt IapId(TUint32& aCurrentIapId);
00183         IMPORT_C virtual void SetIdentityProviderIdsL(
00184                                         CSenIdentityProviderIdArray8& aList);
00185                 IMPORT_C TInt SetTransportPropertiesL(const TDesC8& aProperties);
00186 
00187         IMPORT_C virtual TInt AddIdentityProviderIdL(TDesC8& aProviderId);
00188         IMPORT_C virtual TInt RebuildFrom(MSenProviderPolicy& aTemplate);
00189         IMPORT_C virtual const CSenIdentityProviderIdArray8&
00190                                                     IdentityProviderIds8L();
00191             IMPORT_C TInt TransportPropertiesL(HBufC8*& aProperties);
00192         
00193         IMPORT_C virtual TBool Accepts(MSenProviderPolicy& aPolicyPattern);
00194         
00195         // From MSenServiceDescription:
00196         IMPORT_C TDescriptionClassType DescriptionClassType();
00197         IMPORT_C TBool Matches(MSenServiceDescription& aPattern);
00198         IMPORT_C TPtrC8 Contract();
00199 
00200         // New method
00208         IMPORT_C virtual TInt HasFacetL(const TDesC8& aURI, TBool& aHasFacet);
00209         
00210         // From MSenServiceDescription
00211         IMPORT_C virtual TInt FacetValue(TDesC8& aURI, HBufC8*& aValueTo);
00212         IMPORT_C virtual TInt AddFacetL(const CSenFacet& aFacet);
00213         IMPORT_C virtual TInt SetFacetL(const CSenFacet& aFacet);
00214         IMPORT_C virtual TInt RemoveFacet(const TDesC8& aURI);
00215         IMPORT_C virtual TInt FacetsL(RFacetArray& aFacetArray);
00216         
00217         // New method
00236         IMPORT_C virtual TInt ScoreMatchL(MSenServiceDescription& aPattern);
00237 
00238         // From MSenServiceDescription
00239 
00240         IMPORT_C TPtrC8 Endpoint();
00241         IMPORT_C TPtrC8 FrameworkId();
00242         IMPORT_C TPtrC8 FrameworkVersion();
00243         IMPORT_C void SetContractL(const TDesC8& aContract);
00244         IMPORT_C void SetEndPointL(const TDesC8& aEndPoint);
00245         
00246         // From CSenBaseFragment 
00247         
00254         IMPORT_C virtual HBufC8* AsXmlL();
00255 
00262         IMPORT_C virtual HBufC* AsXmlUnicodeL();
00263 
00269         IMPORT_C virtual void WriteAsXMLToL(RWriteStream& aWriteStream);
00270 
00271 
00272         // From CSenDomFragment 
00273         
00282         IMPORT_C void SetAttributesL(const RAttributeArray& aAttributes);
00283 
00296         IMPORT_C void ResumeParsingFromL(const TDesC8& aNsUri,
00297                                          const TDesC8& aLocalName,
00298                                          const TDesC8& aQName);
00299                 
00300     protected:  // New functions
00301         
00306         IMPORT_C CSenXmlServiceDescription(TDescriptionClassType aType);
00307         
00311         IMPORT_C void ConstructL();
00312 
00319         IMPORT_C void ConstructL(const TDesC8& aNamespaceURI);
00320 
00332         IMPORT_C void ConstructL(const TDesC8& aEndPoint, const TDesC8& aContract);
00333 
00334         // Functions from base classes
00335         
00336         // From CSenDomFragment 
00337         
00346         IMPORT_C virtual void StartElementL(const TDesC8& aNsUri,
00347                                             const TDesC8& aLocalName,
00348                                             const TDesC8& aQName,
00349                                             const RAttributeArray& aAttributes);
00350 
00351         // From CSenBaseFragment 
00359         IMPORT_C virtual void EndElementL(const TDesC8& aNsUri,
00360                                           const TDesC8& aLocalName,
00361                                       const TDesC8& aQName);
00362                                           
00363     public:
00382         IMPORT_C TBool HasEqualPrimaryKeysL(MSenServiceDescription& aCandidate);
00383 
00384         /*
00385         * Method checks specific pieces of information to determine, whether this
00386         * service description is local or not. Typically this is defined by the
00387         * endpoint's scheme, which is KSenTransportSchemeLocal in most of the cases,
00388         * when this method returns true.
00389         * @return boolean indicating whether this endpoint is local or not.
00390         */
00391         IMPORT_C TBool IsLocalL(); 
00392 
00393 
00394         /*
00395         * Method for binding transport plug-in type with the endpoint in question.
00396         * Function adds/sets XML attribute called "cue" for <Endpoint> element:
00397         *  
00398         *  <ServiceDescription>
00399         *    <Endpoint cue="com.nokia.wsf.transport.plugin.hostlet">
00400         *        local://urn:nokia.com.test.hostlet
00401         *    </Endpoint>
00402         *  </ServiceDescription>
00403         *
00404         * In above example, eventhough endpoint scheme "local://" would normally
00405         * invoke different type of plug-in (ECOM hostlet), the "cue" attribute 
00406         * overrides this, and forces hostlet connection transport plug-in to be
00407         * loaded.
00408         *
00409         * Transport plug-in types (cues):
00410         *
00411         *    _LIT8(KSenTransportCueHTTP,              "com.nokia.wsf.transport.plugin.httpchannel");
00412         *    _LIT8(KSenTransportCueVirtualTCP,        "com.nokia.wsf.transport.plugin.virtualtcp");
00413         *    _LIT8(KSenTransportCueLocalEcom,         "com.nokia.wsf.transport.plugin.local");  
00414         *    _LIT8(KSenTransportCueHostletConnection, "com.nokia.wsf.transport.plugin.hostlet");
00415         *
00416         *
00417         * Note that this method does not attempt to load the plug-in - it might not
00418         * even exist in the system. Neither is this attribute checked when XML service
00419         * description is parsed. As a conclusion, if non-existant plug-ins are bind 
00420         * to endpoints, they will be ignored, and the transport is created in normal
00421         * way and plug-in is chosen based on endpoint scheme and/or defaults.
00422         * 
00423         * @param aTransportCue is the ECOM cue of CSenTransport implementation.
00424         * In ECOM resource files, cue is the value of "default_data" property.
00425         * @return KErrNone on success
00426         *         KErrSenNoEndpoint, if  endpoint element does not exist in this XML
00427         *         service description.
00428         */
00429         IMPORT_C TInt SetTransportCueL(const TDesC8& aTransportCue);
00430 
00431 
00439         IMPORT_C TPtrC8 TransportCue();
00440 
00445         IMPORT_C MSenServicePolicy* ServicePolicy();
00446 
00457         IMPORT_C TInt SetPolicyL(const TDesC8& aName);
00458 
00471         IMPORT_C TInt SetPolicyL(const TDesC8& aName, const TDesC8& aValue);
00472 
00490         IMPORT_C TInt SetPolicyL(const TDesC8& aName, const TDesC8& aValue, const TDesC8& aAttribName, const TDesC8& aAttribValue);
00491 
00499         IMPORT_C TInt SetProviderIdL( const TDesC8& aProviderID );
00500         
00508         IMPORT_C TPtrC8 ProviderId();
00509 
00523         IMPORT_C void CSenXmlServiceDescription::SetPromptUserInfoL( TBool aPromptUserInfoMode );
00524 
00534         IMPORT_C TBool PromptUserInfo();
00535 
00536         public:
00541         IMPORT_C void SetSnapIdL(TUint32 aIapId); 
00549         IMPORT_C TInt SnapId(TUint32& aCurrentIapId); 
00550                 
00551     private:
00552         TInt FacetValueL(TDesC8& aURI, HBufC8*& aValueTo);
00553         TInt RemoveFacetL(const TDesC8& aURI);
00554 
00555     protected: // Data
00556         // the type of this class instance
00557         const TDescriptionClassType iType;
00558 
00559     private: // Data
00560         CSenServicePolicy* iServicePolicy;
00561         CSenCredential* iCredential;
00562         RCredentialList iCredentialList;
00563 
00564         // Timestamp indicating validity of credentials. Using SenDateUtils 
00565         // FromXmlDateTimeL and ToXmlDateTimeUtf8L is recommended for conversions.
00566         TTime iNotOnOrAfter;
00567         CSenProviderPolicy* iProviderPolicy;
00568     };
00569 
00570 #endif // SEN_XML_SERVICE_DESCRIPTION_H
00571 
00572 // End of File
00573 
00574 

Copyright © Nokia Corporation 2001-2007
Back to top