Search in sources :

Example 16 with JaxRxException

use of org.jaxrx.core.JaxRxException in project sirix by sirixdb.

the class SirixMediator method query.

@Override
public StreamingOutput query(final String query, final ResourcePath path) throws JaxRxException {
    StreamingOutput response;
    final int depth = path.getDepth();
    switch(depth) {
        case 1:
            response = database.performQueryOnResource(path.getResourcePath(), query, path.getQueryParameter());
            break;
        case 2:
            response = nodeIdResource.performQueryOnResource(path.getResource(0), Long.valueOf(path.getResource(1)), query, path.getQueryParameter());
            break;
        default:
            throw new JaxRxException(405, NOTALLOWEDSTRING);
    }
    return response;
}
Also used : StreamingOutput(javax.ws.rs.core.StreamingOutput) JaxRxException(org.jaxrx.core.JaxRxException)

Aggregations

JaxRxException (org.jaxrx.core.JaxRxException)16 SirixException (org.sirix.exception.SirixException)14 SessionConfiguration (org.sirix.access.conf.SessionConfiguration)10 Database (org.sirix.api.Database)10 Session (org.sirix.api.Session)10 IOException (java.io.IOException)8 WebApplicationException (javax.ws.rs.WebApplicationException)5 StreamingOutput (javax.ws.rs.core.StreamingOutput)5 NodeWriteTrx (org.sirix.api.NodeWriteTrx)5 XMLSerializerBuilder (org.sirix.service.xml.serialize.XMLSerializer.XMLSerializerBuilder)4 OutputStream (java.io.OutputStream)3 NodeReadTrx (org.sirix.api.NodeReadTrx)3 XMLSerializer (org.sirix.service.xml.serialize.XMLSerializer)3 RestXPathProcessor (org.sirix.service.jaxrx.util.RestXPathProcessor)2 XMLSerializerProperties (org.sirix.service.xml.serialize.XMLSerializerProperties)2 File (java.io.File)1 LinkedList (java.util.LinkedList)1 StringTokenizer (java.util.StringTokenizer)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1