You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2014/11/18 16:12:23 UTC

[22/22] olingo-odata4 git commit: [OLINGO-472] Batch Refactoring

[OLINGO-472] Batch Refactoring


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

Branch: refs/heads/master
Commit: 51acf8aebf4ccf0e982b31734c75460d4bdf106f
Parents: 4f820fe
Author: Christian Amend <ch...@apache.org>
Authored: Tue Nov 18 15:45:37 2014 +0100
Committer: Christian Amend <ch...@apache.org>
Committed: Tue Nov 18 15:45:37 2014 +0100

----------------------------------------------------------------------
 .../org/apache/olingo/server/api/OData.java     |   13 +-
 .../olingo/server/api/batch/BatchFacade.java    |   29 +
 .../olingo/server/api/batch/BatchOperation.java |   35 -
 .../server/api/batch/BatchParserResult.java     |   23 -
 .../server/api/batch/BatchRequestPart.java      |   42 -
 .../server/api/batch/ODataResponsePart.java     |   80 --
 .../deserializer/FixedFormatDeserializer.java   |   29 +
 .../batch/BatchDeserializerResult.java          |   23 +
 .../deserializer/batch/BatchRequestPart.java    |   42 +
 .../deserializer/batch/ODataResponsePart.java   |   80 ++
 .../server/api/processor/BatchProcessor.java    |   15 +-
 .../server/api/processor/DefaultProcessor.java  |   92 +-
 .../api/serializer/FixedFormatSerializer.java   |   16 +-
 .../apache/olingo/server/core/ODataHandler.java |    2 +-
 .../apache/olingo/server/core/ODataImpl.java    |   13 +-
 .../batch/handler/BatchChangeSetSorter.java     |  156 ---
 .../server/core/batch/handler/BatchHandler.java |   68 -
 .../core/batch/handler/BatchOperationImpl.java  |   73 -
 .../core/batch/handler/BatchPartHandler.java    |  150 --
 .../server/core/batch/parser/BatchBodyPart.java |  135 --
 .../core/batch/parser/BatchChangeSetPart.java   |   56 -
 .../server/core/batch/parser/BatchParser.java   |   88 --
 .../core/batch/parser/BatchParserCommon.java    |  221 ---
 .../server/core/batch/parser/BatchPart.java     |   25 -
 .../core/batch/parser/BatchQueryOperation.java  |   82 --
 .../core/batch/parser/BatchRequestPartImpl.java |   51 -
 .../BufferedReaderIncludingLineEndings.java     |  286 ----
 .../olingo/server/core/batch/parser/Header.java |  181 ---
 .../server/core/batch/parser/HeaderField.java   |  121 --
 .../BatchRequestTransformator.java              |  192 ---
 .../batch/transformator/BatchTransformator.java |   29 -
 .../transformator/BatchTransformatorCommon.java |   91 --
 .../transformator/HttpRequestStatusLine.java    |  226 ---
 .../core/batch/writer/BatchResponseWriter.java  |  228 ---
 .../core/batchhandler/BatchChangeSetSorter.java |  156 +++
 .../server/core/batchhandler/BatchHandler.java  |   69 +
 .../core/batchhandler/BatchOperationImpl.java   |   47 +
 .../core/batchhandler/BatchPartHandler.java     |  150 ++
 .../FixedFormatDeserializerImpl.java            |   43 +
 .../core/deserializer/batch/BatchBodyPart.java  |  135 ++
 .../deserializer/batch/BatchChangeSetPart.java  |   56 +
 .../core/deserializer/batch/BatchParser.java    |   88 ++
 .../deserializer/batch/BatchParserCommon.java   |  221 +++
 .../core/deserializer/batch/BatchPart.java      |   25 +
 .../deserializer/batch/BatchQueryOperation.java |   82 ++
 .../batch/BatchRequestPartImpl.java             |   51 +
 .../batch/BatchRequestTransformator.java        |  184 +++
 .../deserializer/batch/BatchTransformator.java  |   28 +
 .../batch/BatchTransformatorCommon.java         |   88 ++
 .../BufferedReaderIncludingLineEndings.java     |  286 ++++
 .../server/core/deserializer/batch/Header.java  |  181 +++
 .../core/deserializer/batch/HeaderField.java    |  121 ++
 .../batch/HttpRequestStatusLine.java            |  225 +++
 .../serializer/BatchResponseSerializer.java     |  228 +++
 .../serializer/FixedFormatSerializerImpl.java   |   13 +
 .../core/batch/BatchRequestParserTest.java      | 1326 ------------------
 .../olingo/server/core/batch/StringUtil.java    |   54 -
 .../batch/handler/BatchChangeSetSorterTest.java |  164 ---
 .../batch/handler/MockedBatchHandlerTest.java   |  664 ---------
 .../batch/parser/BatchParserCommonTest.java     |  230 ---
 .../BufferedReaderIncludingLineEndingsTest.java |  484 -------
 .../server/core/batch/parser/HeaderTest.java    |  179 ---
 .../batch/writer/BatchResponseWriterTest.java   |  179 ---
 .../batchhandler/BatchChangeSetSorterTest.java  |  165 +++
 .../batchhandler/MockedBatchHandlerTest.java    |  671 +++++++++
 .../deserializer/BatchParserCommonTest.java     |  230 +++
 .../deserializer/BatchRequestParserTest.java    | 1326 ++++++++++++++++++
 .../BufferedReaderIncludingLineEndingsTest.java |  484 +++++++
 .../server/core/deserializer/HeaderTest.java    |  179 +++
 .../server/core/deserializer/StringUtil.java    |   54 +
 .../serializer/BatchResponseWriterTest.java     |  180 +++
 .../olingo/server/tecsvc/TechnicalServlet.java  |   24 +-
 .../processor/TechnicalBatchProcessor.java      |  123 ++
 73 files changed, 6149 insertions(+), 6037 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
index 2a6eb1b..0a6f369 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
@@ -18,16 +18,17 @@
  */
 package org.apache.olingo.server.api;
 
+import java.util.List;
+
 import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.server.api.edmx.EdmxReference;
 import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer;
 import org.apache.olingo.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.server.api.edmx.EdmxReference;
 import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
 import org.apache.olingo.server.api.serializer.ODataSerializer;
 import org.apache.olingo.server.api.serializer.SerializerException;
 
-import java.util.List;
-
 /**
  * Root object for serving factory tasks and support loose coupling of implementation (core) from the API.
  * This is not a singleton (static variables) to avoid issues with synchronization, OSGi, hot deployment and so on.
@@ -69,6 +70,12 @@ public abstract class OData {
   public abstract FixedFormatSerializer createFixedFormatSerializer() throws SerializerException;
 
   /**
+   * Creates a new deserializer object for reading content in a fixed format, e.g., for binary input.
+   * Deserializers are used in Processor implementations.
+   */
+  public abstract FixedFormatDeserializer createFixedFormatDeserializer();
+  
+  /**
    * Creates a new ODataHttpHandler for handling OData requests in an HTTP context.
    *
    * @param serviceMetadata - metadata object required to handle an OData request

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java
new file mode 100644
index 0000000..7e85136
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.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.batch;
+
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
+import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
+
+public interface BatchFacade {
+  public ODataResponse handleODataRequest(ODataRequest request, BatchRequestPart requestPart) throws BatchException;
+
+  public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws BatchException;
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchOperation.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchOperation.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchOperation.java
deleted file mode 100644
index a9edef0..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchOperation.java
+++ /dev/null
@@ -1,35 +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.batch;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-
-public interface BatchOperation {
-  public List<BatchRequestPart> parseBatchRequest(ODataRequest request, boolean isStrict) throws BatchException;
-
-  public ODataResponse handleODataRequest(ODataRequest request, BatchRequestPart requestPart) throws BatchException;
-
-  public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws BatchException;
-
-  public void writeResponseParts(List<ODataResponsePart> batchResponses, ODataResponse response) throws BatchException,
-      IOException;
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchParserResult.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchParserResult.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchParserResult.java
deleted file mode 100644
index 93bc34d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchParserResult.java
+++ /dev/null
@@ -1,23 +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.batch;
-
-public interface BatchParserResult {
-
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchRequestPart.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchRequestPart.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchRequestPart.java
deleted file mode 100644
index ba5319f..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchRequestPart.java
+++ /dev/null
@@ -1,42 +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.batch;
-
-import java.util.List;
-
-import org.apache.olingo.server.api.ODataRequest;
-
-/**
- * A BatchPart
- * <p> BatchPart represents a distinct MIME part of a Batch Request body. It can be ChangeSet or Query Operation
- */
-public interface BatchRequestPart extends BatchParserResult {
-
-  /**
-   * Get the info if a BatchPart is a ChangeSet
-   * @return true or false
-   */
-  public boolean isChangeSet();
-
-  /**
-   * Get requests. If a BatchPart is a Query Operation, the list contains one request.
-   * @return a list of {@link ODataRequest}
-   */
-  public List<ODataRequest> getRequests();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/ODataResponsePart.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/ODataResponsePart.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/ODataResponsePart.java
deleted file mode 100644
index c9a914a..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/ODataResponsePart.java
+++ /dev/null
@@ -1,80 +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.batch;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.olingo.server.api.ODataResponse;
-
-public class ODataResponsePart {
-  private List<ODataResponse> responses;
-  private boolean isChangeSet;
-  
-  /**
-   * Creates a new ODataResponsePart.
-   * 
-   * An ODataResponsePart represents a collections of ODataResponses.
-   * A list of ODataResponseParts can be combined by the BatchSerializer to a single
-   * OData batch response.
-   *  
-   * @param responses     A list of {@link ODataResponse}
-   * @param isChangeSet   True this ODataResponsePart represents a change set, otherwise false
-   */
-  public ODataResponsePart(List<ODataResponse> responses, boolean isChangeSet) {
-    this.responses = responses;
-    this.isChangeSet = isChangeSet;
-  }
-  
-  /**
-   * Creates a new ODataResponsePart.
-   * 
-   * An ODataResponsePart represents a collections of ODataResponses.
-   * A list of ODataResponseParts can be combined by the BatchSerializer to a single
-   * OData batch response.
-   *  
-   * @param responses     A single {@link ODataResponse}
-   * @param isChangeSet   True this ODataResponsePart represents a change set, otherwise false
-   */
-  public ODataResponsePart(ODataResponse response, boolean isChangeSet) {
-    this.responses = Arrays.asList(new ODataResponse[] { response });
-    this.isChangeSet = isChangeSet;
-  }
-  
-  /**
-   * Returns true if the current instance represents a change set.
-   * 
-   * @return true or false
-   */
-  public List<ODataResponse> getResponses() {
-    return responses;
-  }
-  
-  /**
-   * Returns a collection of ODataResponses.
-   * Each collections contains at least one {@link ODataResponse}.
-   * 
-   * If this instance represents a change set, there are may many ODataResponses
-   *  
-   * @return a list of {@link ODataResponse}
-   */
-  public boolean isChangeSet() {
-    return isChangeSet;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java
new file mode 100644
index 0000000..fc8e2d9
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.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.deserializer;
+
+import java.util.List;
+
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.batch.BatchException;
+import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
+
+public interface FixedFormatDeserializer {
+  public List<BatchRequestPart> parseBatchRequest(ODataRequest request, boolean isStrict) throws BatchException;
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerResult.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerResult.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerResult.java
new file mode 100644
index 0000000..d397e33
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerResult.java
@@ -0,0 +1,23 @@
+/*
+ * 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.deserializer.batch;
+
+public interface BatchDeserializerResult {
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
new file mode 100644
index 0000000..928b8a0
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
@@ -0,0 +1,42 @@
+/*
+ * 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.deserializer.batch;
+
+import java.util.List;
+
+import org.apache.olingo.server.api.ODataRequest;
+
+/**
+ * A BatchPart
+ * <p> BatchPart represents a distinct MIME part of a Batch Request body. It can be ChangeSet or Query Operation
+ */
+public interface BatchRequestPart extends BatchDeserializerResult {
+
+  /**
+   * Get the info if a BatchPart is a ChangeSet
+   * @return true or false
+   */
+  public boolean isChangeSet();
+
+  /**
+   * Get requests. If a BatchPart is a Query Operation, the list contains one request.
+   * @return a list of {@link ODataRequest}
+   */
+  public List<ODataRequest> getRequests();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java
new file mode 100644
index 0000000..9a6ec9c
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java
@@ -0,0 +1,80 @@
+/*
+ * 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.deserializer.batch;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.olingo.server.api.ODataResponse;
+
+public class ODataResponsePart {
+  private List<ODataResponse> responses;
+  private boolean isChangeSet;
+  
+  /**
+   * Creates a new ODataResponsePart.
+   * 
+   * An ODataResponsePart represents a collections of ODataResponses.
+   * A list of ODataResponseParts can be combined by the BatchSerializer to a single
+   * OData batch response.
+   *  
+   * @param responses     A list of {@link ODataResponse}
+   * @param isChangeSet   True this ODataResponsePart represents a change set, otherwise false
+   */
+  public ODataResponsePart(List<ODataResponse> responses, boolean isChangeSet) {
+    this.responses = responses;
+    this.isChangeSet = isChangeSet;
+  }
+  
+  /**
+   * Creates a new ODataResponsePart.
+   * 
+   * An ODataResponsePart represents a collections of ODataResponses.
+   * A list of ODataResponseParts can be combined by the BatchSerializer to a single
+   * OData batch response.
+   *  
+   * @param responses     A single {@link ODataResponse}
+   * @param isChangeSet   True this ODataResponsePart represents a change set, otherwise false
+   */
+  public ODataResponsePart(ODataResponse response, boolean isChangeSet) {
+    this.responses = Arrays.asList(new ODataResponse[] { response });
+    this.isChangeSet = isChangeSet;
+  }
+  
+  /**
+   * Returns true if the current instance represents a change set.
+   * 
+   * @return true or false
+   */
+  public List<ODataResponse> getResponses() {
+    return responses;
+  }
+  
+  /**
+   * Returns a collection of ODataResponses.
+   * Each collections contains at least one {@link ODataResponse}.
+   * 
+   * If this instance represents a change set, there are may many ODataResponses
+   *  
+   * @return a list of {@link ODataResponse}
+   */
+  public boolean isChangeSet() {
+    return isChangeSet;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java
index 843fa28..5faece4 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java
@@ -22,13 +22,16 @@ import java.util.List;
 
 import org.apache.olingo.server.api.ODataRequest;
 import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.BatchOperation;
-import org.apache.olingo.server.api.batch.BatchRequestPart;
-import org.apache.olingo.server.api.batch.ODataResponsePart;
+import org.apache.olingo.server.api.batch.BatchException;
+import org.apache.olingo.server.api.batch.BatchFacade;
+import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
+import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
+import org.apache.olingo.server.api.serializer.SerializerException;
 
 public interface BatchProcessor extends Processor {
-  void executeBatch(BatchOperation operation, ODataRequest request, ODataResponse response);
+  // TODO:Check exception signature
+  void executeBatch(BatchFacade facade, ODataRequest request, ODataResponse response)
+      throws SerializerException, BatchException;
 
-  ODataResponsePart executeChangeSet(BatchOperation operation, List<ODataRequest> requests,
-      BatchRequestPart requestPart);
+  ODataResponsePart executeChangeSet(BatchFacade facade, List<ODataRequest> requests, BatchRequestPart requestPart);
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java
index c4493a1..0bc9ff1 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java
@@ -19,11 +19,7 @@
 package org.apache.olingo.server.api.processor;
 
 import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
 
-import org.apache.olingo.commons.api.ODataRuntimeException;
 import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.api.format.ODataFormat;
 import org.apache.olingo.commons.api.http.HttpHeader;
@@ -34,10 +30,6 @@ import org.apache.olingo.server.api.ODataRequest;
 import org.apache.olingo.server.api.ODataResponse;
 import org.apache.olingo.server.api.ODataServerError;
 import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.batch.BatchException;
-import org.apache.olingo.server.api.batch.BatchOperation;
-import org.apache.olingo.server.api.batch.BatchRequestPart;
-import org.apache.olingo.server.api.batch.ODataResponsePart;
 import org.apache.olingo.server.api.serializer.ODataSerializer;
 import org.apache.olingo.server.api.serializer.SerializerException;
 import org.apache.olingo.server.api.uri.UriInfo;
@@ -50,12 +42,7 @@ import org.apache.olingo.server.api.uri.UriInfo;
  * <p>This implementation is registered in the ODataHandler by default.
  * The default can be replaced by re-registering a custom implementation.</p>
  */
-public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProcessor, ExceptionProcessor,
-    BatchProcessor {
-  
-  private static final String PREFERENCE_CONTINUE_ON_ERROR = "odata.continue-on-error";
-  private static final String PREFER_HEADER = "Prefer";
-  
+public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProcessor, ExceptionProcessor  {
   private OData odata;
   private ServiceMetadata serviceMetadata;
 
@@ -101,81 +88,4 @@ public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProce
       response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString());
     }
   }
-
-  @Override
-  public void executeBatch(BatchOperation operation, ODataRequest request, ODataResponse response) {
-    boolean continueOnError = shouldContinueOnError(request);
-
-    try {
-      final List<BatchRequestPart> parts = operation.parseBatchRequest(request, true);
-      final List<ODataResponsePart> responseParts = new ArrayList<ODataResponsePart>();
-
-      for (BatchRequestPart part : parts) {
-        final ODataResponsePart responsePart = operation.handleBatchRequest(part);
-        responseParts.add(responsePart);    // Also add failed responses
-
-        if (responsePart.getResponses().get(0).getStatusCode() >= 400
-            && !continueOnError) {
-
-          // Perform some additions actions
-          // ...
-          
-          break; // Stop processing, but serialize all recent requests
-        }
-      }
-
-      operation.writeResponseParts(responseParts, response);  // Serialize responses
-    } catch (BatchException e) {
-      throw new ODataRuntimeException(e);
-    } catch (IOException e) {
-      throw new ODataRuntimeException(e);
-    }
-  }
-
-  private boolean shouldContinueOnError(ODataRequest request) {
-    final List<String> preferValues = request.getHeaders(PREFER_HEADER);
-
-    if (preferValues != null) {
-      for (final String preference : preferValues) {
-        if (PREFERENCE_CONTINUE_ON_ERROR.equals(preference)) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-
-  @Override
-  public ODataResponsePart executeChangeSet(BatchOperation operation, List<ODataRequest> requests,
-      BatchRequestPart requestPart) {
-    List<ODataResponse> responses = new ArrayList<ODataResponse>();
-
-    for (ODataRequest request : requests) {
-      try {
-        final ODataResponse oDataResponse = operation.handleODataRequest(request, requestPart);
-
-        if (oDataResponse.getStatusCode() < 400) {
-          responses.add(oDataResponse);
-        } else {
-          // Rollback
-          // ...
-
-          // OData Version 4.0 Part 1: Protocol Plus Errata 01
-          // 11.7.4 Responding to a Batch Request
-          //
-          // When a request within a change set fails, the change set response is not represented using
-          // the multipart/mixed media type. Instead, a single response, using the application/http media type
-          // and a Content-Transfer-Encoding header with a value of binary, is returned that applies to all requests
-          // in the change set and MUST be formatted according to the Error Handling defined
-          // for the particular response format.
-
-          return new ODataResponsePart(oDataResponse, false);
-        }
-      } catch (BatchException e) {
-        throw new ODataRuntimeException(e);
-      }
-    }
-
-    return new ODataResponsePart(responses, true);
-  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java
index 22416b3..b711651 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java
@@ -18,16 +18,21 @@
  */
 package org.apache.olingo.server.api.serializer;
 
+import java.io.IOException;
 import java.io.InputStream;
+import java.util.List;
 
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.batch.BatchException;
+import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
 
 /** OData serializer for fixed output formats. */
 public interface FixedFormatSerializer {
 
   /**
    * Writes binary output into an InputStream.
-   * @param binary the binary data 
+   * @param binary the binary data
    */
   InputStream binary(byte[] binary) throws SerializerException;
 
@@ -39,10 +44,15 @@ public interface FixedFormatSerializer {
 
   /**
    * Writes the raw value of a primitive-type instance into an InputStream.
-   * @param type    the primitive type
-   * @param value   the value
+   * @param type the primitive type
+   * @param value the value
    * @param options options for the serializer
    */
   InputStream primitiveValue(EdmPrimitiveType type, Object value, PrimitiveValueSerializerOptions options)
       throws SerializerException;
+
+  // TODO: Document
+  // TODO: Delete IOException
+  void writeResponseParts(List<ODataResponsePart> batchResponses, ODataResponse response) throws BatchException,
+      IOException;
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/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 9be403c..4467778 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
@@ -58,7 +58,7 @@ import org.apache.olingo.server.api.uri.UriResourceEntitySet;
 import org.apache.olingo.server.api.uri.UriResourceNavigation;
 import org.apache.olingo.server.api.uri.UriResourcePartTyped;
 import org.apache.olingo.server.api.uri.UriResourceProperty;
-import org.apache.olingo.server.core.batch.handler.BatchHandler;
+import org.apache.olingo.server.core.batchhandler.BatchHandler;
 import org.apache.olingo.server.core.uri.parser.Parser;
 import org.apache.olingo.server.core.uri.parser.UriParserException;
 import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
index 12e3b14..a13281e 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
@@ -18,22 +18,24 @@
  */
 package org.apache.olingo.server.core;
 
+import java.util.List;
+
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.server.api.edmx.EdmxReference;
 import org.apache.olingo.commons.api.format.ODataFormat;
 import org.apache.olingo.server.api.OData;
 import org.apache.olingo.server.api.ODataHttpHandler;
 import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer;
 import org.apache.olingo.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.server.api.edmx.EdmxReference;
 import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
 import org.apache.olingo.server.api.serializer.ODataSerializer;
 import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.core.deserializer.FixedFormatDeserializerImpl;
 import org.apache.olingo.server.core.serializer.FixedFormatSerializerImpl;
 import org.apache.olingo.server.core.serializer.json.ODataJsonSerializer;
 import org.apache.olingo.server.core.serializer.xml.ODataXmlSerializerImpl;
 
-import java.util.List;
-
 public class ODataImpl extends OData {
 
   @Override
@@ -70,4 +72,9 @@ public class ODataImpl extends OData {
   public ServiceMetadata createServiceMetadata(EdmProvider edmProvider, List<EdmxReference> references) {
     return new ServiceMetadataImpl(ODataServiceVersion.V40, edmProvider, references);
   }
+
+  @Override
+  public FixedFormatDeserializer createFixedFormatDeserializer() {
+    return new FixedFormatDeserializerImpl();
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchChangeSetSorter.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchChangeSetSorter.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchChangeSetSorter.java
deleted file mode 100644
index 5e1c276..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchChangeSetSorter.java
+++ /dev/null
@@ -1,156 +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.core.batch.handler;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.batch.BatchException;
-import org.apache.olingo.server.api.batch.BatchException.MessageKeys;
-import org.apache.olingo.server.core.batch.parser.BatchParserCommon;
-
-public class BatchChangeSetSorter {
-  private static final String REG_EX_REFERENCE = "\\$(.*)(/.*)?";
-
-  final List<ODataRequest> orderdList = new ArrayList<ODataRequest>();
-
-  private static Pattern referencePattern = Pattern.compile(REG_EX_REFERENCE);
-  private Set<String> knownContentIds = new HashSet<String>();
-  private Map<String, List<ODataRequest>> requestReferenceMapping = new HashMap<String, List<ODataRequest>>();
-
-  public BatchChangeSetSorter(List<ODataRequest> requests) throws BatchException {
-    sort(requests);
-  }
-
-  public List<ODataRequest> getOrderdRequests() {
-    return orderdList;
-  }
-
-  private List<ODataRequest> sort(final List<ODataRequest> requests) throws BatchException {
-    extractUrlReference(requests);
-    
-    // Add requests without reference (roots)
-    final List<ODataRequest> requestsWithoutReferences = getRequestsWithoutReferences();
-    orderdList.addAll(requestsWithoutReferences);
-    addRequestsToKnownContentIds(requestsWithoutReferences);
-    
-    // Find all requests which can be processed (parent request has been processed)
-    // Compare level order
-    boolean areRequestsProcessed = true;
-    while (requestsToProcessAvailable() && areRequestsProcessed) {
-      areRequestsProcessed = processNextLevel();
-    }
-
-    // Check if there are some requests which are not connected to a tree
-    if (requestsToProcessAvailable()) {
-      throw new BatchException("Invalid content id", MessageKeys.INVALID_CONTENT_ID, 0);
-    }
-
-    return orderdList;
-  }
-
-  private boolean requestsToProcessAvailable() {
-    return requestReferenceMapping.keySet().size() != 0;
-  }
-
-  private boolean processNextLevel() {
-    final List<ODataRequest> addedRequests = getRemainingRequestsWithKownContentId();
-    addRequestsToKnownContentIds(addedRequests);
-    orderdList.addAll(addedRequests);
-
-    return addedRequests.size() != 0;
-  }
-
-  private List<ODataRequest> getRemainingRequestsWithKownContentId() {
-    List<ODataRequest> result = new ArrayList<ODataRequest>();
-
-    for (String contextId : knownContentIds) {
-      final List<ODataRequest> requestsToProcess = requestReferenceMapping.get(contextId);
-      if (requestsToProcess != null && requestsToProcess.size() != 0) {
-        result.addAll(requestsToProcess);
-        requestReferenceMapping.remove(contextId);
-      }
-    }
-
-    return result;
-  }
-
-  private List<ODataRequest> getRequestsWithoutReferences() {
-    List<ODataRequest> requests = requestReferenceMapping.get(null);
-    requestReferenceMapping.remove(null);
-    
-    requests = (requests == null) ? new ArrayList<ODataRequest>() : requests;
-    return requests;
-  }
-
-  private void addRequestsToKnownContentIds(List<ODataRequest> requestsWithoutReference) {
-    for (ODataRequest request : requestsWithoutReference) {
-      final String contentId = getContentIdFromHeader(request);
-      if (contentId != null) {
-        knownContentIds.add(contentId);
-      }
-    }
-  }
-
-  private String getContentIdFromHeader(ODataRequest request) {
-    return request.getHeader(BatchParserCommon.HTTP_CONTENT_ID);
-  }
-
-  private void extractUrlReference(List<ODataRequest> requests) {
-    for (ODataRequest request : requests) {
-      final String reference = getReferenceInURI(request);
-      addRequestToReferenceMapping(reference, request);
-    }
-  }
-
-  private void addRequestToReferenceMapping(final String reference, final ODataRequest request) {
-    List<ODataRequest> requestList = requestReferenceMapping.get(reference);
-    requestList = (requestList == null) ? new ArrayList<ODataRequest>() : requestList;
-
-    requestList.add(request);
-    requestReferenceMapping.put(reference, requestList);
-  }
-
-  public static String getReferenceInURI(ODataRequest request) {
-    Matcher matcher = referencePattern.matcher(removeSlash(removeSlash(request.getRawODataPath(), true), false));
-    return (matcher.matches()) ? matcher.group(1) : null;
-  }
-
-  private static String removeSlash(String rawODataPath, boolean first) {
-    final int indexOfSlash = rawODataPath.indexOf("/");
-    if(first) {
-      return (indexOfSlash == 0) ? rawODataPath.substring(1) : rawODataPath;
-    } else {
-      return (indexOfSlash != -1) ? rawODataPath.substring(0, indexOfSlash) : rawODataPath;
-    }
-  }
-
-  public static void replaceContentIdReference(ODataRequest request, String contentId, String resourceUri) {
-    final String newUri = request.getRawODataPath().replace("/$" + contentId, resourceUri);
-    request.setRawODataPath(newUri);
-    request.setRawRequestUri(request.getRawBaseUri() + "/" + newUri);
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchHandler.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchHandler.java
deleted file mode 100644
index df16c90..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchHandler.java
+++ /dev/null
@@ -1,68 +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.core.batch.handler;
-
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.BatchException;
-import org.apache.olingo.server.api.batch.BatchOperation;
-import org.apache.olingo.server.api.batch.BatchException.MessageKeys;
-import org.apache.olingo.server.api.processor.BatchProcessor;
-import org.apache.olingo.server.core.ODataHandler;
-import org.apache.olingo.server.core.batch.parser.BatchParserCommon;
-
-public class BatchHandler {
-  private final BatchProcessor batchProcessor;
-  private final ODataHandler oDataHandler;
-
-  public BatchHandler(final ODataHandler oDataHandler, final BatchProcessor batchProcessor) {
-
-    this.batchProcessor = batchProcessor;
-    this.oDataHandler = oDataHandler;
-  }
-
-  public void process(final ODataRequest request, final ODataResponse response, final boolean isStrict)
-      throws BatchException {
-    validateRequest(request);
-    
-    final BatchOperation operation = new BatchOperationImpl(oDataHandler, request, batchProcessor, isStrict);
-    batchProcessor.executeBatch(operation, request, response);
-  }
-
-  private void validateRequest(final ODataRequest request) throws BatchException {
-    validateHttpMethod(request);
-    validateContentType(request);
-  }
-
-  private void validateContentType(final ODataRequest request) throws BatchException {
-    final String contentType = request.getHeader(HttpHeader.CONTENT_TYPE);
-
-    if (contentType == null || !BatchParserCommon.PATTERN_MULTIPART_BOUNDARY.matcher(contentType).matches()) {
-      throw new BatchException("Invalid content type", MessageKeys.INVALID_CONTENT_TYPE, 0);
-    }
-  }
-
-  private void validateHttpMethod(final ODataRequest request) throws BatchException {
-    if (request.getMethod() != HttpMethod.POST) {
-      throw new BatchException("Invalid HTTP method", MessageKeys.INVALID_METHOD, 0);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchOperationImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchOperationImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchOperationImpl.java
deleted file mode 100644
index b5a4eb4..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchOperationImpl.java
+++ /dev/null
@@ -1,73 +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.core.batch.handler;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.BatchException;
-import org.apache.olingo.server.api.batch.BatchOperation;
-import org.apache.olingo.server.api.batch.BatchRequestPart;
-import org.apache.olingo.server.api.batch.ODataResponsePart;
-import org.apache.olingo.server.api.processor.BatchProcessor;
-import org.apache.olingo.server.core.ODataHandler;
-import org.apache.olingo.server.core.batch.parser.BatchParser;
-import org.apache.olingo.server.core.batch.writer.BatchResponseWriter;
-
-public class BatchOperationImpl implements BatchOperation {
-  private final BatchPartHandler partHandler;
-  private final BatchResponseWriter writer;
-  private final BatchParser parser;
-
-  public BatchOperationImpl(ODataHandler oDataHandler, ODataRequest request, BatchProcessor batchProcessor,
-      final boolean isStrict) {
-    partHandler = new BatchPartHandler(oDataHandler, batchProcessor, this);
-    writer = new BatchResponseWriter();
-    parser = new BatchParser();
-  }
-
-  @Override
-  public List<BatchRequestPart> parseBatchRequest(ODataRequest request, boolean isStrict) throws BatchException {
-    return parser.parseBatchRequest(request.getBody(), getContentType(request), request.getRawBaseUri(),
-        request.getRawServiceResolutionUri(), isStrict);
-  }
-  
-  @Override
-  public ODataResponse handleODataRequest(ODataRequest request, BatchRequestPart requestPart) throws BatchException {
-    return partHandler.handleODataRequest(request, requestPart);
-  }
-  
-  @Override
-  public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws BatchException {
-    return partHandler.handleBatchRequest(request);
-  }
-
-  @Override
-  public void writeResponseParts(List<ODataResponsePart> batchResponses, ODataResponse response) throws BatchException,
-      IOException {
-    writer.toODataResponse(batchResponses, response);
-  }
-
-  private String getContentType(ODataRequest request) {
-    return request.getHeader(HttpHeader.CONTENT_TYPE);
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchPartHandler.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchPartHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchPartHandler.java
deleted file mode 100644
index 2147a2e..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/handler/BatchPartHandler.java
+++ /dev/null
@@ -1,150 +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.core.batch.handler;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.BatchException;
-import org.apache.olingo.server.api.batch.BatchOperation;
-import org.apache.olingo.server.api.batch.BatchRequestPart;
-import org.apache.olingo.server.api.batch.ODataResponsePart;
-import org.apache.olingo.server.api.processor.BatchProcessor;
-import org.apache.olingo.server.core.ODataHandler;
-import org.apache.olingo.server.core.batch.parser.BatchParserCommon;
-import org.apache.olingo.server.core.batch.transformator.HttpRequestStatusLine.ODataURI;
-
-public class BatchPartHandler {
-
-  private ODataHandler oDataHandler;
-  private BatchProcessor batchProcessor;
-  private BatchOperation batchOperation;
-  private Map<BatchRequestPart, UriMapping> uriMapping = new HashMap<BatchRequestPart, UriMapping>();
-
-  public BatchPartHandler(final ODataHandler oDataHandler, final BatchProcessor processor,
-      final BatchOperation batchOperation) {
-    this.oDataHandler = oDataHandler;
-    this.batchProcessor = processor;
-    this.batchOperation = batchOperation;
-  }
-
-  public ODataResponse handleODataRequest(ODataRequest request, BatchRequestPart requestPart) throws BatchException {
-    final ODataResponse response;
-
-    if (requestPart.isChangeSet()) {
-      final UriMapping mapping = replaceReference(request, requestPart);
-
-      response = oDataHandler.process(request);
-
-      // Store resource URI
-      final String resourceUri = getODataPath(request, response);
-      final String contentId = request.getHeader(BatchParserCommon.HTTP_CONTENT_ID);
-
-      mapping.addMapping(contentId, resourceUri);
-    } else {
-      response = oDataHandler.process(request);
-    }
-
-    // Add content id to response
-    final String contentId = request.getHeader(BatchParserCommon.HTTP_CONTENT_ID);
-    if (contentId != null) {
-      response.setHeader(BatchParserCommon.HTTP_CONTENT_ID, contentId);
-    }
-
-    return response;
-  }
-
-  private String getODataPath(ODataRequest request, ODataResponse response) throws BatchException {
-    String resourceUri = null;
-
-    if (request.getMethod() == HttpMethod.POST) {
-      // Create entity
-      // The URI of the new resource will be generated by the server and published in the location header
-      ODataURI uri = new ODataURI(response.getHeaders().get(HttpHeader.LOCATION), request.getRawBaseUri());
-      resourceUri = uri.getRawODataPath();
-    } else {
-      // Update, Upsert (PUT, PATCH, Delete)
-      // These methods still addresses a given resource, so we use the URI given by the request
-      resourceUri = request.getRawODataPath();
-    }
-
-    return resourceUri;
-  }
-
-  private UriMapping replaceReference(ODataRequest request, BatchRequestPart requestPart) {
-    final UriMapping mapping = getUriMappingOrDefault(requestPart);
-    final String reference = BatchChangeSetSorter.getReferenceInURI(request);
-
-    if (reference != null) {
-      final String replacement = mapping.getUri(reference);
-
-      if (replacement != null) {
-        BatchChangeSetSorter.replaceContentIdReference(request, reference, replacement);
-      } else {
-        throw new ODataRuntimeException("Required Content-Id for reference \"" + reference + "\" not found.");
-      }
-    }
-
-    return mapping;
-  }
-
-  private UriMapping getUriMappingOrDefault(final BatchRequestPart requestPart) {
-    UriMapping mapping = uriMapping.get(requestPart);
-
-    if (mapping == null) {
-      mapping = new UriMapping();
-    }
-    uriMapping.put(requestPart, mapping);
-
-    return mapping;
-  }
-
-  public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws BatchException {
-    if (request.isChangeSet()) {
-      return handleChangeSet(request);
-    } else {
-      final ODataResponse response = handleODataRequest(request.getRequests().get(0), request);
-      
-      return new ODataResponsePart(response, false);
-    }
-  }
-
-  private ODataResponsePart handleChangeSet(BatchRequestPart request) throws BatchException {
-    final BatchChangeSetSorter sorter = new BatchChangeSetSorter(request.getRequests());
-
-    return batchProcessor.executeChangeSet(batchOperation, sorter.getOrderdRequests(), request);
-  }
-
-  private static class UriMapping {
-    private Map<String, String> uriMapping = new HashMap<String, String>();
-
-    public void addMapping(final String contentId, final String uri) {
-      uriMapping.put(contentId, uri);
-    }
-
-    public String getUri(final String contentId) {
-      return uriMapping.get(contentId);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchBodyPart.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchBodyPart.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchBodyPart.java
deleted file mode 100644
index 2b93783..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchBodyPart.java
+++ /dev/null
@@ -1,135 +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.core.batch.parser;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.server.api.batch.BatchException;
-import org.apache.olingo.server.core.batch.parser.BufferedReaderIncludingLineEndings.Line;
-
-public class BatchBodyPart implements BatchPart {
-  final private String boundary;
-  final private boolean isStrict;
-  final List<Line> remainingMessage = new LinkedList<Line>();
-
-  private Header headers;
-  private boolean isChangeSet;
-  private List<BatchQueryOperation> requests;
-
-  public BatchBodyPart(final List<Line> message, final String boundary, final boolean isStrict) {
-    this.boundary = boundary;
-    this.isStrict = isStrict;
-    remainingMessage.addAll(message);
-  }
-
-  public BatchBodyPart parse() throws BatchException {
-    headers = BatchParserCommon.consumeHeaders(remainingMessage);
-    BatchParserCommon.consumeBlankLine(remainingMessage, isStrict);
-    isChangeSet = isChangeSet(headers);
-    requests = consumeRequest(remainingMessage);
-
-    return this;
-  }
-
-  private boolean isChangeSet(final Header header) throws BatchException {
-    final List<String> contentTypes = headers.getHeaders(HttpHeader.CONTENT_TYPE);
-    boolean isChangeSet = false;
-
-    if (contentTypes.size() == 0) {
-      throw new BatchException("Missing content type", BatchException.MessageKeys.MISSING_CONTENT_TYPE, ""
-          + headers.getLineNumber());
-    }
-
-    for (String contentType : contentTypes) {
-      if (isContentTypeMultiPartMixed(contentType)) {
-        isChangeSet = true;
-      }
-    }
-
-    return isChangeSet;
-  }
-
-  private List<BatchQueryOperation> consumeRequest(final List<Line> remainingMessage) throws BatchException {
-    if (isChangeSet) {
-      return consumeChangeSet(remainingMessage);
-    } else {
-      return consumeQueryOperation(remainingMessage);
-    }
-  }
-
-  private List<BatchQueryOperation> consumeChangeSet(final List<Line> remainingMessage2) throws BatchException {
-    final List<List<Line>> changeRequests = splitChangeSet(remainingMessage);
-    final List<BatchQueryOperation> requestList = new LinkedList<BatchQueryOperation>();
-
-    for (List<Line> changeRequest : changeRequests) {
-      requestList.add(new BatchChangeSetPart(changeRequest, isStrict).parse());
-    }
-
-    return requestList;
-  }
-
-  private List<List<Line>> splitChangeSet(final List<Line> remainingMessage2) throws BatchException {
-
-    final HeaderField contentTypeField = headers.getHeaderField(HttpHeader.CONTENT_TYPE);
-    final String changeSetBoundary = BatchParserCommon.getBoundary(contentTypeField.getValueNotNull(),
-        contentTypeField.getLineNumber());
-    validateChangeSetBoundary(changeSetBoundary, headers);
-
-    return BatchParserCommon.splitMessageByBoundary(remainingMessage, changeSetBoundary);
-  }
-
-  private void validateChangeSetBoundary(final String changeSetBoundary, final Header header) throws BatchException {
-    if (changeSetBoundary.equals(boundary)) {
-      throw new BatchException("Change set boundary is equals to batch request boundary",
-          BatchException.MessageKeys.INVALID_BOUNDARY,
-          "" + header.getHeaderField(HttpHeader.CONTENT_TYPE).getLineNumber());
-    }
-  }
-
-  private List<BatchQueryOperation> consumeQueryOperation(final List<Line> remainingMessage) throws BatchException {
-    final List<BatchQueryOperation> requestList = new LinkedList<BatchQueryOperation>();
-    requestList.add(new BatchQueryOperation(remainingMessage, isStrict).parse());
-
-    return requestList;
-  }
-
-  private boolean isContentTypeMultiPartMixed(final String contentType) {
-    return BatchParserCommon.PATTERN_MULTIPART_BOUNDARY.matcher(contentType).matches();
-  }
-
-  @Override
-  public Header getHeaders() {
-    return headers;
-  }
-
-  @Override
-  public boolean isStrict() {
-    return isStrict;
-  }
-
-  public boolean isChangeSet() {
-    return isChangeSet;
-  }
-
-  public List<BatchQueryOperation> getRequests() {
-    return requests;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchChangeSetPart.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchChangeSetPart.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchChangeSetPart.java
deleted file mode 100644
index aaa2660..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchChangeSetPart.java
+++ /dev/null
@@ -1,56 +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.core.batch.parser;
-
-import java.util.List;
-
-import org.apache.olingo.server.api.batch.BatchException;
-import org.apache.olingo.server.core.batch.parser.BufferedReaderIncludingLineEndings.Line;
-
-public class BatchChangeSetPart extends BatchQueryOperation {
-  private BatchQueryOperation request;
-
-  public BatchChangeSetPart(final List<Line> message, final boolean isStrict) throws BatchException {
-    super(message, isStrict);
-  }
-
-  @Override
-  public BatchChangeSetPart parse() throws BatchException {
-    headers = BatchParserCommon.consumeHeaders(message);
-    BatchParserCommon.consumeBlankLine(message, isStrict);
-
-    request = new BatchQueryOperation(message, isStrict).parse();
-
-    return this;
-  }
-
-  public BatchQueryOperation getRequest() {
-    return request;
-  }
-
-  @Override
-  public List<Line> getBody() {
-    return request.getBody();
-  }
-
-  @Override
-  public Line getHttpStatusLine() {
-    return request.getHttpStatusLine();
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchParser.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchParser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchParser.java
deleted file mode 100644
index 3a89440..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchParser.java
+++ /dev/null
@@ -1,88 +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.core.batch.parser;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.server.api.batch.BatchException;
-import org.apache.olingo.server.api.batch.BatchParserResult;
-import org.apache.olingo.server.api.batch.BatchRequestPart;
-import org.apache.olingo.server.core.batch.parser.BufferedReaderIncludingLineEndings.Line;
-import org.apache.olingo.server.core.batch.transformator.BatchRequestTransformator;
-
-public class BatchParser {
-
-  private String contentTypeMime;
-  private String rawServiceResolutionUri;
-  private boolean isStrict;
-
-  @SuppressWarnings("unchecked")
-  public List<BatchRequestPart> parseBatchRequest(final InputStream in, final String contentType, final String baseUri,
-      final String serviceResolutionUri, final boolean isStrict) throws BatchException {
-    
-    contentTypeMime = contentType;
-    this.isStrict = isStrict;
-    this.rawServiceResolutionUri = serviceResolutionUri;
-
-    return (List<BatchRequestPart>) parse(in, new BatchRequestTransformator(baseUri, rawServiceResolutionUri));
-  }
-
-  private List<? extends BatchParserResult> parse(final InputStream in, final BatchRequestTransformator transformator)
-      throws BatchException {
-    try {
-      return parseBatch(in, transformator);
-    } catch (IOException e) {
-      throw new ODataRuntimeException(e);
-    } finally {
-      try {
-        in.close();
-      } catch (IOException e) {
-        throw new ODataRuntimeException(e);
-      }
-    }
-  }
-
-  private List<BatchParserResult> parseBatch(final InputStream in, final BatchRequestTransformator transformator)
-      throws IOException, BatchException {
-    final String boundary = BatchParserCommon.getBoundary(contentTypeMime, 1);
-    final List<BatchParserResult> resultList = new LinkedList<BatchParserResult>();
-    final List<List<Line>> bodyPartStrings = splitBodyParts(in, boundary);
-
-    for (List<Line> bodyPartString : bodyPartStrings) {
-      BatchBodyPart bodyPart = new BatchBodyPart(bodyPartString, boundary, isStrict).parse();
-      resultList.addAll(transformator.transform(bodyPart));
-    }
-
-    return resultList;
-  }
-
-  private List<List<Line>> splitBodyParts(final InputStream in, final String boundary) throws IOException,
-      BatchException {
-    final BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(new InputStreamReader(in));
-    final List<Line> message = reader.toLineList();
-    reader.close();
-
-    return BatchParserCommon.splitMessageByBoundary(message, boundary);
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchParserCommon.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchParserCommon.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchParserCommon.java
deleted file mode 100644
index b87f8ef..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchParserCommon.java
+++ /dev/null
@@ -1,221 +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.core.batch.parser;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.server.api.batch.BatchException;
-import org.apache.olingo.server.core.batch.parser.BufferedReaderIncludingLineEndings.Line;
-
-public class BatchParserCommon {
-
-  private static final String REG_EX_BOUNDARY =
-      "([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+\\s\\" +
-          "(\\),/:=\\?]{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\"";
-  private static final Pattern PATTERN_LAST_CRLF = Pattern.compile("(.*)(\r\n){1}( *)", Pattern.DOTALL);
-  private static final Pattern PATTERN_HEADER_LINE = Pattern.compile("([a-zA-Z\\-]+):\\s?(.*)\\s*");
-  private static final String REG_EX_APPLICATION_HTTP = "application/http";
-  
-  public static final Pattern PATTERN_MULTIPART_BOUNDARY = Pattern.compile("multipart/mixed(.*)",
-      Pattern.CASE_INSENSITIVE);
-  public static final Pattern PATTERN_CONTENT_TYPE_APPLICATION_HTTP = Pattern.compile(REG_EX_APPLICATION_HTTP,
-      Pattern.CASE_INSENSITIVE);
-  public static final String BINARY_ENCODING = "binary";
-  public static final String HTTP_CONTENT_ID = "Content-Id";
-  public static final String HTTP_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
-  
-  public static final String HTTP_EXPECT = "Expect";
-  public static final String HTTP_FROM = "From";
-  public static final String HTTP_MAX_FORWARDS = "Max-Forwards";
-  public static final String HTTP_RANGE = "Range";
-  public static final String HTTP_TE = "TE";
-  
-  public static String getBoundary(final String contentType, final int line) throws BatchException {
-    if (contentType.toLowerCase(Locale.ENGLISH).startsWith("multipart/mixed")) {
-      final String[] parameter = contentType.split(";");
-
-      for (final String pair : parameter) {
-
-        final String[] attrValue = pair.split("=");
-        if (attrValue.length == 2 && "boundary".equals(attrValue[0].trim().toLowerCase(Locale.ENGLISH))) {
-          if (attrValue[1].matches(REG_EX_BOUNDARY)) {
-            return trimQuota(attrValue[1].trim());
-          } else {
-            throw new BatchException("Invalid boundary format", BatchException.MessageKeys.INVALID_BOUNDARY, "" + line);
-          }
-        }
-
-      }
-    }
-    throw new BatchException("Content type is not multipart mixed", 
-        BatchException.MessageKeys.INVALID_CONTENT_TYPE, HttpContentType.MULTIPART_MIXED);
-  }
-
-  public static String removeEndingSlash(String content) {
-    content = content.trim();
-    int lastSlashIndex = content.lastIndexOf('/');
-
-    return (lastSlashIndex == content.length() - 1) ? content.substring(0, content.length() - 1) : content;
-  }
-
-  private static String trimQuota(String boundary) {
-    if (boundary.matches("\".*\"")) {
-      boundary = boundary.replace("\"", "");
-    }
-
-    return boundary;
-  }
-
-  public static List<List<Line>> splitMessageByBoundary(final List<Line> message, final String boundary)
-      throws BatchException {
-    final List<List<Line>> messageParts = new LinkedList<List<Line>>();
-    List<Line> currentPart = new ArrayList<Line>();
-    boolean isEndReached = false;
-
-    final String quotedBoundary = Pattern.quote(boundary);
-    final Pattern boundaryDelimiterPattern = Pattern.compile("--" + quotedBoundary + "--[\\s ]*");
-    final Pattern boundaryPattern = Pattern.compile("--" + quotedBoundary + "[\\s ]*");
-
-    for (Line currentLine : message) {
-      if (boundaryDelimiterPattern.matcher(currentLine.toString()).matches()) {
-        removeEndingCRLFFromList(currentPart);
-        messageParts.add(currentPart);
-        isEndReached = true;
-      } else if (boundaryPattern.matcher(currentLine.toString()).matches()) {
-        removeEndingCRLFFromList(currentPart);
-        messageParts.add(currentPart);
-        currentPart = new LinkedList<Line>();
-      } else {
-        currentPart.add(currentLine);
-      }
-
-      if (isEndReached) {
-        break;
-      }
-    }
-
-    final int lineNumer = (message.size() > 0) ? message.get(0).getLineNumber() : 0;
-    // Remove preamble
-    if (messageParts.size() > 0) {
-      messageParts.remove(0);
-    }
-
-    if (!isEndReached) {
-      throw new BatchException("Missing close boundary delimiter", BatchException.MessageKeys.MISSING_CLOSE_DELIMITER,
-          "" + lineNumer);
-    }
-
-    return messageParts;
-  }
-
-  private static void removeEndingCRLFFromList(final List<Line> list) {
-    if (list.size() > 0) {
-      Line lastLine = list.remove(list.size() - 1);
-      list.add(removeEndingCRLF(lastLine));
-    }
-  }
-
-  public static Line removeEndingCRLF(final Line line) {
-    Pattern pattern = PATTERN_LAST_CRLF;
-    Matcher matcher = pattern.matcher(line.toString());
-
-    if (matcher.matches()) {
-      return new Line(matcher.group(1), line.getLineNumber());
-    } else {
-      return line;
-    }
-  }
-
-  public static Header consumeHeaders(final List<Line> remainingMessage) {
-    final int headerLineNumber = remainingMessage.size() != 0 ? remainingMessage.get(0).getLineNumber() : 0;
-    final Header headers = new Header(headerLineNumber);
-    final Iterator<Line> iter = remainingMessage.iterator();
-    Line currentLine;
-    boolean isHeader = true;
-
-    while (iter.hasNext() && isHeader) {
-      currentLine = iter.next();
-      final Matcher headerMatcher = PATTERN_HEADER_LINE.matcher(currentLine.toString());
-
-      if (headerMatcher.matches() && headerMatcher.groupCount() == 2) {
-        iter.remove();
-
-        String headerName = headerMatcher.group(1).trim();
-        String headerValue = headerMatcher.group(2).trim();
-
-        headers.addHeader(headerName, Header.splitValuesByComma(headerValue), currentLine.getLineNumber());
-      } else {
-        isHeader = false;
-      }
-    }
-
-    return headers;
-  }
-
-  public static void consumeBlankLine(final List<Line> remainingMessage, final boolean isStrict) throws BatchException {
-    //TODO is \r\n to strict?
-    if (remainingMessage.size() > 0 && remainingMessage.get(0).toString().matches("\\s*(\r\n|\n)\\s*")) {
-      remainingMessage.remove(0);
-    } else {
-      if (isStrict) {
-        final int lineNumber = (remainingMessage.size() > 0) ? remainingMessage.get(0).getLineNumber() : 0;
-        throw new BatchException("Missing blank line", BatchException.MessageKeys.MISSING_BLANK_LINE, "[None]", ""
-            + lineNumber);
-      }
-    }
-  }
-
-  public static InputStream convertLineListToInputStream(List<Line> messageList) {
-    final String message = lineListToString(messageList);
-
-    return new ByteArrayInputStream(message.getBytes());
-  }
-
-  private static String lineListToString(List<Line> messageList) {
-    final StringBuilder builder = new StringBuilder();
-
-    for (Line currentLine : messageList) {
-      builder.append(currentLine.toString());
-    }
-
-    return builder.toString();
-  }
-  
-  public static String trimLineListToLength(final List<Line> list, final int length) {
-    final String message = lineListToString(list);
-    final int lastIndex = Math.min(length, message.length());
-
-    return (lastIndex > 0) ? message.substring(0, lastIndex) : "";
-  }
-  
-  public static InputStream convertLineListToInputStream(List<Line> list, int length) {
-    final String message = trimLineListToLength(list, length);
-
-    return new ByteArrayInputStream(message.getBytes());
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchPart.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchPart.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchPart.java
deleted file mode 100644
index 104c152..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchPart.java
+++ /dev/null
@@ -1,25 +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.core.batch.parser;
-
-public interface BatchPart {
-  public Header getHeaders();
-
-  public boolean isStrict();
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchQueryOperation.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchQueryOperation.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchQueryOperation.java
deleted file mode 100644
index 6a5309e..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchQueryOperation.java
+++ /dev/null
@@ -1,82 +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.core.batch.parser;
-
-import java.util.List;
-
-import org.apache.olingo.server.api.batch.BatchException;
-import org.apache.olingo.server.core.batch.parser.BufferedReaderIncludingLineEndings.Line;
-
-public class BatchQueryOperation implements BatchPart {
-
-  protected final boolean isStrict;
-  protected Line httpStatusLine;
-  protected Header headers;
-  protected List<Line> body;
-  protected int bodySize;
-  protected List<Line> message;
-
-  public BatchQueryOperation(final List<Line> message, final boolean isStrict) {
-    this.isStrict = isStrict;
-    this.message = message;
-  }
-
-  public BatchQueryOperation parse() throws BatchException {
-    httpStatusLine = consumeHttpStatusLine(message);
-    headers = BatchParserCommon.consumeHeaders(message);
-    BatchParserCommon.consumeBlankLine(message, isStrict);
-    body = message;
-
-    return this;
-  }
-
-  protected Line consumeHttpStatusLine(final List<Line> message) throws BatchException {
-    if (message.size() > 0 && !message.get(0).toString().trim().equals("")) {
-      final Line method = message.get(0);
-      message.remove(0);
-
-      return method;
-    } else {
-      final int line = (message.size() > 0) ? message.get(0).getLineNumber() : 0;
-      throw new BatchException("Missing http request line", BatchException.MessageKeys.INVALID_STATUS_LINE, "" + line);
-    }
-  }
-
-  public Line getHttpStatusLine() {
-    return httpStatusLine;
-  }
-
-  public List<Line> getBody() {
-    return body;
-  }
-
-  public int getBodySize() {
-    return bodySize;
-  }
-
-  @Override
-  public Header getHeaders() {
-    return headers;
-  }
-
-  @Override
-  public boolean isStrict() {
-    return isStrict;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/51acf8ae/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchRequestPartImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchRequestPartImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchRequestPartImpl.java
deleted file mode 100644
index 9765b37..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batch/parser/BatchRequestPartImpl.java
+++ /dev/null
@@ -1,51 +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.core.batch.parser;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.batch.BatchRequestPart;
-
-/**
- * Has to be immutable!
- *
- */
-public class BatchRequestPartImpl implements BatchRequestPart {
-
-  private List<ODataRequest> requests = new ArrayList<ODataRequest>();
-  private boolean isChangeSet;
-  
-  public BatchRequestPartImpl(final boolean isChangeSet, final List<ODataRequest> requests) {
-    this.isChangeSet = isChangeSet;
-    this.requests = requests;
-  }
-
-  @Override
-  public boolean isChangeSet() {
-    return isChangeSet;
-  }
-
-  @Override
-  public List<ODataRequest> getRequests() {
-    return Collections.unmodifiableList(requests);
-  }
-}