You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/02/06 09:34:08 UTC
[1/2] olingo-odata4 git commit: [OLINGO-557] Deactivate Function
Imports for TecSvc
Repository: olingo-odata4
Updated Branches:
refs/heads/master 1b9d92e77 -> 6c74d3fee
[OLINGO-557] Deactivate Function Imports for TecSvc
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/6e90b617
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/6e90b617
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/6e90b617
Branch: refs/heads/master
Commit: 6e90b617abba032728f3610c58dea4f3fec9f56c
Parents: 1b9d92e
Author: Michael Bolz <mi...@sap.com>
Authored: Fri Feb 6 09:24:41 2015 +0100
Committer: Michael Bolz <mi...@sap.com>
Committed: Fri Feb 6 09:24:41 2015 +0100
----------------------------------------------------------------------
.../TechnicalPrimitiveComplexProcessor.java | 22 ++++++++++++++++++++
1 file changed, 22 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6e90b617/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
index 75e3dcc..c77b9a4 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
@@ -84,6 +84,11 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
@Override
public void readPrimitive(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
final ContentType contentType) throws ODataApplicationException, SerializerException {
+ if(isFunctionImport(uriInfo)) {
+ throw new ODataApplicationException("Function imports are not supported yet in technical scenario.",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
readProperty(response, uriInfo, contentType, RepresentationType.PRIMITIVE);
}
@@ -113,6 +118,10 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
@Override
public void readPrimitiveCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
final ContentType contentType) throws ODataApplicationException, SerializerException {
+ if(isFunctionImport(uriInfo)) {
+ throw new ODataApplicationException("Function imports are not supported yet in technical scenario.",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
readProperty(response, uriInfo, contentType, RepresentationType.COLLECTION_PRIMITIVE);
}
@@ -143,6 +152,10 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
@Override
public void readComplex(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
final ContentType contentType) throws ODataApplicationException, SerializerException {
+ if(isFunctionImport(uriInfo)) {
+ throw new ODataApplicationException("Function imports are not supported yet in technical scenario.",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
readProperty(response, uriInfo, contentType, RepresentationType.COMPLEX);
}
@@ -171,6 +184,10 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
@Override
public void readComplexCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
final ContentType contentType) throws ODataApplicationException, SerializerException {
+ if(isFunctionImport(uriInfo)) {
+ throw new ODataApplicationException("Function imports are not supported yet in technical scenario.",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
readProperty(response, uriInfo, contentType, RepresentationType.COLLECTION_COMPLEX);
}
@@ -197,6 +214,11 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
deleteProperty(response, uriInfo);
}
+ private boolean isFunctionImport(final UriInfo uriInfo) {
+ final List<UriResource> resourceParts = uriInfo.asUriInfoResource().getUriResourceParts();
+ return !resourceParts.isEmpty() && resourceParts.get(0).getKind() == UriResourceKind.function;
+ }
+
private void readProperty(final ODataResponse response, final UriInfo uriInfo, final ContentType contentType,
final RepresentationType representationType) throws ODataApplicationException, SerializerException {
final UriInfoResource resource = uriInfo.asUriInfoResource();
[2/2] olingo-odata4 git commit: [OLINGO-564] Small fixes in server
URI parser
Posted by mi...@apache.org.
[OLINGO-564] Small fixes in server URI parser
Change-Id: I8327241497779234b576ef4db744ea55f55528ac
Signed-off-by: Michael Bolz <mi...@sap.com>
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/6c74d3fe
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/6c74d3fe
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/6c74d3fe
Branch: refs/heads/master
Commit: 6c74d3fee512a9cf06767840a240a9f325d4f2c9
Parents: 6e90b61
Author: Klaus Straubinger <kl...@sap.com>
Authored: Fri Feb 6 09:23:09 2015 +0100
Committer: Michael Bolz <mi...@sap.com>
Committed: Fri Feb 6 09:30:00 2015 +0100
----------------------------------------------------------------------
.../org/apache/olingo/server/core/ODataExceptionHelper.java | 1 -
.../olingo/server/core/uri/parser/UriParseTreeVisitor.java | 5 +++++
.../olingo/server/core/uri/antlr/TestFullResourcePath.java | 2 ++
3 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6c74d3fe/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
index c615f3f..1a4cbc9 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
@@ -43,7 +43,6 @@ public class ODataExceptionHelper {
public static ODataServerError createServerErrorObject(UriParserSemanticException e, Locale requestedLocale) {
ODataServerError serverError = basicTranslatedError(e, requestedLocale);
if (UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND.equals(e.getMessageKey())
- || UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND.equals(e.getMessageKey())
|| UriParserSemanticException.MessageKeys.PROPERTY_NOT_IN_TYPE.equals(e.getMessageKey())) {
serverError.setStatusCode(HttpStatusCode.NOT_FOUND.getStatusCode());
} else {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6c74d3fe/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
index 0a582dc..52a53f7 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
@@ -322,6 +322,11 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (edmFunctionImport != null) {
// read the URI parameters
+ if (ctx.vlNVO.isEmpty()) {
+ throw wrap(new UriParserSyntaxException(
+ "Function imports must have a (possibly empty) parameter list written in parentheses",
+ UriParserSyntaxException.MessageKeys.SYNTAX));
+ }
context.contextReadingFunctionParameters = true;
@SuppressWarnings("unchecked")
List<UriParameterImpl> parameters = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6c74d3fe/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
index 0b5cb2a..4ba40a6 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
@@ -1825,6 +1825,8 @@ public class TestFullResourcePath {
@Test
public void runFunctionImpError() {
+ testUri.runEx("FICRTCollCTTwoPrimParam")
+ .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
testUri.runEx("FICRTCollCTTwoPrimParam()")
.isExSemantic(UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND);
testUri.runEx("FICRTCollCTTwoPrimParam(invalidParam=2)")