Skip to content
Permalink
Browse files
[NO ISSUE][API] Add ensureOptionalParameters for extension
- user model changes: no
- storage format changes: no
- interface changes: no

Details:

Change-Id: Id7e9c5aa9c5a4356d1c7279f10c5602059f550f0
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/15227
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
Reviewed-by: Michael Blow <mblow@apache.org>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
  • Loading branch information
AliSolaiman committed Feb 13, 2022
1 parent f3d8e9c commit 9e332736965c8ab7e3252f5ee28e403945a33cb1
Showing 2 changed files with 9 additions and 4 deletions.
@@ -45,6 +45,7 @@
import org.apache.asterix.translator.ResultProperties;
import org.apache.asterix.translator.SessionOutput;
import org.apache.hyracks.api.application.INCServiceContext;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.exceptions.Warning;
import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.http.api.IChannelClosedHandler;
@@ -76,6 +77,7 @@ protected void executeStatement(IServletRequest request, IRequestReference reque
QueryServiceRequestParameters param, RequestExecutionState executionState,
Map<String, String> optionalParameters, Map<String, byte[]> statementParameters,
ResponsePrinter responsePrinter, List<Warning> warnings) throws Exception {
ensureOptionalParameters(optionalParameters);
// Running on NC -> send 'execute' message to CC
INCServiceContext ncCtx = (INCServiceContext) serviceCtx;
INCMessageBroker ncMb = (INCMessageBroker) ncCtx.getMessageBroker();
@@ -134,6 +136,10 @@ protected void executeStatement(IServletRequest request, IRequestReference reque
buildResponseResults(responsePrinter, sessionOutput, responseMsg.getExecutionPlans(), warnings);
}

protected void ensureOptionalParameters(Map<String, String> optionalParameters) throws HyracksDataException {

}

protected ExecuteStatementRequestMessage createRequestMessage(IServletRequest request,
IRequestReference requestReference, String statementsText, SessionOutput sessionOutput,
ResultProperties resultProperties, QueryServiceRequestParameters param,
@@ -295,8 +295,7 @@ private void writeException(Exception e, IServletResponse response) {
responseWriter.flush();
}

protected boolean isRequestPermittedForWrite(IServletRequest request, IServletResponse response)
throws IOException {
protected boolean isRequestPermitted(IServletRequest request, IServletResponse response) throws IOException {
if (!isRequestOnLoopback(request)) {
rejectForbidden(response);
return false;
@@ -322,14 +321,14 @@ protected void rejectForbidden(IServletResponse response) throws IOException {

@Override
protected void post(IServletRequest request, IServletResponse response) throws IOException {
if (isRequestPermittedForWrite(request, response)) {
if (isRequestPermitted(request, response)) {
handleModification(request, response, LibraryOperation.UPSERT);
}
}

@Override
protected void delete(IServletRequest request, IServletResponse response) throws IOException {
if (isRequestPermittedForWrite(request, response)) {
if (isRequestPermitted(request, response)) {
handleModification(request, response, LibraryOperation.DELETE);
}
}

0 comments on commit 9e33273

Please sign in to comment.