|
45 | 45 | * with shared access to a database. |
46 | 46 | */ |
47 | 47 | public interface DatabaseClient { |
48 | | - /** |
49 | | - * Starts a transaction. You can pass the transaction to the read(), write(), or delete() methods |
50 | | - * of a document manager or the search() method of a query manager to perform operations within a |
51 | | - * multistatement transaction. |
52 | | - * |
53 | | - * To call openTransaction(), an application must authenticate as rest-writer or rest-admin. |
54 | | - * |
55 | | - * @return a Transaction object identifying and supporting operations on the transaction |
56 | | - */ |
57 | | - Transaction openTransaction() throws ForbiddenUserException, FailedRequestException; |
58 | | - /** |
59 | | - * Starts a transaction with the specified name, which makes the transaction easier to recognize |
60 | | - * when you get status reports. |
61 | | - * |
62 | | - * @param name the transaction name |
63 | | - * @return a Transaction object identifying and supporting operations on the transaction |
64 | | - */ |
65 | | - Transaction openTransaction(String name) throws ForbiddenUserException, FailedRequestException; |
66 | | - /** |
67 | | - * Starts a transaction with the specified name and time limit. If the transaction is not committed |
68 | | - * or rolled back within the specified time, the transaction rolls back automatically. |
69 | | - * |
70 | | - * @param name the transaction name |
71 | | - * @param timeLimit the number of the transaction in seconds |
72 | | - * @return a Transaction object identifying and supporting operations on the transaction |
73 | | - */ |
74 | | - Transaction openTransaction(String name, int timeLimit) throws ForbiddenUserException, FailedRequestException; |
75 | | - |
76 | | - /** |
77 | | - * Creates a document manager for documents with unknown or heterogeneous formats. |
78 | | - * @return a manager supporting generic operations on documents |
79 | | - */ |
80 | | - GenericDocumentManager newDocumentManager(); |
81 | | - /** |
82 | | - * Creates a document manager for documents with a binary format such as images. |
83 | | - * @return a manager supporting operations on binary documents |
84 | | - */ |
85 | | - BinaryDocumentManager newBinaryDocumentManager(); |
86 | | - /** |
87 | | - * Creates a document manager for documents containing a JSON structure. |
88 | | - * @return a manager supporting operations on JSON documents |
89 | | - */ |
90 | | - JSONDocumentManager newJSONDocumentManager(); |
91 | | - /** |
92 | | - * Creates a document manager for documents containing unstructured text. |
93 | | - * @return a manager supporting operations on text documents |
94 | | - */ |
95 | | - TextDocumentManager newTextDocumentManager(); |
96 | | - /** |
97 | | - * Creates a document manager for documents containing XML. |
98 | | - * @return a manager supporting operations on XMLdocuments |
99 | | - */ |
100 | | - XMLDocumentManager newXMLDocumentManager(); |
101 | | - |
102 | | - /** |
103 | | - * Creates a manager for long-running asynchronous write or query jobs. Don't forget |
104 | | - * to call dataMovementManager.release() when you're done with it. |
105 | | - * @return a manager supporting long-running asynchronous write or query jobs |
106 | | - */ |
107 | | - DataMovementManager newDataMovementManager(); |
108 | | - |
109 | | - /** |
110 | | - * Creates a manager to query for database documents. |
111 | | - * @return a manager supporting search operations and lookup of values and tuples in indexes (also known as lexicons) |
112 | | - */ |
113 | | - QueryManager newQueryManager(); |
114 | | - |
115 | | - /** |
116 | | - * Creates a manager to retrieve rows from the database. |
117 | | - * @return a manager supporting plans for processing database rows |
118 | | - */ |
119 | | - RowManager newRowManager(); |
120 | | - |
121 | | - /** |
122 | | - * Creates a manager for building rules and rules-matching applications. |
123 | | - * @return a manager for supporting rules and rule-match operations. |
124 | | - */ |
125 | | - RuleManager newRuleManager(); |
126 | | - |
127 | | - /** |
128 | | - * Creates a manager for configuring the REST server for the database. The |
129 | | - * ServerConfigurationManager can persist query options and transforms or |
130 | | - * set properties of the server. The application must have rest-admin |
131 | | - * privileges to use the ServerConfigurationManager. |
132 | | - * |
133 | | - * @return a manager for the server properties or administrative resources |
134 | | - */ |
135 | | - ServerConfigurationManager newServerConfigManager(); |
136 | | - |
137 | | - /** Creates a manager for CRUD operations on semantic graphs. |
138 | | - * @return the new GraphManager instance |
139 | | - */ |
140 | | - GraphManager newGraphManager(); |
141 | | - |
142 | | - /** Creates a manager for executing SPARQL queries and retrieving results. |
143 | | - * @return the new SPARQLQueryManager instance |
144 | | - */ |
145 | | - SPARQLQueryManager newSPARQLQueryManager(); |
146 | | - |
147 | | - /** |
148 | | - * Creates a PojoRepository specific to the specified class and its id type. |
149 | | - * The PojoRepository provides a facade for persisting, retrieving, and |
150 | | - * querying data contained in Java objects. Annotations are required to |
151 | | - * identify the id field and any fields for which you wish to create indexes. |
152 | | - * |
153 | | - * @param clazz the class type for this PojoRepository to handle |
154 | | - * @param idClass the class type of the id field for this clazz, must obviously |
155 | | - * be Serializable or we'll struggle to marshall it |
156 | | - * @param <T> the pojo type this PojoRepository will manage |
157 | | - * @param <ID> the scalar type of the id for pojos of type <T> |
158 | | - * @return the initialized PojoRepository |
159 | | - **/ |
160 | | - <T, ID extends Serializable> PojoRepository<T, ID> newPojoRepository(Class<T> clazz, Class<ID> idClass); |
161 | | - |
162 | | - /** |
163 | | - * Initializes a manager for a extension resource. |
164 | | - * |
165 | | - * @param resourceName the name of the extension resource |
166 | | - * @param resourceManager the manager for the extension resource |
167 | | - * @param <T> the type of ResourceManager to init for the extension resource |
168 | | - * @return the initialized resource manager |
169 | | - */ |
170 | | - <T extends ResourceManager> T init(String resourceName, T resourceManager); |
171 | | - |
172 | | - /** |
173 | | - * Creates a logger for document and query requests. To merge the logging output |
174 | | - * with the output from other loggers, pass the output stream used by the other |
175 | | - * loggers. |
176 | | - * |
177 | | - * @param out the output stream for the logging output |
178 | | - * @return the logger for client requests |
179 | | - */ |
180 | | - RequestLogger newLogger(OutputStream out); |
181 | | - |
182 | | - /** |
183 | | - * Closes the database client and releases associated resources. After the client is closed, |
184 | | - * document and query managers can no longer access the database. |
185 | | - */ |
186 | | - void release(); |
187 | | - |
188 | | - /** |
189 | | - * Returns the client object from the library that implements communication with the |
190 | | - * server. You should call this method only when you need short-term workarounds such |
191 | | - * as configuring communication with the server. The client implementation object and |
192 | | - * library may change without notice or be removed without replacement in a future release. |
193 | | - * |
194 | | - * In addition, your changes to the configuration of the client implementation object |
195 | | - * could impair the operation of the MarkLogic Java Client API. In short, the client |
196 | | - * implementation object should be used only on an interim basis by experts who test |
197 | | - * thoroughly to avoid unwanted side effects. |
198 | | - * |
199 | | - * You can call the getClass().getName() and getClass().getPackage().getName() to discover |
200 | | - * the class of the current implementation object. |
201 | | - * @return the object implementing communication with the server |
202 | | - */ |
203 | | - Object getClientImplementation(); |
204 | | - |
205 | | - /** |
206 | | - * Creates a ServerEvaluationCall for eval and invoke of server-side xquery or |
207 | | - * javascript code. Eval requires the xdbc:eval privilege and invoke requires the |
208 | | - * xdbc:invoke privilege. If this DatabaseClient is pointed at a database different |
209 | | - * than the default for this REST server, you will need the xdbc:eval-in or xdbc:invoke-in |
210 | | - * privilege. |
211 | | - * @return the new ServerEvaluationCall instance |
212 | | - */ |
213 | | - ServerEvaluationCall newServerEval(); |
214 | | - |
215 | | - String getHost(); |
216 | | - |
217 | | - int getPort(); |
218 | | - |
219 | | - String getDatabase(); |
220 | | - |
221 | | - SecurityContext getSecurityContext(); |
| 48 | + /** |
| 49 | + * Starts a transaction. You can pass the transaction to the read(), write(), or delete() methods |
| 50 | + * of a document manager or the search() method of a query manager to perform operations within a |
| 51 | + * multistatement transaction. |
| 52 | + * |
| 53 | + * To call openTransaction(), an application must authenticate as rest-writer or rest-admin. |
| 54 | + * |
| 55 | + * @return a Transaction object identifying and supporting operations on the transaction |
| 56 | + */ |
| 57 | + Transaction openTransaction() throws ForbiddenUserException, FailedRequestException; |
| 58 | + /** |
| 59 | + * Starts a transaction with the specified name, which makes the transaction easier to recognize |
| 60 | + * when you get status reports. |
| 61 | + * |
| 62 | + * @param name the transaction name |
| 63 | + * @return a Transaction object identifying and supporting operations on the transaction |
| 64 | + */ |
| 65 | + Transaction openTransaction(String name) throws ForbiddenUserException, FailedRequestException; |
| 66 | + /** |
| 67 | + * Starts a transaction with the specified name and time limit. If the transaction is not committed |
| 68 | + * or rolled back within the specified time, the transaction rolls back automatically. |
| 69 | + * |
| 70 | + * @param name the transaction name |
| 71 | + * @param timeLimit the number of the transaction in seconds |
| 72 | + * @return a Transaction object identifying and supporting operations on the transaction |
| 73 | + */ |
| 74 | + Transaction openTransaction(String name, int timeLimit) throws ForbiddenUserException, FailedRequestException; |
| 75 | + |
| 76 | + /** |
| 77 | + * Creates a document manager for documents with unknown or heterogeneous formats. |
| 78 | + * @return a manager supporting generic operations on documents |
| 79 | + */ |
| 80 | + GenericDocumentManager newDocumentManager(); |
| 81 | + /** |
| 82 | + * Creates a document manager for documents with a binary format such as images. |
| 83 | + * @return a manager supporting operations on binary documents |
| 84 | + */ |
| 85 | + BinaryDocumentManager newBinaryDocumentManager(); |
| 86 | + /** |
| 87 | + * Creates a document manager for documents containing a JSON structure. |
| 88 | + * @return a manager supporting operations on JSON documents |
| 89 | + */ |
| 90 | + JSONDocumentManager newJSONDocumentManager(); |
| 91 | + /** |
| 92 | + * Creates a document manager for documents containing unstructured text. |
| 93 | + * @return a manager supporting operations on text documents |
| 94 | + */ |
| 95 | + TextDocumentManager newTextDocumentManager(); |
| 96 | + /** |
| 97 | + * Creates a document manager for documents containing XML. |
| 98 | + * @return a manager supporting operations on XMLdocuments |
| 99 | + */ |
| 100 | + XMLDocumentManager newXMLDocumentManager(); |
| 101 | + |
| 102 | + /** |
| 103 | + * Creates a manager for long-running asynchronous write or query jobs. Don't forget |
| 104 | + * to call dataMovementManager.release() when you're done with it. |
| 105 | + * @return a manager supporting long-running asynchronous write or query jobs |
| 106 | + */ |
| 107 | + DataMovementManager newDataMovementManager(); |
| 108 | + |
| 109 | + /** |
| 110 | + * Creates a manager to query for database documents. |
| 111 | + * @return a manager supporting search operations and lookup of values and tuples in indexes (also known as lexicons) |
| 112 | + */ |
| 113 | + QueryManager newQueryManager(); |
| 114 | + |
| 115 | + /** |
| 116 | + * Creates a manager to retrieve rows from the database. |
| 117 | + * @return a manager supporting plans for processing database rows |
| 118 | + */ |
| 119 | + RowManager newRowManager(); |
| 120 | + |
| 121 | + /** |
| 122 | + * Creates a manager for building rules and rules-matching applications. |
| 123 | + * @return a manager for supporting rules and rule-match operations. |
| 124 | + */ |
| 125 | + RuleManager newRuleManager(); |
| 126 | + |
| 127 | + /** |
| 128 | + * Creates a manager for configuring the REST server for the database. The |
| 129 | + * ServerConfigurationManager can persist query options and transforms or |
| 130 | + * set properties of the server. The application must have rest-admin |
| 131 | + * privileges to use the ServerConfigurationManager. |
| 132 | + * |
| 133 | + * @return a manager for the server properties or administrative resources |
| 134 | + */ |
| 135 | + ServerConfigurationManager newServerConfigManager(); |
| 136 | + |
| 137 | + /** Creates a manager for CRUD operations on semantic graphs. |
| 138 | + * @return the new GraphManager instance |
| 139 | + */ |
| 140 | + GraphManager newGraphManager(); |
| 141 | + |
| 142 | + /** Creates a manager for executing SPARQL queries and retrieving results. |
| 143 | + * @return the new SPARQLQueryManager instance |
| 144 | + */ |
| 145 | + SPARQLQueryManager newSPARQLQueryManager(); |
| 146 | + |
| 147 | + /** |
| 148 | + * Creates a PojoRepository specific to the specified class and its id type. |
| 149 | + * The PojoRepository provides a facade for persisting, retrieving, and |
| 150 | + * querying data contained in Java objects. Annotations are required to |
| 151 | + * identify the id field and any fields for which you wish to create indexes. |
| 152 | + * |
| 153 | + * @param clazz the class type for this PojoRepository to handle |
| 154 | + * @param idClass the class type of the id field for this clazz, must obviously |
| 155 | + * be Serializable or we'll struggle to marshall it |
| 156 | + * @param <T> the pojo type this PojoRepository will manage |
| 157 | + * @param <ID> the scalar type of the id for pojos of type <T> |
| 158 | + * @return the initialized PojoRepository |
| 159 | + **/ |
| 160 | + <T, ID extends Serializable> PojoRepository<T, ID> newPojoRepository(Class<T> clazz, Class<ID> idClass); |
| 161 | + |
| 162 | + /** |
| 163 | + * Initializes a manager for a extension resource. |
| 164 | + * |
| 165 | + * @param resourceName the name of the extension resource |
| 166 | + * @param resourceManager the manager for the extension resource |
| 167 | + * @param <T> the type of ResourceManager to init for the extension resource |
| 168 | + * @return the initialized resource manager |
| 169 | + */ |
| 170 | + <T extends ResourceManager> T init(String resourceName, T resourceManager); |
| 171 | + |
| 172 | + /** |
| 173 | + * Creates a logger for document and query requests. To merge the logging output |
| 174 | + * with the output from other loggers, pass the output stream used by the other |
| 175 | + * loggers. |
| 176 | + * |
| 177 | + * @param out the output stream for the logging output |
| 178 | + * @return the logger for client requests |
| 179 | + */ |
| 180 | + RequestLogger newLogger(OutputStream out); |
| 181 | + |
| 182 | + /** |
| 183 | + * Closes the database client and releases associated resources. After the client is closed, |
| 184 | + * document and query managers can no longer access the database. |
| 185 | + */ |
| 186 | + void release(); |
| 187 | + |
| 188 | + /** |
| 189 | + * Returns the client object from the library that implements communication with the |
| 190 | + * server. You should call this method only when you need short-term workarounds such |
| 191 | + * as configuring communication with the server. The client implementation object and |
| 192 | + * library may change without notice or be removed without replacement in a future release. |
| 193 | + * |
| 194 | + * In addition, your changes to the configuration of the client implementation object |
| 195 | + * could impair the operation of the MarkLogic Java Client API. In short, the client |
| 196 | + * implementation object should be used only on an interim basis by experts who test |
| 197 | + * thoroughly to avoid unwanted side effects. |
| 198 | + * |
| 199 | + * You can call the getClass().getName() and getClass().getPackage().getName() to discover |
| 200 | + * the class of the current implementation object. |
| 201 | + * @return the object implementing communication with the server |
| 202 | + */ |
| 203 | + Object getClientImplementation(); |
| 204 | + |
| 205 | + /** |
| 206 | + * Creates a ServerEvaluationCall for eval and invoke of server-side xquery or |
| 207 | + * javascript code. Eval requires the xdbc:eval privilege and invoke requires the |
| 208 | + * xdbc:invoke privilege. If this DatabaseClient is pointed at a database different |
| 209 | + * than the default for this REST server, you will need the xdbc:eval-in or xdbc:invoke-in |
| 210 | + * privilege. |
| 211 | + * @return the new ServerEvaluationCall instance |
| 212 | + */ |
| 213 | + ServerEvaluationCall newServerEval(); |
| 214 | + |
| 215 | + String getHost(); |
| 216 | + |
| 217 | + int getPort(); |
| 218 | + |
| 219 | + String getDatabase(); |
| 220 | + |
| 221 | + SecurityContext getSecurityContext(); |
222 | 222 | } |
0 commit comments