-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MODE-806 RESTful server should allow queries to be executed
Applied a patch that adds a new URI pattern (/<context root>/<repository name>/<workspace name>/query) for query support. Users can execute a query by POSTing a request to that URI with the unencoded query in the body of the message and a content type that specifies which language to use. The REST server will then execute that query in the workspace described by the URI. The query results will be returned as a JSON-encoded object with two properties: types, which maps the column names in the query results to their JCR type, and rows, which contains a JSON-encoded array of rows. Each element in the rows array corresponds to a single row in the query results and each element is a JSON object that maps column names to their value for that particular row. The types property relies on ModeShape-specific functionality and will not contain any mappings if the REST server is configured to use another JCR implementation. This patch also updates the REST client to add a new query method that returns a list of QueryRow objects. Each QueryRow provides a collection of column names in the row, the t value for a named column, and the type for a named column. The type of the column will always be null if a JCR implementation other than ModeShape is used. This patch includes Randall's suggestion to perform case-insensitive compares in the JsonRestClient when determining the query language. git-svn-id: https://svn.jboss.org/repos/modeshape/trunk@2075 76366958-4244-0410-ad5e-bbfabb93f86b
- Loading branch information
1 parent
c2b2ebd
commit 7bb33ba
Showing
26 changed files
with
1,144 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...-web-jcr-rest-client/src/main/java/org/modeshape/web/jcr/rest/client/domain/QueryRow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.modeshape.web.jcr.rest.client.domain; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
import net.jcip.annotations.Immutable; | ||
|
||
@Immutable | ||
public class QueryRow { | ||
|
||
private Map<String, String> queryTypes; | ||
private Map<String, Object> values; | ||
|
||
public QueryRow( Map<String, String> queryTypes, | ||
Map<String, Object> values ) { | ||
super(); | ||
// queryTypes is expected to already be an unmodifiable map | ||
this.queryTypes = queryTypes; | ||
this.values = Collections.unmodifiableMap(values); | ||
} | ||
|
||
public Collection<String> getColumnNames() { | ||
return values.keySet(); | ||
} | ||
|
||
public Object getValue( String columnName ) { | ||
return values.get(columnName); | ||
} | ||
|
||
public String getColumnType( String columnName ) { | ||
return queryTypes.get(columnName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.