|
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: Each application that connects WS-stack through client-server |
|
15 * interface has an application context of it's own, which can |
|
16 * hold a list for active connections and service sessions, |
|
17 * acting as a common place holder and bridge between the |
|
18 * smaller (contexts) that those contain. Class allows |
|
19 * application-wide information to be shared efficiently |
|
20 * at proper layer. |
|
21 * |
|
22 */ |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 #ifndef SEN_SERVER_CONTEXT_H |
|
32 #define SEN_SERVER_CONTEXT_H |
|
33 |
|
34 |
|
35 // INCLUDES |
|
36 #include <e32base.h> |
|
37 #include <e32std.h> |
|
38 //#include "SenContext.h" |
|
39 #include "senpointermap.h" // pointer map is internal/ado: Utils\inc |
|
40 |
|
41 #include "sencoreservicemanager.h" |
|
42 |
|
43 // FORWARD DECLARATIONS |
|
44 class CSenApplicationContext; |
|
45 class CSenCoreServiceManager; |
|
46 |
|
47 |
|
48 // TYPE DEFS |
|
49 typedef RSenPointerMap<TUint32, CSenApplicationContext> RApplicationCtxMap; |
|
50 |
|
51 // CLASS DECLARATION |
|
52 class CSenServerContext : public CBase // CSenContext |
|
53 { |
|
54 public: |
|
55 /** |
|
56 * Standard 2-phased constructor |
|
57 * @return pointer to new context. |
|
58 */ |
|
59 IMPORT_C static CSenServerContext* NewL(MSenCoreServiceManager& aCore); |
|
60 /** |
|
61 * Standard 2-phased constructor |
|
62 * @return pointer to new context, |
|
63 * which is left on cleanupstack. |
|
64 */ |
|
65 IMPORT_C static CSenServerContext* NewLC(MSenCoreServiceManager& aCore); |
|
66 |
|
67 // Destructor: |
|
68 IMPORT_C virtual ~CSenServerContext(); |
|
69 |
|
70 // New methods: |
|
71 //TInt AddApplicationContext(CSenApplicationContext& aCtx); // takes ownership |
|
72 |
|
73 // This method either creates a new ctx or returns existing one. |
|
74 // When application context is created, it is added to server context. |
|
75 virtual CSenApplicationContext& OpenApplicationContextL(TSecureId aSecureId); |
|
76 |
|
77 // Closes the application context, but ONLY if it does not have any clients |
|
78 // When application context is closed, it is removed from server context. |
|
79 virtual TInt CloseApplicationContext(const CSenApplicationContext& aCtx); |
|
80 |
|
81 // Getter for core |
|
82 virtual MSenCoreServiceManager& Core(); |
|
83 |
|
84 protected: |
|
85 IMPORT_C CSenServerContext(MSenCoreServiceManager& aCore); |
|
86 |
|
87 IMPORT_C void BaseConstructL(); |
|
88 |
|
89 private: // Data |
|
90 RApplicationCtxMap iApplications; |
|
91 MSenCoreServiceManager& iCore; |
|
92 |
|
93 }; |
|
94 |
|
95 #endif // SEN_SERVER_CONTEXT_H |
|
96 |
|
97 // End of File |