webservices/wsstar/wsstarpolicy/inc/seninternalwspolicy.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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 SEN_INTERNAL_WS_POLICY_H
       
    26 #define SEN_INTERNAL_WS_POLICY_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include <e32base.h>
       
    30 #include <s32strm.h>
       
    31 
       
    32 #include <SenFragmentBase.h>
       
    33 #include <SenDomFragmentBase.h>
       
    34 #include <SenBaseFragment.h>
       
    35 #include <SenDomFragment.h>
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class SenDateUtils;
       
    39 class CSenCredentialIdentifier;
       
    40 class CSenWSDescription;
       
    41 class CSenIdentityProvider;
       
    42 class CSenServiceSession;
       
    43 class CSenFacet;
       
    44 class CSenElement;
       
    45 
       
    46 class CSenWSPolicyProperties;
       
    47 class CSenWSPolicyIdentifier;
       
    48 class CSenWSDescription;
       
    49 class RSenWSPolicyPtr;
       
    50 class CSenWSPolicyMetadata;
       
    51 // CLASS DECLARATION
       
    52 
       
    53 namespace SenWSInternalPolicy
       
    54     {
       
    55 // CONSTANTS
       
    56 
       
    57     _LIT8(KSenWsPolicies,             "SenWsPolicies");
       
    58     _LIT8(KEndpointLocalname,           "Endpoint");
       
    59     _LIT8(KContractLocalname,           "Contract");    
       
    60     _LIT8(KProviderIdLocalName,             "ProviderID");
       
    61     
       
    62     _LIT8(KMetadataEndpointLocalname,           "MetadataEndpoint"); 
       
    63     _LIT8(KMetadataMethodLocalname,           "method");
       
    64     _LIT8(KServicePolicyLocalName,       "ServicePolicy");    
       
    65     _LIT8(KClientPolicyLocalName,       "ClientPolicy");
       
    66     
       
    67     
       
    68     _LIT8(KWsdlDocument, "definitions");
       
    69     _LIT8(KWsdlNsPrefix, "wsdl");
       
    70     _LIT8(KPolicyDocument, "Policy");
       
    71     _LIT8(KPolicyNsPrefix, "wsp");
       
    72     
       
    73     _LIT8(KSenWSPolicyId,                 "WsPolicyId");
       
    74     _LIT8(KSenWSPolicyValidUntil,           "ValidUntil");
       
    75     
       
    76     _LIT8(KSenWsPolicyIdentifierLocalname,"Identifier");
       
    77     _LIT8(KSenWsPolicyProperteisLocalname,"Properties");
       
    78     _LIT8(KSenWSPolicyMetadata,"PolicyMetadata");
       
    79     
       
    80     _LIT8(KWsPoliciesMaxID,        "PolicyMaxID");
       
    81     _LIT8(KWsPolicyContainer,     "SenWsPolicyContainer");
       
    82     
       
    83     }
       
    84 
       
    85 /**
       
    86 * Class implements (web) service policy functionality
       
    87 *  @since Series60 3.0
       
    88 */
       
    89 class CSenInternalWsPolicy : public CSenDomFragment
       
    90     {
       
    91     public:  // Constructors and destructor
       
    92 
       
    93         /**
       
    94         * Basic constructor.
       
    95         *
       
    96         * @since Series60 4.0
       
    97         */
       
    98         static CSenInternalWsPolicy* NewL();
       
    99 
       
   100         /**
       
   101         * Basic constructor.
       
   102         *
       
   103         * @since Series60 4.0
       
   104         */
       
   105         static CSenInternalWsPolicy* NewLC();
       
   106 
       
   107         /**
       
   108         * Basic constructor.
       
   109         *
       
   110         * @since Series60 4.0
       
   111         * @param aNsUri     is the XML namespace of this credential
       
   112         * @param aLocalName is the XML localname of this credential
       
   113         * @param aPrefix    is the prefix of this credential
       
   114         * @param aAttrs     are the XML attributes of this credential
       
   115         */
       
   116         static CSenInternalWsPolicy* NewL(const TDesC8& aNsUri,
       
   117                                             const TDesC8& aLocalName,
       
   118                                             const TDesC8& aQName,
       
   119                                             const RAttributeArray& aAttributes);
       
   120 
       
   121         /**
       
   122         * Basic constructor.
       
   123         *
       
   124         * @since Series60 4.0
       
   125         * @param aNsUri     is the XML namespace of this credential
       
   126         * @param aLocalName is the XML localname of this credential
       
   127         * @param aPrefix    is the prefix of this credential
       
   128         * @param aAttrs     are the XML attributes of this credential
       
   129         */
       
   130         static CSenInternalWsPolicy* NewLC(const TDesC8& aNsUri,
       
   131                                              const TDesC8& aLocalName,
       
   132                                              const TDesC8& aQName,
       
   133                                              const RAttributeArray& aAttributes);
       
   134 
       
   135         /**
       
   136         * Basic constructor.
       
   137         *
       
   138         * @since Series60 4.0
       
   139         * @param aNsUri     is the XML namespace of this credential
       
   140         * @param aLocalName is the XML localname of this credential
       
   141         * @param aPrefix    is the prefix of this credential
       
   142         * @param aAttrs     are the XML attributes of this credential
       
   143         * @param aParent    is the parent XML element of this credential
       
   144         */
       
   145         static CSenInternalWsPolicy* NewL(const TDesC8& aNsUri,
       
   146                                             const TDesC8& aLocalName,
       
   147                                             const TDesC8& aQName,
       
   148                                             const RAttributeArray& aAttributes,
       
   149                                             CSenElement& aParent);
       
   150 
       
   151         /**
       
   152         * Basic constructor.
       
   153         *
       
   154         * @since Series60 4.0
       
   155         * @param aNsUri     is the XML namespace of this credential
       
   156         * @param aLocalName is the XML localname of this credential
       
   157         * @param aPrefix    is the prefix of this credential
       
   158         * @param aAttrs     are the XML attributes of this credential
       
   159         * @param aParent    is the parent XML element of this credential
       
   160         */
       
   161         static CSenInternalWsPolicy* NewLC(const TDesC8& aNsUri,
       
   162                                              const TDesC8& aLocalName,
       
   163                                              const TDesC8& aQName,
       
   164                                              const RAttributeArray& aAttributes,
       
   165                                              CSenElement& aParent);
       
   166 
       
   167         /**
       
   168         * Constructor which copies itself from another credential.
       
   169         *
       
   170         * @since Series60 4.0
       
   171         * @param    aPolicy     credential to copy from.
       
   172         * @return new CSenCredential instance pointer
       
   173         */
       
   174         static CSenInternalWsPolicy* NewL(const CSenInternalWsPolicy& aPolicy);
       
   175 
       
   176         /**
       
   177         * Constructor which copies itself from another credential.
       
   178         *
       
   179         * @since Series60 4.0
       
   180         * @param    aPolicy     credential to copy from.
       
   181         * @return new CSenCredential instance pointer, which is left on
       
   182         *         cleanup stack.
       
   183         */
       
   184         static CSenInternalWsPolicy* NewLC(const CSenInternalWsPolicy& aPolicy);
       
   185 
       
   186         /**
       
   187         * Destructor.
       
   188         */
       
   189         virtual ~CSenInternalWsPolicy();
       
   190 
       
   191         // New functions
       
   192 
       
   193         /**
       
   194         * Method for checking if this credential is applicable for
       
   195         * given pattern.
       
   196         *
       
   197         * @since Series60 4.0
       
   198         * @param    aPattern    pattern to check.
       
   199         * @return   ETrue       if Credential is applicable
       
   200         *           EFalse      if Credential is not applicable
       
   201         */
       
   202         TBool IsApplicableL(CSenWSDescription& aPattern);	//codescannerwarnings
       
   203         TBool IsApplicableL(const TDesC8& aPolicyEndpoint);	//codescannerwarnings
       
   204         TBool IsApplicableL(CSenInternalWsPolicy* aInternalPolicy);	//codescannerwarnings
       
   205         /**
       
   206         * Method for setting CredentialIdentifier.
       
   207         *
       
   208         * @since Series60 4.0
       
   209         * @param    aIdentifier identifier to set.
       
   210         */
       
   211         void SetIdentifier(CSenWSPolicyIdentifier* aIdentifier);
       
   212 
       
   213         /**
       
   214         * Method for getting CredentialIdentifier.
       
   215         *
       
   216         * @since Series60 4.0
       
   217         * @return   Identifier for this Credentiel
       
   218         */
       
   219         CSenWSPolicyIdentifier& IdentifierL();	//codescannerwarnings
       
   220 
       
   221         /**
       
   222         * Method for setting ServiceSession for this Credential.
       
   223         * Setting ServiceSession does build relation between this
       
   224         * Credential and given ServiceSession.
       
   225         *
       
   226         * @since Series60 4.0
       
   227         * @param   aSession             ServiceSession for this Credentiel
       
   228         */
       
   229         void SetSession(CSenServiceSession& aSession);
       
   230 
       
   231         /**
       
   232         * Method for getting ServiceSession which is related to this
       
   233         * Credential.
       
   234         *
       
   235         * @since Series60 4.0
       
   236         * @return   ServiceSession for this Credentiel or NULL
       
   237         *           if related ServiceSession is not set
       
   238         */
       
   239         virtual CSenServiceSession* Session();
       
   240 
       
   241         TBool UpdateMetadataEndpointL(CSenInternalWsPolicy* aInternalPolicy, TInt& aExist);
       
   242         
       
   243         
       
   244         TInt AddMetadataPolicyL(CSenElement* aElement);
       
   245         TInt UpdateMetadataPolicyL(CSenElement* aElement);
       
   246         TInt RemoveMetadataPolicyL(const TDesC8& aUri);
       
   247 //        CSenElement* WsPolicy(const CSenWSDescription& aPattern);
       
   248         CSenElement* WsPolicyByUriL(const TDesC8& aUri);
       
   249         CSenElement* WsPolicyByName(const TDesC8& aName);
       
   250         TTime ValidUntilL(const TDesC8& aUri);
       
   251         
       
   252         
       
   253     private:
       
   254 
       
   255         /**
       
   256         * C++ default constructor.
       
   257         */
       
   258         CSenInternalWsPolicy();
       
   259 
       
   260 
       
   261         /**
       
   262         * By default Symbian 2nd phase constructor is private.
       
   263         *
       
   264         * @since Series60 4.0
       
   265         * @param aNsUri is the XML namespace as UTF-8 descriptor
       
   266         * @param aLocalName is the XML localname as UTF-8 descriptor
       
   267         * @param aQName is the XML qualifiedname as UTF-8 descriptor
       
   268         * @param aAttributes is the list of XML attributes
       
   269         */
       
   270         void ConstructL(const TDesC8& aNsUri,
       
   271                                  const TDesC8& aLocalName,
       
   272                                  const TDesC8& aQName,
       
   273                                  const RAttributeArray& aAttributes);
       
   274 
       
   275         /**
       
   276         * By default Symbian 2nd phase constructor is private.
       
   277         *
       
   278         * @since Series60 4.0
       
   279         * @param aNsUri is the XML namespace as UTF-8 descriptor
       
   280         * @param aLocalName is the XML localname as UTF-8 descriptor
       
   281         * @param aQName is the XML qualifiedname as UTF-8 descriptor
       
   282         * @param aAttributes is the list of XML attributes
       
   283         * @param aParent is the parent element, which may declare other
       
   284         *        namespaces.
       
   285         */
       
   286         void ConstructL(const TDesC8& aNsUri,
       
   287                                  const TDesC8&  aLocalName,
       
   288                                  const TDesC8& aQName,
       
   289                                  const RAttributeArray& aAttributes,
       
   290                                   CSenElement& aParent);
       
   291 
       
   292         /**
       
   293         * By default Symbian 2nd phase constructor is private.
       
   294         *
       
   295         * @since Series60 4.0
       
   296         * @param aPolicy is the source credential to be copied.
       
   297         */
       
   298         void ConstructL(CSenInternalWsPolicy& aPolicy);
       
   299 
       
   300         /**
       
   301         * By default Symbian 2nd phase constructor is private.
       
   302         *
       
   303         * BaseConstructL for setting XML localname for this Credential.
       
   304         * @since Series60 4.0
       
   305         * @param aLocalName XML localname for this Credential
       
   306         */
       
   307         void ConstructL(const TDesC8& aLocalName);
       
   308 
       
   309         // New functions
       
   310 
       
   311         /**
       
   312         * Setter for Credential ID
       
   313         *
       
   314         * @since Series60 4.0
       
   315         * @param aId is the unique ID for this Credential
       
   316         */
       
   317         void SetIdL(const TDesC8& aId);
       
   318 
       
   319         TInt PolicyCountL();	//codescannerwarnings
       
   320         TPtrC8 ExpiryTimeL(CSenElement* aElement); //codescannerwarnings
       
   321 
       
   322     private: // Data
       
   323         CSenWSPolicyIdentifier*   ipIdentifier;
       
   324 //        CSenWSPolicyProperties*   ipProperties;
       
   325         CSenServiceSession*         ipSession;
       
   326                
       
   327     };
       
   328 
       
   329 class CSenWSPolicyProperties : public CSenDomFragment
       
   330     {
       
   331     public:  // Constructors and destructor
       
   332 
       
   333         /**
       
   334         * Basic constructor.
       
   335         *
       
   336         * @since Series60 4.0
       
   337         */
       
   338         static CSenWSPolicyProperties* NewL();
       
   339 
       
   340         /**
       
   341         * Basic constructor.
       
   342         *
       
   343         * @since Series60 4.0
       
   344         */
       
   345         static CSenWSPolicyProperties* NewLC();
       
   346 
       
   347         /**
       
   348         * Basic constructor.
       
   349         *
       
   350         * @since Series60 4.0
       
   351         * @param aNsUri     is the XML namespace of this credential
       
   352         * @param aLocalName is the XML localname of this credential
       
   353         * @param aPrefix    is the prefix of this credential
       
   354         * @param aAttrs     are the XML attributes of this credential
       
   355         */
       
   356         static CSenWSPolicyProperties* NewL(const TDesC8& aNsUri,
       
   357                                                            const TDesC8& aLocalName,
       
   358                                                            const TDesC8& aQName,
       
   359                                                            const RAttributeArray& aAttributes);
       
   360 
       
   361         /**
       
   362         * Basic constructor.
       
   363         *
       
   364         * @since Series60 4.0
       
   365         * @param aNsUri     is the XML namespace of this credential
       
   366         * @param aLocalName is the XML localname of this credential
       
   367         * @param aPrefix    is the prefix of this credential
       
   368         * @param aAttrs     are the XML attributes of this credential
       
   369         */
       
   370         static CSenWSPolicyProperties* NewLC(const TDesC8& aNsUri,
       
   371                                                             const TDesC8& aLocalName,
       
   372                                                             const TDesC8& aQName,
       
   373                                                             const RAttributeArray& aAttributes);
       
   374 
       
   375         /**
       
   376         * Basic constructor.
       
   377         *
       
   378         * @since Series60 4.0
       
   379         * @param aNsUri     is the XML namespace of this credential
       
   380         * @param aLocalName is the XML localname of this credential
       
   381         * @param aPrefix    is the prefix of this credential
       
   382         * @param aAttrs     are the XML attributes of this credential
       
   383         * @param aParent    is the parent XML element of this credential
       
   384         */
       
   385         static CSenWSPolicyProperties* NewL(const TDesC8& aNsUri,
       
   386                                                            const TDesC8& aLocalName,
       
   387                                                            const TDesC8& aQName,
       
   388                                                            const RAttributeArray& aAttributes,
       
   389                                                            CSenElement& aParent);
       
   390 
       
   391         /**
       
   392         * Basic constructor.
       
   393         *
       
   394         * @since Series60 4.0
       
   395         * @param aNsUri     is the XML namespace of this credential
       
   396         * @param aLocalName is the XML localname of this credential
       
   397         * @param aPrefix    is the prefix of this credential
       
   398         * @param aAttrs     are the XML attributes of this credential
       
   399         * @param aParent    is the parent XML element of this credential
       
   400         */
       
   401         static CSenWSPolicyProperties* NewLC(const TDesC8& aNsUri,
       
   402                                                             const TDesC8& aLocalName,
       
   403                                                             const TDesC8& aQName,
       
   404                                                             const RAttributeArray& aAttributes,
       
   405                                                             CSenElement& aParent);
       
   406 
       
   407         /**
       
   408         * Destructor.
       
   409         */
       
   410         virtual ~CSenWSPolicyProperties();
       
   411 
       
   412         /**
       
   413         * Sets new property.
       
   414         *
       
   415         * If property with given name does not exist,
       
   416         * new property with given value will be added. Otherwise the value of
       
   417         * existing property will be updated.
       
   418         *
       
   419         * @since Series60 4.0
       
   420         * @param aName         Name of the property, which can be later used
       
   421         *                      to refer the given value.
       
   422         * @param aValue        Is the value of this property.
       
   423         * @return              KErrNone if no error, or some of the system wide
       
   424         *                      error codes.
       
   425         */
       
   426         TInt SetPropertyL(const TDesC8& aName, const TDesC8& aValue);
       
   427 
       
   428         /**
       
   429         * Gets the value of the property behind certain name.
       
   430         *
       
   431         * @since Series60 4.0
       
   432         * @param aName    The name identifying this property.
       
   433         * @param aValue   A TPtrC8 reference to be filled in with the value of
       
   434         *                 the property.
       
   435         * @return         KErrNone if no error, or some of the system wide
       
   436         *                 error codes.
       
   437         */
       
   438         TInt PropertyL(const TDesC8& aName, TPtrC8& aValue);
       
   439 
       
   440 
       
   441         
       
   442      protected:
       
   443 
       
   444         /**
       
   445         * C++ default constructor.
       
   446         */
       
   447         CSenWSPolicyProperties();
       
   448 
       
   449    };
       
   450 
       
   451 class CSenWSPolicyIdentifier : public CSenWSPolicyProperties
       
   452     {
       
   453     public:  // Constructors and destructor
       
   454 
       
   455         /**
       
   456         * Basic constructor.
       
   457         *
       
   458         * @since Series60 4.0
       
   459         */
       
   460         static CSenWSPolicyIdentifier* NewL();
       
   461 
       
   462         /**
       
   463         * Basic constructor.
       
   464         *
       
   465         * @since Series60 4.0
       
   466         */
       
   467         static CSenWSPolicyIdentifier* NewLC();
       
   468 
       
   469         /**
       
   470         * Basic constructor.
       
   471         *
       
   472         * @since Series60 4.0
       
   473         * @param aNsUri     is the XML namespace of this credential
       
   474         * @param aLocalName is the XML localname of this credential
       
   475         * @param aPrefix    is the prefix of this credential
       
   476         * @param aAttrs     are the XML attributes of this credential
       
   477         */
       
   478         static CSenWSPolicyIdentifier* NewL(const TDesC8& aNsUri,
       
   479                                                        const TDesC8& aLocalName,
       
   480                                                        const TDesC8& aQName,
       
   481                                                           const RAttributeArray& aAttributes);
       
   482 
       
   483         /**
       
   484         * Basic constructor.
       
   485         *
       
   486         * @since Series60 4.0
       
   487         * @param aNsUri     is the XML namespace of this credential
       
   488         * @param aLocalName is the XML localname of this credential
       
   489         * @param aPrefix    is the prefix of this credential
       
   490         * @param aAttrs     are the XML attributes of this credential
       
   491         */
       
   492         static CSenWSPolicyIdentifier* NewLC(const TDesC8& aNsUri,
       
   493                                                         const TDesC8& aLocalName,
       
   494                                                         const TDesC8& aQName,
       
   495                                                         const RAttributeArray& aAttributes);
       
   496 
       
   497         /**
       
   498         * Basic constructor.
       
   499         *
       
   500         * @since Series60 4.0
       
   501         * @param aNsUri     is the XML namespace of this credential
       
   502         * @param aLocalName is the XML localname of this credential
       
   503         * @param aPrefix    is the prefix of this credential
       
   504         * @param aAttrs     are the XML attributes of this credential
       
   505         * @param aParent    is the parent XML element of this credential
       
   506         */
       
   507         static CSenWSPolicyIdentifier* NewL(const TDesC8& aNsUri,
       
   508                                                        const TDesC8& aLocalName,
       
   509                                                        const TDesC8& aQName,
       
   510                                                        const RAttributeArray& aAttributes,
       
   511                                                        CSenElement& aParent);
       
   512 
       
   513         /**
       
   514         * Basic constructor.
       
   515         *
       
   516         * @since Series60 4.0
       
   517         * @param aNsUri     is the XML namespace of this credential
       
   518         * @param aLocalName is the XML localname of this credential
       
   519         * @param aPrefix    is the prefix of this credential
       
   520         * @param aAttrs     are the XML attributes of this credential
       
   521         * @param aParent    is the parent XML element of this credential
       
   522         */
       
   523         static CSenWSPolicyIdentifier* NewLC(const TDesC8& aNsUri,
       
   524                                                         const TDesC8& aLocalName,
       
   525                                                         const TDesC8& aQName,
       
   526                                                         const RAttributeArray& aAttributes,
       
   527                                                         CSenElement& aParent);
       
   528 
       
   529         /**
       
   530         * Destructor.
       
   531         */
       
   532         virtual ~CSenWSPolicyIdentifier();
       
   533 
       
   534         void SetIdL(TInt aId);
       
   535 
       
   536         TInt IdL();
       
   537         
       
   538         TPtrC8 ContractL();  //codescannerwarnings
       
   539         TPtrC8 EndpointL();  //codescannerwarnings
       
   540         TPtrC8 ProviderIdL(); //codescannerwarnings
       
   541         TPtrC8 MetadataEndpointL(); //codescannerwarnings
       
   542         CSenElement* MetadataEndpointElementL(); //codescannerwarnings
       
   543         
       
   544         TInt AddMetadataEndpointL(CSenElement* aElement);
       
   545         TInt UpdateMetadataEndpointL(CSenWSPolicyIdentifier& aIdentifier);
       
   546         
       
   547         static TPtrC8 ElementAttribValueL(CSenElement* aElement, const TDesC8& aName); 
       
   548         static TBool HasAttributeL(CSenElement* aElement, const TDesC8& aName);
       
   549         
       
   550         
       
   551      private:
       
   552 
       
   553         /**
       
   554         * C++ default constructor.
       
   555         */
       
   556         CSenWSPolicyIdentifier();
       
   557    };
       
   558 
       
   559 typedef struct
       
   560     {
       
   561     CSenInternalWsPolicy* ipPolicy;
       
   562     TInt                    iCounter;
       
   563     } TSenWsPolicyData;
       
   564 
       
   565 class RSenWSPolicyPtr
       
   566 	{
       
   567     public:
       
   568 	    void OpenL(CSenInternalWsPolicy* apPolicy);
       
   569 	    CSenInternalWsPolicy* Policy();
       
   570 	    void SetPolicy(CSenInternalWsPolicy* apPolicy);
       
   571 	    RSenWSPolicyPtr Clone();
       
   572 	    void Close();
       
   573 	    void CloseAndDestroyPolicy();
       
   574 
       
   575         /**
       
   576         * C++ default constructor.
       
   577         */
       
   578         RSenWSPolicyPtr();
       
   579 
       
   580     private: // Data
       
   581         TSenWsPolicyData* ipPolicyData;
       
   582 	};
       
   583 
       
   584 #endif // SEN_INTERNAL_WS_POLICY_H
       
   585 
       
   586 // End of File
       
   587 
       
   588