webservices/wsstar/wsstarplugin/src/wsstarpolicyhandler.cpp
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2006-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:           
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 #include <e32std.h>
       
    28 #include "wsstarpolicyhandler.h"
       
    29 
       
    30 #include "senpointermap.h"
       
    31 #include "wspolicy.h"
       
    32 #include "sendebug.h"
       
    33 #include "wsstardictionary.h"
       
    34 #include "MSenServicePolicy.h"
       
    35 #include "wsstarpolicymanager.h"
       
    36 #include "senlogger.h"
       
    37 
       
    38 //---------------------------------------------------------------------------
       
    39 // Create instance of concrete ECOM interface implementation
       
    40 //---------------------------------------------------------------------------
       
    41 //
       
    42 CWSStarPolicyHandler* CWSStarPolicyHandler::NewL(TAny* aHandlerCtx)
       
    43     {    
       
    44     MSenHandlerContext* handlerCtx = reinterpret_cast<MSenHandlerContext*>(aHandlerCtx);
       
    45     CWSStarPolicyHandler* self   = new (ELeave) CWSStarPolicyHandler(*handlerCtx);
       
    46     CleanupStack::PushL (self);
       
    47     self->ConstructL();
       
    48     CleanupStack::Pop(self);
       
    49     return self;
       
    50     }
       
    51 
       
    52 
       
    53 //---------------------------------------------------------------------------
       
    54 // Constructor
       
    55 //---------------------------------------------------------------------------
       
    56 //
       
    57 CWSStarPolicyHandler::CWSStarPolicyHandler(MSenHandlerContext& aCtx):CSenSessionHandler(aCtx)
       
    58     {
       
    59     }
       
    60 
       
    61 //---------------------------------------------------------------------------
       
    62 // Destructor
       
    63 //---------------------------------------------------------------------------
       
    64 //
       
    65 CWSStarPolicyHandler::~CWSStarPolicyHandler()
       
    66     {
       
    67     TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("~CWSStarPolicyHandler::~CWSStarPolicyHandler()")));
       
    68     delete iPolicyManager;
       
    69     }
       
    70 
       
    71 //---------------------------------------------------------------------------
       
    72 // Second phase construction.
       
    73 //---------------------------------------------------------------------------
       
    74 //
       
    75 void CWSStarPolicyHandler::ConstructL()
       
    76     {
       
    77     TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("CWSStarPolicyHandler::ConstructL()")));
       
    78     iPolicyManager = CWSStarPolicyManager::NewL((TAny*)&iHandlerContext);
       
    79     }
       
    80 
       
    81 //---------------------------------------------------------------------------
       
    82 // the most emergent method in message handler interface.
       
    83 // Each sub-class must implement this method thus providing message processing routine.
       
    84 //---------------------------------------------------------------------------
       
    85 //
       
    86 TInt CWSStarPolicyHandler::InvokeL(MSenSessionContext& /*aCtx*/)
       
    87     {
       
    88     TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("CWSStarPolicyHandler::InvokeL(MSenMessageContext& aCtx)")));
       
    89 //This method will be impelented when we want to apply some particular policy on some session
       
    90 //right now we wil just use the InvokeL(const TDesC8& aContract) method to register a contract for Policy
       
    91     return KErrNone;
       
    92     }
       
    93 
       
    94 //---------------------------------------------------------------------------
       
    95 // 
       
    96 //---------------------------------------------------------------------------
       
    97 //  
       
    98 TInt CWSStarPolicyHandler::InvokeL(const TDesC8& aContract)
       
    99     {
       
   100     TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("CWSStarPolicyHandler::InvokeL(MSenMessageContext& aCtx)")));
       
   101     return iPolicyManager->InvokeL(aContract);
       
   102     }
       
   103 //---------------------------------------------------------------------------
       
   104 // 
       
   105 //---------------------------------------------------------------------------
       
   106 //           
       
   107 TInt CWSStarPolicyHandler::UnRegisterWsPolicyL(MSenServiceDescription& aServiceDescription)
       
   108     {
       
   109     TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("CWSStarPolicyHandler::UnRegisterWsPolicyL")));
       
   110     TInt error(KErrGeneral);
       
   111     return iPolicyManager->UnRegisterWsPolicyL(aServiceDescription, error);
       
   112     }
       
   113 //---------------------------------------------------------------------------
       
   114 // 
       
   115 //---------------------------------------------------------------------------
       
   116 //           
       
   117 TInt CWSStarPolicyHandler::PolicyConsumerAddedL(CSenServiceSession* aNewSession, MSenRemoteServiceConsumer& aRemoteConsumer)
       
   118     {
       
   119     TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("CWSStarPolicyHandler::PolicyConsumerAddedL")));
       
   120     return iPolicyManager->PolicyConsumerAddedL(aNewSession,aRemoteConsumer);
       
   121     }    
       
   122 //---------------------------------------------------------------------------
       
   123 // 
       
   124 //---------------------------------------------------------------------------
       
   125 //       
       
   126 TInt CWSStarPolicyHandler::DownloadPolicyL(CSenWSDescription* apArgument)
       
   127     {
       
   128     return iPolicyManager->DownloadPolicyL( apArgument );
       
   129     }
       
   130 
       
   131 //---------------------------------------------------------------------------
       
   132 // 
       
   133 //---------------------------------------------------------------------------
       
   134 //  
       
   135 CSenElement* CWSStarPolicyHandler::PolicyL(MSenServiceDescription* aSD)	//codescannerwarnings
       
   136     {
       
   137         return iPolicyManager->PolicyL(aSD);	//codescannerwarnings
       
   138     }
       
   139 //---------------------------------------------------------------------------
       
   140 // 
       
   141 //---------------------------------------------------------------------------
       
   142 //      
       
   143 CSenElement* CWSStarPolicyHandler::PolicyL(const TDesC8& aUri)	//codescannerwarnings
       
   144     {
       
   145         return iPolicyManager->PolicyL(aUri);	//codescannerwarnings
       
   146     }        
       
   147 //---------------------------------------------------------------------------
       
   148 // 
       
   149 //---------------------------------------------------------------------------
       
   150 //       
       
   151 TInt CWSStarPolicyHandler::UpdatePolicyL()
       
   152     {
       
   153     return iPolicyManager->UpdatePolicyL(this);
       
   154     }
       
   155 
       
   156 //---------------------------------------------------------------------------
       
   157 // 
       
   158 //---------------------------------------------------------------------------
       
   159 //       
       
   160 SenHandler::THandlerDirection CWSStarPolicyHandler::Direction() const
       
   161     {
       
   162     return SenHandler::EBoth;
       
   163     }
       
   164 
       
   165 //---------------------------------------------------------------------------
       
   166 // 
       
   167 //---------------------------------------------------------------------------
       
   168 //    
       
   169 SenHandler::THandlerPhase CWSStarPolicyHandler::Phase()
       
   170     {
       
   171     return SenHandler::EValidate;
       
   172     }
       
   173 
       
   174 //---------------------------------------------------------------------------
       
   175 // Init implementation
       
   176 //---------------------------------------------------------------------------
       
   177 //
       
   178 TInt CWSStarPolicyHandler::InitL(MSenHandlerContext& aCtx)
       
   179     {
       
   180     iHandlerContext = aCtx;
       
   181     return KErrNone;
       
   182     }
       
   183 
       
   184 //---------------------------------------------------------------------------
       
   185 // 
       
   186 //---------------------------------------------------------------------------
       
   187 //    
       
   188 RFileLogger* CWSStarPolicyHandler::Log() const
       
   189     {
       
   190     RFileLogger* pLog = NULL;
       
   191     TRAP_IGNORE( pLog = (RFileLogger*)iHandlerContext.GetAnyL(HandlerContextKey::KLogger); )
       
   192     return pLog;
       
   193     }
       
   194 void CWSStarPolicyHandler::DataTrafficDetails(TSenDataTrafficDetails& aDetails) 		          
       
   195 	{
       
   196 	iPolicyManager->DataTrafficDetails(aDetails);
       
   197 	}
       
   198 // END OF FILE
       
   199 
       
   200