brandingserver/bsserver/cbsserver.h
changeset 0 e6b17d312c8b
child 21 cfd5c2994f10
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     1 /*
       
     2 * Copyright (c) 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: CBSSERVER.H
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CBSSERVER_H__
       
    20 #define __CBSSERVER_H__
       
    21 #include <e32base.h>
       
    22 
       
    23 #include "rbsobjowningptrarray.h"
       
    24 #include "mbsbackupobserver.h"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CBSSession;
       
    28 class CBSStorageManager;
       
    29 class CBSInstallHandler;
       
    30 class CBSBackupObserver;
       
    31 
       
    32 /**
       
    33  * Service server.
       
    34  */
       
    35 NONSHARABLE_CLASS( CBSServer ): public CPolicyServer,
       
    36                                 public MBSBackupObserver
       
    37     {
       
    38     public:
       
    39     	NONSHARABLE_CLASS( CBSFileMapping ): public CBase
       
    40     		{
       
    41     		public:
       
    42 	    		static CBSFileMapping* NewL( CBSSession* aSession,
       
    43 	    									 const TDesC& aFile,
       
    44 	    									 TBool aVersioned );
       
    45 	    		
       
    46 	    		~CBSFileMapping();
       
    47     		private: // constructors 
       
    48 	    		void ConstructL( CBSSession* aSession,
       
    49 								 const TDesC& aFile );
       
    50 	    		CBSFileMapping( TBool aVersioned );
       
    51 			
       
    52 			public: // new methods
       
    53 				CBSSession* Session();
       
    54 				const TDesC& File();
       
    55 				TBool Versioned();
       
    56 				
       
    57 			private: // data
       
    58 				// doesn't own: session
       
    59 				CBSSession* iSession;
       
    60 				HBufC* 		iFile;
       
    61 			  	TBool 		iVersioned;
       
    62     		};
       
    63     	
       
    64     public:     // Execution and destructors
       
    65         static void ExecuteL();
       
    66         virtual ~CBSServer();
       
    67 
       
    68     private:    // C++ constructor
       
    69         CBSServer();
       
    70 
       
    71     protected:     // Methods from CPolicyServer
       
    72 
       
    73         CSession2* NewSessionL( const TVersion& aVersion,
       
    74                                 const RMessage2& aMessage ) const;
       
    75 
       
    76 
       
    77         CPolicyServer::TCustomResult CustomFailureActionL(
       
    78                                 const RMessage2& aMsg,
       
    79                                 TInt aAction,
       
    80                                 const TSecurityInfo& aMissing);
       
    81 
       
    82     public: // From MBSBackupObserver
       
    83     
       
    84         void HandleBackupStateL( TBackupState aState );
       
    85         
       
    86     public:     //New methods
       
    87 	    void SessionCreatedL( CBSSession* aSession );
       
    88 	    void SessionDied( CBSSession* aSession );
       
    89     
       
    90 		TBool MatchSessionL( const TDesC& aApplicationId,
       
    91 							 const TDesC& aBrandId,
       
    92 							 TLanguage aLanguageId,
       
    93 							 CBSSession* aSession,
       
    94 							 TInt aReserved = 0 );
       
    95 							 
       
    96 		TBool MatchSessionUninstallL( const TDesC& aApplicationId,
       
    97 								 const TDesC& aBrandId, CBSSession* aSession);
       
    98 								 							 
       
    99 	    void RegisterFileForSessionL( CBSSession* aSession, 
       
   100 	    							  const TDesC& aFile,
       
   101 	    							  TBool aVersioned );
       
   102 
       
   103 		TArray<CBSServer::CBSFileMapping*> RegisteredFiles();
       
   104 		
       
   105 		TBool FileStillInUse( CBSSession* aSession,
       
   106 							  const TDesC& aFile );
       
   107 
       
   108 		void BrandUpdatedL( const TDesC& aApplicationId,
       
   109 							const TDesC& aBrandId,
       
   110 							TLanguage aLanguageId,
       
   111 							CBSSession* aSession,
       
   112 							TInt aReserved );
       
   113         /**
       
   114          * Displays the info for each open session - except for the one that 
       
   115          * called this method.
       
   116          *
       
   117          * @param aSession the session that called this method
       
   118          * @param aErrorCode a system-wide errorcode which is simply displayed
       
   119          *        by this method
       
   120          */
       
   121         void DisplaySessionInfoL( CBSSession* aSession, TInt aErrorCode );
       
   122 
       
   123 	private: // New methods
       
   124 		void UnRegisterSessionL( CBSSession* aSession );
       
   125 
       
   126 		
       
   127 		void CleanupFileL( const TDesC& aFile );
       
   128 	    
       
   129 	    void InitializeL();
       
   130 	    
       
   131     private:    //Data
       
   132         TInt iSessionCount;
       
   133         RPointerArray<CBSSession> iSessions;
       
   134         RBSObjOwningPtrArray<CBSFileMapping> iFileMapping;
       
   135         CBSStorageManager*		iStorageManager;
       
   136         CBSInstallHandler*      iInstallHandler;
       
   137         
       
   138         // Own. Observer for backup and restore events
       
   139         CBSBackupObserver*      iBackupObserver;
       
   140     };
       
   141 
       
   142 #endif      //  __CBSSERVER_H__
       
   143 
       
   144 
       
   145 //  END OF FILE
       
   146 
       
   147