You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/06/27 17:39:01 UTC

[2/6] git commit: [OLINGO-328] refactor EntitySetProcessor to CollectionProcessor

[OLINGO-328] refactor EntitySetProcessor to CollectionProcessor


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/77af7dfa
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/77af7dfa
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/77af7dfa

Branch: refs/heads/olingo-328
Commit: 77af7dfab095a523b5a60dfb380aac3721dbab73
Parents: f70c294
Author: Stephan Klevenz <st...@sap.com>
Authored: Tue Jun 24 12:21:34 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Tue Jun 24 12:21:34 2014 +0200

----------------------------------------------------------------------
 .../api/processor/CollectionProcessor.java      | 29 ++++++++++++++++++++
 .../api/processor/EntitySetProcessor.java       | 29 --------------------
 .../apache/olingo/server/core/ODataHandler.java |  8 +++---
 .../tecsvc/processor/SampleJsonProcessor.java   |  6 ++--
 .../tecsvc/processor/TechnicalProcessor.java    |  6 ++--
 .../olingo/server/core/ODataHandlerTest.java    |  1 +
 6 files changed, 40 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/77af7dfa/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CollectionProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CollectionProcessor.java
new file mode 100644
index 0000000..bf45c3f
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CollectionProcessor.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.api.processor;
+
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.uri.UriInfo;
+
+public interface CollectionProcessor extends Processor {
+
+  void readCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, String format);
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/77af7dfa/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntitySetProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntitySetProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntitySetProcessor.java
deleted file mode 100644
index 73f7aeb..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntitySetProcessor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.server.api.processor;
-
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-public interface EntitySetProcessor extends Processor {
-
-  void readEntitySet(ODataRequest request, ODataResponse response, UriInfo uriInfo, String format);
-
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/77af7dfa/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
index acea9f5..a46281f 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
@@ -110,8 +110,8 @@ public class ODataHandler {
     case entitySet:
       if (((UriResourcePartTyped) lastPathSegment).isCollection()) {
         if (request.getMethod().equals(HttpMethod.GET)) {
-          EntitySetProcessor esp = selectProcessor(EntitySetProcessor.class);
-          esp.readEntitySet(request, response, uriInfo, requestedContentType);
+          CollectionProcessor esp = selectProcessor(CollectionProcessor.class);
+          esp.readCollection(request, response, uriInfo, requestedContentType);
         } else {
           throw new ODataRuntimeException("not implemented");
         }
@@ -127,8 +127,8 @@ public class ODataHandler {
     case navigationProperty:
       if (((UriResourceNavigation) lastPathSegment).isCollection()) {
         if (request.getMethod().equals(HttpMethod.GET)) {
-          EntitySetProcessor esp = selectProcessor(EntitySetProcessor.class);
-          esp.readEntitySet(request, response, uriInfo, requestedContentType);
+          CollectionProcessor esp = selectProcessor(CollectionProcessor.class);
+          esp.readCollection(request, response, uriInfo, requestedContentType);
         } else {
           throw new ODataRuntimeException("not implemented");
         }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/77af7dfa/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/SampleJsonProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/SampleJsonProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/SampleJsonProcessor.java
index 5c6c636..7651b5e 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/SampleJsonProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/SampleJsonProcessor.java
@@ -37,13 +37,13 @@ import org.apache.olingo.server.api.OData;
 import org.apache.olingo.server.api.ODataRequest;
 import org.apache.olingo.server.api.ODataResponse;
 import org.apache.olingo.server.api.processor.EntityProcessor;
-import org.apache.olingo.server.api.processor.EntitySetProcessor;
+import org.apache.olingo.server.api.processor.CollectionProcessor;
 import org.apache.olingo.server.api.serializer.ODataSerializer;
 import org.apache.olingo.server.api.uri.UriInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class SampleJsonProcessor implements EntitySetProcessor, EntityProcessor {
+public class SampleJsonProcessor implements CollectionProcessor, EntityProcessor {
     private static final Logger LOG = LoggerFactory.getLogger(SampleJsonProcessor.class);
 
     private OData odata;
@@ -56,7 +56,7 @@ public class SampleJsonProcessor implements EntitySetProcessor, EntityProcessor
     }
 
     @Override
-    public void readEntitySet(ODataRequest request, ODataResponse response, UriInfo uriInfo, String format) {
+    public void readCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, String format) {
       long time = System.nanoTime();
 
       EntitySet entitySet = createEntitySet();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/77af7dfa/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
index e0cebb7..57866a1 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
@@ -25,11 +25,11 @@ import org.apache.olingo.server.api.OData;
 import org.apache.olingo.server.api.ODataRequest;
 import org.apache.olingo.server.api.ODataResponse;
 import org.apache.olingo.server.api.processor.EntityProcessor;
-import org.apache.olingo.server.api.processor.EntitySetProcessor;
+import org.apache.olingo.server.api.processor.CollectionProcessor;
 import org.apache.olingo.server.api.uri.UriInfo;
 import org.apache.olingo.server.tecsvc.data.DataProvider;
 
-public class TechnicalProcessor implements EntitySetProcessor, EntityProcessor {
+public class TechnicalProcessor implements CollectionProcessor, EntityProcessor {
 
   private OData odata;
   private Edm edm;
@@ -52,7 +52,7 @@ public class TechnicalProcessor implements EntitySetProcessor, EntityProcessor {
   }
 
   @Override
-  public void readEntitySet(ODataRequest request, ODataResponse response, UriInfo uriInfo, String format) {
+  public void readCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, String format) {
     response.setContent(new ByteArrayInputStream("EntitySet".getBytes()));
     response.setStatusCode(200);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/77af7dfa/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
index 242646d..78ef177 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
@@ -168,6 +168,7 @@ public class ODataHandlerTest {
     
     assertEquals(ODataServiceVersion.V40.toString(), response.getHeaders().get(HttpHeader.ODATA_VERSION));
   }
+  
   @Test(expected = Exception.class)
   public void testMaxVersionNotSupported() {
     ODataRequest request = new ODataRequest();