epoc32/include/mw/msenservicedescription.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:        Interface (abstract) class for subclasses implementing the 
williamr@2
    15
*                most common value objects used in WSF, which are used to
williamr@2
    16
*                describe some invocable service. 
williamr@2
    17
*
williamr@2
    18
*/
williamr@2
    19
williamr@2
    20
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
williamr@2
    25
williamr@2
    26
williamr@2
    27
#ifndef M_SEN_SERVICE_DESCRIPTION_H
williamr@2
    28
#define M_SEN_SERVICE_DESCRIPTION_H
williamr@2
    29
williamr@2
    30
//  INCLUDES
williamr@2
    31
#include <e32base.h>
williamr@2
    32
#include <e32des8.h>    
williamr@2
    33
#include <s32strm.h>
williamr@2
    34
williamr@2
    35
// CONSTANTS
williamr@2
    36
_LIT8(KSenFacetValFalse,                "false");
williamr@2
    37
_LIT8(KSenFacetValTrue,                 "true");
williamr@2
    38
williamr@2
    39
// Facet identifier (URN) constants:
williamr@2
    40
_LIT8(KCompleteMessagesFacet,           "urn:nokia.com.serene:complete-messages");
williamr@2
    41
_LIT8(KExposeLocalServiceFacet,         "urn:nokia.com.serene:expose");
williamr@2
    42
_LIT8(KProviderSharableFacet,           "urn:nokia.com.serene.provider:sharable");
williamr@2
    43
_LIT8(KProviderCompleteClientMsgsFacet, "urn:nokia.com.serene.provider:complete-client-messages") ;
williamr@2
    44
_LIT8(KProviderLoadOnStartupFacet,      "urn:nokia.com.serene.provider:load-on-startup") ;
williamr@2
    45
_LIT8(KProviderThreadsafeFacet,         "urn:nokia.com.serene.provider:threadsafe") ;
williamr@2
    46
_LIT8(KProviderReinitializableFacet,    "urn:nokia.com.serene.provider:re-initializable") ;
williamr@2
    47
_LIT8(KProviderStayOnBackgroundFacet,   "urn:nokia.com.serene.provider:stay-on-background") ;
williamr@2
    48
_LIT8(KTransportClassFacet,             "urn:nokia.com:serene:transport:class");
williamr@2
    49
williamr@2
    50
// Transport plug-in types (ECOM cues / class types):
williamr@2
    51
_LIT8(KSenTransportCueHTTP,              "com.nokia.wsf.transport.plugin.httpchannel");
williamr@2
    52
_LIT8(KSenTransportCueVirtualTCP,        "com.nokia.wsf.transport.plugin.virtualtcp"); 
williamr@2
    53
_LIT8(KSenTransportCueLocalEcom,         "com.nokia.wsf.transport.plugin.local");  
williamr@2
    54
_LIT8(KSenTransportCueHostletConnection, "com.nokia.wsf.transport.plugin.hostlet");
williamr@2
    55
williamr@2
    56
// Transport schemes
williamr@2
    57
_LIT8(KSenTransportSchemeHTTP,              "http");
williamr@2
    58
_LIT8(KSenTransportSchemeTCP,               "tcp");
williamr@2
    59
_LIT8(KSenTransportSchemeLocal,             "local");
williamr@2
    60
_LIT8(KSenTransportSchemeHostlet,           "hostlet");
williamr@2
    61
//_LIT8(KSenTransportSchemeVirtualTCP,        "vtcp"); 
williamr@2
    62
williamr@2
    63
const TInt KSenServiceDescriptionBaseScore = 100;
williamr@2
    64
williamr@2
    65
// FORWARD DECLARATIONS
williamr@2
    66
class CSenFacet;
williamr@2
    67
williamr@2
    68
// DATA TYPES
williamr@2
    69
typedef RPointerArray<CSenFacet> RFacetArray;
williamr@2
    70
williamr@2
    71
// CLASS DECLARATION
williamr@2
    72
williamr@2
    73
/**
williamr@2
    74
* Interface (abstract) class for subclasses implementing the  most common value
williamr@2
    75
* objects used in WSF, which are used to describe some invocable service. 
williamr@2
    76
* All of the subclasses are capable of representing themselves in XML.
williamr@2
    77
* @lib SenServDesc.lib
williamr@2
    78
* @since Series60 3.0
williamr@2
    79
*/
williamr@2
    80
class MSenServiceDescription
williamr@2
    81
    {
williamr@2
    82
    public: 
williamr@2
    83
        
williamr@2
    84
        /**
williamr@2
    85
        * DescriptionClassType enumeration.
williamr@2
    86
        */
williamr@2
    87
        IMPORT_C enum TDescriptionClassType
williamr@2
    88
            {
williamr@2
    89
            ERoot                               = 0, // not in use
williamr@2
    90
            EBaseServiceDescription             = 1, // not in use
williamr@2
    91
            EXmlServiceDescription              = 2,
williamr@2
    92
            EIdentityProvider                   = 3, 
williamr@2
    93
            EServicePattern                     = 4, 
williamr@2
    94
            EServiceSession                     = 5,
williamr@2
    95
            EWebServiceSession                  = 6,
williamr@2
    96
            EBasicWebServiceSession             = 7,
williamr@2
    97
            EIdWSFServiceSession                = 8,
williamr@2
    98
            EIdWsfServiceInstance               = 9, 
williamr@2
    99
            ECoreServiceConsumer                = 10,
williamr@2
   100
            ESenInternalServiceConsumer         = 11,
williamr@2
   101
            EIdWsfAuthenticationServiceClient   = 12,
williamr@2
   102
            EIdWsfDiscoveryServiceClient        = 13,
williamr@2
   103
            ERestServiceSession                 = 14,
williamr@2
   104
            EWSStarServiceSession               = 15,
williamr@2
   105
            EWSStarSTSClient                    = 16,
williamr@2
   106
            EWSStarPolicyClient                 = 17,
williamr@2
   107
            EWSDescription                      = 18,
williamr@2
   108
            EWSPattern                          = 19,
williamr@2
   109
            EAtomPubServiceSession              = 20,
williamr@2
   110
            EAtomPubAuthClient                  = 21,
williamr@2
   111
            EAccount                            = 22,
williamr@2
   112
            EOviServiceSession                  = 23,
williamr@2
   113
            EOviOAuthClient                     = 24
williamr@2
   114
            };
williamr@2
   115
williamr@2
   116
        // New functions
williamr@2
   117
    
williamr@2
   118
        /**
williamr@2
   119
        * The DescriptionClassType() method is used to resolve the real
williamr@2
   120
        * subclass type in cases where instance of that class is seen
williamr@2
   121
        * through one of its superclass interfaces. 
williamr@2
   122
        * @since Series60 3.0
williamr@2
   123
        * @return TDescriptionClassType enumeration identifying the class.
williamr@2
   124
        */
williamr@2
   125
        virtual TDescriptionClassType DescriptionClassType() = 0;
williamr@2
   126
williamr@2
   127
        /**
williamr@2
   128
        * Method returns ETrue if this service description matches the given 
williamr@2
   129
        * pattern.
williamr@2
   130
        * The bits of information that are in the pattern are read and compared
williamr@2
   131
        * to corresponding fields in this service description. Note that a pattern
williamr@2
   132
        * may have far fewer fields and that only the non-null and non-zero-length
williamr@2
   133
        * fields are compared.
williamr@2
   134
        * For example, assume that a pattern with only a contract was defined;
williamr@2
   135
        * with  the contract set to "urn:example.com:service". Each
williamr@2
   136
        * service description with the same contract will match the pattern,
williamr@2
   137
        * even if such a service description has non-null/non-zero-length fields
williamr@2
   138
        * for other aspects.
williamr@2
   139
        * @since Series60 3.0
williamr@2
   140
        * @param    aPattern is a Service Description, typically with partial
williamr@2
   141
        *           information.
williamr@2
   142
        * @return TBool ETrue if match, EFalse otherwise. If the value is
williamr@2
   143
        * not found from current instance, it is not used in comparison
williamr@2
   144
        * (even if offered in the given pattern).
williamr@2
   145
        */
williamr@2
   146
        virtual TBool Matches(MSenServiceDescription& aPattern) = 0;
williamr@2
   147
williamr@2
   148
        /**
williamr@2
   149
        * Getter for contract, which is typically some URI.
williamr@2
   150
        * @since Series60 3.0
williamr@2
   151
        * @return the Contract
williamr@2
   152
        */
williamr@2
   153
        virtual TPtrC8 Contract() = 0;
williamr@2
   154
williamr@2
   155
        /**
williamr@2
   156
        * Method for checking if service description has a certain facet.
williamr@2
   157
        * @since Series60 3.0
williamr@2
   158
        * @param aURI       the facet to check, typically some URI.
williamr@2
   159
        * @param aHasFacet  is ETrue if facet is found and EFalse, if not.
williamr@2
   160
        * @return       KErrNone or other system-wide Symbian error codes.
williamr@2
   161
        */
williamr@2
   162
        virtual TInt HasFacetL(const TDesC8& aURI, TBool& aHasFacet) = 0;
williamr@2
   163
williamr@2
   164
        /*
williamr@2
   165
        * Method for getting a facet value  from the service description 
williamr@2
   166
        * @since Series60 3.0
williamr@2
   167
        * @param aURI           the facet to get
williamr@2
   168
        * @param aValueTo       a ref-to-pointer into which the value will
williamr@2
   169
        *                       be allocated, which ownership is transferred
williamr@2
   170
        *                       to the caller.
williamr@2
   171
        * @return       KErrNone 
williamr@2
   172
        *               KErrNoMemory value couldn't be allocated due to lack 
williamr@2
   173
        *               of memory
williamr@2
   174
        *               KErrNotFound if the wanted facet was not found.
williamr@2
   175
        *               Other system-wide Symbian error codes.
williamr@2
   176
        */
williamr@2
   177
        virtual TInt FacetValue(TDesC8& aURI, HBufC8*& aValueTo) = 0;
williamr@2
   178
williamr@2
   179
        /**
williamr@2
   180
        * Method for adding a facet. Will NOT override an already
williamr@2
   181
        * existing facet with a same name.
williamr@2
   182
        * @since Series60 3.0
williamr@2
   183
        * @param        aFacet is the one to be added. A copy of the 
williamr@2
   184
        *               the original facet instance will be added.
williamr@2
   185
        * @return       KErrNone or other system-wide Symbian error codes.
williamr@2
   186
        *               KErrAlreadyExists if a facet with same name exists
williamr@2
   187
        */
williamr@2
   188
        virtual TInt AddFacetL(const CSenFacet& aFacet) = 0;
williamr@2
   189
williamr@2
   190
        /**
williamr@2
   191
        * Method for setting a facet.Adds a new facet, if non-existent.
williamr@2
   192
        * But, if a facet with same name exists, it will be overridden.
williamr@2
   193
        * @since Series60 3.0
williamr@2
   194
        * @param        aFacet to be set. A copy of the original will be
williamr@2
   195
        *               created.
williamr@2
   196
        * @return       KErrNotFound if facet can not be found
williamr@2
   197
        *               KErrNone     if facet was found
williamr@2
   198
        *               KErrNoMemory if no memory could be allocated for the value
williamr@2
   199
        *               Other system-wide Symbian error codes.
williamr@2
   200
        */
williamr@2
   201
        virtual TInt SetFacetL(const CSenFacet& aFacet) = 0;
williamr@2
   202
williamr@2
   203
        /**
williamr@2
   204
        * Removes a characteristic (Facet) from the description
williamr@2
   205
        * @since Series60 3.0
williamr@2
   206
        * @param        aURI of the facet to be removed. 
williamr@2
   207
        * @return       KErrNone     if a Facet was successfully removed
williamr@2
   208
        *               KErrNotFound if a Facet could not be found
williamr@2
   209
        *               Other system-wide Symbian error codes.
williamr@2
   210
        */
williamr@2
   211
        virtual TInt RemoveFacet(const TDesC8& aURI) = 0;
williamr@2
   212
williamr@2
   213
        /**
williamr@2
   214
        * Method for getting all facets. Copies characteristics (Facets)
williamr@2
   215
        * from the description into array. For each characteristic (Facet)
williamr@2
   216
        * found in array the HasFacetL() method should return "ETrue".
williamr@2
   217
        * @since Series60 3.0
williamr@2
   218
        * @param        aFacetArray is typically an empty array, into where 
williamr@2
   219
        *               copies of facets will be added. Ownership of the 
williamr@2
   220
        *               items in this array is transferred to the caller.
williamr@2
   221
        * @return       KErrNone or other system-wide Symbian error codes.
williamr@2
   222
        */
williamr@2
   223
        virtual TInt FacetsL(RFacetArray& aFacetArray) = 0;
williamr@2
   224
williamr@2
   225
        /**
williamr@2
   226
        * This leaving variant of ScoreMatch() always returns a positive integer 
williamr@2
   227
        * if this service description matches with the given pattern in at
williamr@2
   228
        * least one aspect. Higher numbers mean closer match.
williamr@2
   229
        *
williamr@2
   230
        * In case of system error, method leaves.
williamr@2
   231
        *
williamr@2
   232
        * The bits of information that are in the pattern are read and compared
williamr@2
   233
        * to corresponding fields in this ServiceDescription. Note that a pattern
williamr@2
   234
        * may have far fewer fields and that only the non-null fields are compared.
williamr@2
   235
        * For example, assume that a pattern with only a contract was defined;
williamr@2
   236
        * with the contract set to "urn:example.com:service". 
williamr@2
   237
        * Each ServiceDescription with the same contract will match the pattern,
williamr@2
   238
        * even if such a ServiceDescription has non-null fields for other aspects.
williamr@2
   239
        * @since Series60 3.0
williamr@2
   240
        * @param    aPattern a ServiceDescription, typically with partial
williamr@2
   241
        *           information.
williamr@2
   242
        * @return the score. If nothing matches, returns 0
williamr@2
   243
        */
williamr@2
   244
        virtual TInt ScoreMatchL(MSenServiceDescription& aPattern) = 0;
williamr@2
   245
williamr@2
   246
        /**
williamr@2
   247
        * Getter for endpoint.
williamr@2
   248
        * @since Series60 3.0
williamr@2
   249
        * @return The endpoint.
williamr@2
   250
        */
williamr@2
   251
        virtual TPtrC8 Endpoint() = 0;
williamr@2
   252
williamr@2
   253
        /**
williamr@2
   254
        * Getter for the framework ID.
williamr@2
   255
        * @since Series60 3.0
williamr@2
   256
        * @return The framework ID or KNullDesC8 if no framework is set
williamr@2
   257
        */
williamr@2
   258
        virtual TPtrC8 FrameworkId() = 0;
williamr@2
   259
williamr@2
   260
        /**
williamr@2
   261
        * Getter for the framework version.
williamr@2
   262
        * @since Series60 3.0
williamr@2
   263
        * @return The framework version or KNullDesC8 if not set.
williamr@2
   264
        */
williamr@2
   265
        virtual TPtrC8 FrameworkVersion() = 0;
williamr@2
   266
williamr@2
   267
        /**
williamr@2
   268
        * Setter for contract.
williamr@2
   269
        * @since Series60 3.0
williamr@2
   270
        * @param aContract  the contract to be set.
williamr@2
   271
        */
williamr@2
   272
        virtual void SetContractL(const TDesC8& aContract) = 0;
williamr@2
   273
williamr@2
   274
        /**
williamr@2
   275
        * Setter for endpoint.
williamr@2
   276
        * @since Series60 3.0
williamr@2
   277
        * @param aEndpoint to the service. Note that endpoint cannot 
williamr@2
   278
        *        include characters which are illegal in XML. If endpoint
williamr@2
   279
        *        is an URL which contains illegal characters (like '&'-char),
williamr@2
   280
        *        those need to be encoded into XML entity form (like &amp;).
williamr@2
   281
        *        EncodeHttpCharactersLC() method from XmlUtils can be used
williamr@2
   282
        *        for encoding of basic XML entities.
williamr@2
   283
        */
williamr@2
   284
        virtual void SetEndPointL(const TDesC8& aEndPoint) = 0;
williamr@2
   285
williamr@2
   286
        /**
williamr@2
   287
        * Gets the service description as XML fragment in UTF-8 format.
williamr@2
   288
        * @since Series60 3.0
williamr@2
   289
        * @return the service description as XML, which ownership is
williamr@2
   290
        *         transferred to the caller.
williamr@2
   291
        */
williamr@2
   292
        virtual HBufC8* AsXmlL() = 0;
williamr@2
   293
williamr@2
   294
        /**
williamr@2
   295
        * Gets the service description as XML, in Unicode (UCS-2)
williamr@2
   296
        * @since Series60 3.0
williamr@2
   297
        * @return the service description as XML, in Unicode (UCS-2)
williamr@2
   298
        *         encoding form.
williamr@2
   299
        */
williamr@2
   300
        virtual HBufC* AsXmlUnicodeL() = 0;
williamr@2
   301
williamr@2
   302
        /**
williamr@2
   303
        * Writes this service description as XML, in UTF-8 form to a stream
williamr@2
   304
        * @since Series60 3.0
williamr@2
   305
        * @param aWriteStream   to write into.
williamr@2
   306
        */
williamr@2
   307
        virtual void WriteAsXMLToL(RWriteStream& aWriteStream) = 0;
williamr@2
   308
    };
williamr@2
   309
williamr@2
   310
#endif // M_SEN_SERVICE_DESCRIPTION_H
williamr@2
   311
williamr@2
   312
// End of File