|
1 /* |
|
2 * Copyright (c) 2009 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 #ifndef SERVERCONNECTION_H |
|
19 #define SERVERCONNECTION_H |
|
20 |
|
21 #include <string> |
|
22 |
|
23 namespace java |
|
24 { |
|
25 namespace push |
|
26 { |
|
27 |
|
28 class ConnectionListener; |
|
29 |
|
30 /** |
|
31 * This interface provides functionality open and get/set information related to |
|
32 * protocol connection. Each push capable protocol must implement this interface. |
|
33 */ |
|
34 |
|
35 class ServerConnection |
|
36 { |
|
37 public: |
|
38 |
|
39 virtual ~ServerConnection() {} |
|
40 |
|
41 /** |
|
42 * This operation set listener and opens physical protocol connection. Code execution must not |
|
43 * return from this operation before connection is physically opened. I.e. this method opens |
|
44 * connection synchronously. |
|
45 * Implementation of this operation must prepare situation wherein this operation is called |
|
46 * more than once after connection is already established. In this situation implementation of |
|
47 * this operation must only update a listener. This happens e.g. when push framework |
|
48 * takes listening responsible of the connection from the MIDlet(MIDlet has called |
|
49 * Connection.close() for a server connection). |
|
50 * @param aListener This operation does not take ownership of this pointer. |
|
51 * @throws PushException with COMMON_SRV_CONN_PLUGIN_ERROR error code if |
|
52 * creation of the connection fails. |
|
53 */ |
|
54 virtual void open(ConnectionListener* aListener) = 0; |
|
55 |
|
56 /** |
|
57 * This operation closes physical protocol connection. Closing a connection must be done |
|
58 * synchronously. I.e. code execution must not return from this operation before connection |
|
59 * is physically opened. |
|
60 * Note: ServerConnection must be closed by ServerConnectionFactory::releaseConnection() operation. |
|
61 * This operation does not throw an exception. |
|
62 */ |
|
63 virtual void close() = 0; |
|
64 |
|
65 /** |
|
66 * @return connection URI. |
|
67 */ |
|
68 virtual std::wstring getUri() const = 0; |
|
69 |
|
70 /** |
|
71 * @return filter URI of the push connection. Empty string is returned in the normal |
|
72 * ServerConnection case. |
|
73 */ |
|
74 virtual std::wstring getFilter() const = 0; |
|
75 |
|
76 /** |
|
77 * Sets 'filter' argument for the connection. This method is needed in the situation where |
|
78 * 'normal' ServerConnection has been created before dynamic push registration. |
|
79 */ |
|
80 virtual void setFilter(const std::wstring& aFilter) = 0; |
|
81 |
|
82 }; |
|
83 |
|
84 }//end namespace push |
|
85 }//end namespace java |
|
86 |
|
87 #endif // SERVERCONNECTION_H |