-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathSqlResource.java
More file actions
70 lines (61 loc) · 1.92 KB
/
SqlResource.java
File metadata and controls
70 lines (61 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* Copyright (c) restSQL Project Contributors. Licensed under MIT. */
package org.restsql.core;
import java.util.List;
import java.util.Map;
import org.restsql.core.sqlresource.SqlResourceDefinition;
/**
* Represents an SQL Resource, a queryable and updatable database "view".
*
* @author Mark Sawers
*/
public interface SqlResource {
/**
* Returns SQL resource information defined by the user, including query, validated attributes and trigger.
*
* @return definition
*/
public SqlResourceDefinition getDefinition();
/**
* Returns SQL resource name.
*
* @return SQL resource name
*/
public String getName();
/**
* Returns meta data for SQL resource.
*
* @return SQL rsource meta data
*/
public SqlResourceMetaData getMetaData();
/**
* Returns triggers classes.
*
* @return list of trigger classes
*/
public List<Trigger> getTriggers();
/**
* Executes query returning results as an object collection.
*
* @param request Request object
* @throws SqlResourceException if a database access error occurs
* @return list of rows, where each row is a map of name-value pairs
*/
public List<Map<String, Object>> read(Request request) throws SqlResourceException;
/**
* Executes query returning results as a string.
*
* @param request Request object
* @param mediaType response format, use internet media type e.g. application/xml
* @throws SqlResourceException if a database access error occurs
* @return list of rows, where each row is a map of name-value pairs
*/
public String read(final Request request, final String mediaType) throws SqlResourceException;
/**
* Executes database write (insert, update or delete).
*
* @param request Request object
* @throws SqlResourceException if the request is invalid or a database access error or trigger exception occurs
* @return write response
*/
public WriteResponse write(final Request request) throws SqlResourceException;
}