|
1 /* |
|
2 * Copyright (c) 2008-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: JavaDataAccess |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef JAVADATAACCESS_H |
|
20 #define JAVADATAACCESS_H |
|
21 |
|
22 #include <stdio.h> |
|
23 #include <string> |
|
24 |
|
25 #include "javaosheaders.h" |
|
26 #include "javastorageexception.h" |
|
27 |
|
28 namespace java |
|
29 { |
|
30 namespace comms |
|
31 { |
|
32 class CommsMessage; |
|
33 } // end namespace comms |
|
34 namespace storage |
|
35 { |
|
36 |
|
37 /** |
|
38 * JavaDataAccess is JavaStorage internal API to hide different communications |
|
39 * between storage server processes. |
|
40 */ |
|
41 class JavaDataAccess |
|
42 { |
|
43 public: |
|
44 |
|
45 virtual ~JavaDataAccess() {} |
|
46 |
|
47 /** |
|
48 * Create API instance. |
|
49 * |
|
50 * @return Instance to JavaDataAccess API. Ownership is transfered to |
|
51 * caller. |
|
52 * @throws JavaStorageException if communication channel creation fails. |
|
53 */ |
|
54 OS_IMPORT static JavaDataAccess* createInstance() |
|
55 throw(JavaStorageException); |
|
56 |
|
57 /** |
|
58 * Open storage connection. If storage does not exist create it. |
|
59 * |
|
60 * @param aStorageName Name of the storage |
|
61 * @throws JavaStorageException if communication fails. |
|
62 */ |
|
63 virtual void open(const std::string& aHeaders, |
|
64 const std::string& aStorageName, |
|
65 comms::CommsMessage& aReceivedMessage) |
|
66 throw(JavaStorageException) = 0; |
|
67 |
|
68 /** |
|
69 * Close storage connection and free its resources. |
|
70 * |
|
71 * @param aHeaders message headers. |
|
72 * @param aReceivedMessage received message. |
|
73 * @throws JavaStorageException if communication fails. |
|
74 */ |
|
75 virtual void close(const std::string& aHeaders, |
|
76 comms::CommsMessage& aReceivedMessage) |
|
77 throw(JavaStorageException) = 0; |
|
78 |
|
79 /** |
|
80 * Execute SQL statement to storage. |
|
81 * |
|
82 * @param aHeaders message headers. |
|
83 * @param aSqlStatement SQL statement. |
|
84 * @throws JavaStorageException if communication fails. |
|
85 */ |
|
86 virtual void execute(const std::string& aHeaders, |
|
87 const std::wstring& aSqlStatement, |
|
88 comms::CommsMessage& aReceivedMessage) |
|
89 throw(JavaStorageException) = 0; |
|
90 }; |
|
91 |
|
92 } // end namespace storage |
|
93 } // end namespace java |
|
94 |
|
95 #endif // JAVADATAACCESS_H |
|
96 |