You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2016/03/04 21:36:46 UTC
[03/39] olingo-odata4 git commit: [OLINGO-832] Added iterable
[OLINGO-832] Added iterable
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/69f58e84
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/69f58e84
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/69f58e84
Branch: refs/heads/OLINGO-856_ODataHandlerInAPI
Commit: 69f58e84bf057239f50273031e7617641fbcc41f
Parents: 885ec27
Author: mibo <mi...@apache.org>
Authored: Sun Jan 24 07:22:57 2016 +0100
Committer: mibo <mi...@apache.org>
Committed: Sun Jan 24 12:31:02 2016 +0100
----------------------------------------------------------------------
.../core/serialization/AtomSerializer.java | 2 +-
.../commons/api/data/EntityCollection.java | 8 +++-
.../olingo/commons/api/data/EntityIterator.java | 43 ++++++++++++++++++
.../api/data/EntityStreamCollection.java | 28 ------------
.../apache/olingo/server/core/ODataImpl.java | 7 ++-
.../serializer/ChannelSerializerResult.java | 46 ++++++++++----------
.../core/serializer/SerializerResultImpl.java | 5 +--
.../core/serializer/StreamSerializerResult.java | 26 +++++------
.../serializer/json/ODataJsonSerializer.java | 2 +-
.../json/ODataJsonStreamSerializer.java | 44 ++-----------------
.../serializer/utils/CircleStreamBuffer.java | 1 -
.../core/serializer/xml/ODataXmlSerializer.java | 4 +-
.../uri/parser/search/SearchTokenizerTest.java | 15 +++----
.../processor/TechnicalEntityProcessor.java | 20 ++++-----
14 files changed, 117 insertions(+), 134 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomSerializer.java
index b43605f..3c5fa1f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomSerializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomSerializer.java
@@ -525,7 +525,7 @@ public class AtomSerializer extends AbstractAtomDealer implements ODataSerialize
common(writer, entitySet);
- for (Entity entity : entitySet.getEntities()) {
+ for (Entity entity : entitySet) {
if (entity.getType() == null && entity.getProperties().isEmpty()) {
entityRef(writer, entity);
} else {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityCollection.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityCollection.java
index adb43dc..e2aee4e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityCollection.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityCollection.java
@@ -20,12 +20,13 @@ package org.apache.olingo.commons.api.data;
import java.net.URI;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
/**
* Data representation for a collection of single entities.
*/
-public class EntityCollection extends AbstractODataObject {
+public class EntityCollection extends AbstractODataObject implements Iterable<Entity> {
private Integer count;
@@ -97,4 +98,9 @@ public class EntityCollection extends AbstractODataObject {
public void setDeltaLink(final URI deltaLink) {
this.deltaLink = deltaLink;
}
+
+ @Override
+ public Iterator<Entity> iterator() {
+ return this.entities.iterator();
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityIterator.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityIterator.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityIterator.java
new file mode 100644
index 0000000..18f1019
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityIterator.java
@@ -0,0 +1,43 @@
+/*
+ * 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.commons.api.data;
+
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
+
+import java.util.Iterator;
+
+/**
+ * Data representation for a collection of single entities.
+ */
+public abstract class EntityIterator extends EntityCollection implements Iterator<Entity> {
+
+ public abstract boolean hasNext();
+ public abstract Entity next();
+
+ @Override
+ public void remove() {
+ //"Remove is not supported for iteration over Entities."
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public Iterator<Entity> iterator() {
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityStreamCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityStreamCollection.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityStreamCollection.java
deleted file mode 100644
index 9eae442..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityStreamCollection.java
+++ /dev/null
@@ -1,28 +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.commons.api.data;
-
-/**
- * Data representation for a collection of single entities.
- */
-public abstract class EntityStreamCollection extends EntityCollection {
-
- public abstract boolean hasNext();
- public abstract Entity nextEntity();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/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 df6c7df..b063233 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,9 +18,6 @@
*/
package org.apache.olingo.server.core;
-import java.util.Collection;
-import java.util.List;
-
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider;
@@ -48,11 +45,13 @@ import org.apache.olingo.server.core.deserializer.xml.ODataXmlDeserializer;
import org.apache.olingo.server.core.etag.ETagHelperImpl;
import org.apache.olingo.server.core.prefer.PreferencesImpl;
import org.apache.olingo.server.core.serializer.FixedFormatSerializerImpl;
-import org.apache.olingo.server.core.serializer.json.ODataJsonSerializer;
import org.apache.olingo.server.core.serializer.json.ODataJsonStreamSerializer;
import org.apache.olingo.server.core.serializer.xml.ODataXmlSerializer;
import org.apache.olingo.server.core.uri.UriHelperImpl;
+import java.util.Collection;
+import java.util.List;
+
public class ODataImpl extends OData {
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ChannelSerializerResult.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ChannelSerializerResult.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ChannelSerializerResult.java
index 1d4c32f..7768783 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ChannelSerializerResult.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ChannelSerializerResult.java
@@ -18,16 +18,10 @@
*/
package org.apache.olingo.server.core.serializer;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.nio.channels.Channels;
-import java.nio.channels.ReadableByteChannel;
-import java.nio.charset.Charset;
-
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonGenerator;
import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityStreamCollection;
+import org.apache.olingo.commons.api.data.EntityIterator;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
@@ -36,8 +30,13 @@ import org.apache.olingo.server.api.serializer.SerializerResult;
import org.apache.olingo.server.core.serializer.json.ODataJsonStreamSerializer;
import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer;
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonGenerator;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.charset.Charset;
public class ChannelSerializerResult implements SerializerResult {
private ReadableByteChannel channel;
@@ -47,14 +46,14 @@ public class ChannelSerializerResult implements SerializerResult {
private ByteBuffer head;
private ByteBuffer tail;
private ODataJsonStreamSerializer jsonSerializer;
- private EntityStreamCollection coll;
+ private EntityIterator coll;
private ServiceMetadata metadata;
private EdmEntityType entityType;
private EntitySerializerOptions options;
- public StreamChannel(EntityStreamCollection coll, EdmEntityType entityType, String head,
- ODataJsonStreamSerializer jsonSerializer, ServiceMetadata metadata,
- EntitySerializerOptions options, String tail) {
+ public StreamChannel(EntityIterator coll, EdmEntityType entityType, String head,
+ ODataJsonStreamSerializer jsonSerializer, ServiceMetadata metadata,
+ EntitySerializerOptions options, String tail) {
this.coll = coll;
this.entityType = entityType;
this.head = ByteBuffer.wrap(head.getBytes(DEFAULT));
@@ -86,11 +85,12 @@ public class ChannelSerializerResult implements SerializerResult {
private ByteBuffer getCurrentBuffer() {
if(currentBuffer == null) {
currentBuffer = head;
- } if(!currentBuffer.hasRemaining()) {
+ }
+ if(!currentBuffer.hasRemaining()) {
if (coll.hasNext()) {
try {
// FIXME: mibo_160108: Inefficient buffer handling, replace
- currentBuffer = serEntity(coll.nextEntity());
+ currentBuffer = serEntity(coll.next());
if(coll.hasNext()) {
ByteBuffer b = ByteBuffer.allocate(currentBuffer.position() + 1);
currentBuffer.flip();
@@ -160,22 +160,24 @@ public class ChannelSerializerResult implements SerializerResult {
this.channel = channel;
}
- public static SerializerResultBuilder with(EntityStreamCollection coll, EdmEntityType entityType,
- ODataJsonStreamSerializer jsonSerializer, ServiceMetadata metadata, EntitySerializerOptions options) {
+ public static SerializerResultBuilder with(EntityIterator coll, EdmEntityType entityType,
+ ODataJsonStreamSerializer jsonSerializer,
+ ServiceMetadata metadata, EntitySerializerOptions options) {
return new SerializerResultBuilder(coll, entityType, jsonSerializer, metadata, options);
}
public static class SerializerResultBuilder {
private ODataJsonStreamSerializer jsonSerializer;
- private EntityStreamCollection coll;
+ private EntityIterator coll;
private ServiceMetadata metadata;
private EdmEntityType entityType;
private EntitySerializerOptions options;
private String head;
private String tail;
- public SerializerResultBuilder(EntityStreamCollection coll, EdmEntityType entityType,
- ODataJsonStreamSerializer jsonSerializer, ServiceMetadata metadata, EntitySerializerOptions options) {
+ public SerializerResultBuilder(EntityIterator coll, EdmEntityType entityType,
+ ODataJsonStreamSerializer jsonSerializer,
+ ServiceMetadata metadata, EntitySerializerOptions options) {
this.coll = coll;
this.entityType = entityType;
this.jsonSerializer = jsonSerializer;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/SerializerResultImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/SerializerResultImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/SerializerResultImpl.java
index 5a5364a..c039a71 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/SerializerResultImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/SerializerResultImpl.java
@@ -18,13 +18,12 @@
*/
package org.apache.olingo.server.core.serializer;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+
import java.io.InputStream;
-import java.nio.channels.Channel;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
-import org.apache.olingo.server.api.serializer.SerializerResult;
-
public class SerializerResultImpl implements SerializerResult {
private InputStream content;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/StreamSerializerResult.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/StreamSerializerResult.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/StreamSerializerResult.java
index e4c8051..19b9f5d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/StreamSerializerResult.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/StreamSerializerResult.java
@@ -21,7 +21,7 @@ package org.apache.olingo.server.core.serializer;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityStreamCollection;
+import org.apache.olingo.commons.api.data.EntityIterator;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
@@ -34,9 +34,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.nio.channels.Channel;
import java.nio.channels.Channels;
-import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
public class StreamSerializerResult implements SerializerResult {
@@ -50,14 +48,14 @@ public class StreamSerializerResult implements SerializerResult {
private int entityCount = 0;
private InputStream inputStream = null;
private ODataJsonStreamSerializer jsonSerializer;
- private EntityStreamCollection coll;
+ private EntityIterator coll;
private ServiceMetadata metadata;
private EdmEntityType entityType;
private EntitySerializerOptions options;
- public StreamInputStream(EntityStreamCollection coll, EdmEntityType entityType, String head,
- ODataJsonStreamSerializer jsonSerializer, ServiceMetadata metadata,
- EntitySerializerOptions options, String tail) {
+ public StreamInputStream(EntityIterator coll, EdmEntityType entityType, String head,
+ ODataJsonStreamSerializer jsonSerializer, ServiceMetadata metadata,
+ EntitySerializerOptions options, String tail) {
this.coll = coll;
this.entityType = entityType;
this.head = head;
@@ -74,7 +72,7 @@ public class StreamSerializerResult implements SerializerResult {
}
if (inputStream == null && coll.hasNext()) {
try {
- inputStream = serEntity(coll.nextEntity());
+ inputStream = serEntity(coll.next());
entityCount++;
if (entityCount > 1) {
return (int) ',';
@@ -139,22 +137,24 @@ public class StreamSerializerResult implements SerializerResult {
this.content = content;
}
- public static SerializerResultBuilder with(EntityStreamCollection coll, EdmEntityType entityType,
- ODataJsonStreamSerializer jsonSerializer, ServiceMetadata metadata, EntitySerializerOptions options) {
+ public static SerializerResultBuilder with(EntityIterator coll, EdmEntityType entityType,
+ ODataJsonStreamSerializer jsonSerializer,
+ ServiceMetadata metadata, EntitySerializerOptions options) {
return new SerializerResultBuilder(coll, entityType, jsonSerializer, metadata, options);
}
public static class SerializerResultBuilder {
private ODataJsonStreamSerializer jsonSerializer;
- private EntityStreamCollection coll;
+ private EntityIterator coll;
private ServiceMetadata metadata;
private EdmEntityType entityType;
private EntitySerializerOptions options;
private String head;
private String tail;
- public SerializerResultBuilder(EntityStreamCollection coll, EdmEntityType entityType,
- ODataJsonStreamSerializer jsonSerializer, ServiceMetadata metadata, EntitySerializerOptions options) {
+ public SerializerResultBuilder(EntityIterator coll, EdmEntityType entityType,
+ ODataJsonStreamSerializer jsonSerializer, ServiceMetadata metadata,
+ EntitySerializerOptions options) {
this.coll = coll;
this.entityType = entityType;
this.jsonSerializer = jsonSerializer;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
index 4a1a528..ce0258c 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
@@ -217,7 +217,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
final boolean onlyReference, final JsonGenerator json) throws IOException,
SerializerException {
json.writeStartArray();
- for (final Entity entity : entitySet.getEntities()) {
+ for (final Entity entity : entitySet) {
if (onlyReference) {
json.writeStartObject();
json.writeStringField(Constants.JSON_ID, entity.getId().toASCIIString());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonStreamSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonStreamSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonStreamSerializer.java
index 110d416..a7bd4f4 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonStreamSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonStreamSerializer.java
@@ -21,60 +21,24 @@ package org.apache.olingo.server.core.serializer.json;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.ComplexValue;
import org.apache.olingo.commons.api.data.ContextURL;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.EntityStreamCollection;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Linked;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.data.EntityIterator;
import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.ODataServerError;
import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
-import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
-import org.apache.olingo.server.api.serializer.ReferenceCollectionSerializerOptions;
-import org.apache.olingo.server.api.serializer.ReferenceSerializerOptions;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.serializer.SerializerResult;
-import org.apache.olingo.server.api.uri.UriHelper;
-import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.core.serializer.AbstractODataSerializer;
import org.apache.olingo.server.core.serializer.ChannelSerializerResult;
-import org.apache.olingo.server.core.serializer.SerializerResultImpl;
-import org.apache.olingo.server.core.serializer.StreamSerializerResult;
-import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer;
-import org.apache.olingo.server.core.serializer.utils.ContentTypeHelper;
-import org.apache.olingo.server.core.serializer.utils.ContextURLBuilder;
-import org.apache.olingo.server.core.serializer.utils.ExpandSelectHelper;
-import org.apache.olingo.server.core.uri.UriHelperImpl;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.OutputStream;
import java.nio.charset.Charset;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
public class ODataJsonStreamSerializer extends ODataJsonSerializer {
@@ -90,9 +54,9 @@ public class ODataJsonStreamSerializer extends ODataJsonSerializer {
final EdmEntityType entityType, final EntityCollection entitySet,
final EntityCollectionSerializerOptions options) throws SerializerException {
- EntityStreamCollection coll;
- if(entitySet instanceof EntityStreamCollection) {
- coll = (EntityStreamCollection) entitySet;
+ EntityIterator coll;
+ if(entitySet instanceof EntityIterator) {
+ coll = (EntityIterator) entitySet;
} else {
return serializer.entityCollection(metadata, entityType, entitySet, options);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
index b7ba2f2..7586339 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
-import java.nio.channels.ReadableByteChannel;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
index 2af8ede..a97d322 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
@@ -336,7 +336,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
protected void writeEntitySet(final ServiceMetadata metadata, final EdmEntityType entityType,
final EntityCollection entitySet, final ExpandOption expand, final SelectOption select,
final XMLStreamWriter writer) throws XMLStreamException, SerializerException {
- for (final Entity entity : entitySet.getEntities()) {
+ for (final Entity entity : entitySet) {
writeEntity(metadata, entityType, entity, null, expand, select, writer, false);
}
}
@@ -1060,7 +1060,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
if (entitySet.getNext() != null) {
writeNextLink(entitySet, writer);
}
- for (final Entity entity : entitySet.getEntities()) {
+ for (final Entity entity : entitySet) {
writeReference(entity, options == null ? null : options.getContextURL(), writer, false);
}
writer.writeEndElement();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchTokenizerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchTokenizerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchTokenizerTest.java
index c2a390a..20a1c0d 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchTokenizerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchTokenizerTest.java
@@ -18,6 +18,13 @@
*/
package org.apache.olingo.server.core.uri.parser.search;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import static org.apache.olingo.server.core.uri.parser.search.SearchQueryToken.Token.AND;
import static org.apache.olingo.server.core.uri.parser.search.SearchQueryToken.Token.CLOSE;
import static org.apache.olingo.server.core.uri.parser.search.SearchQueryToken.Token.NOT;
@@ -26,14 +33,6 @@ import static org.apache.olingo.server.core.uri.parser.search.SearchQueryToken.T
import static org.apache.olingo.server.core.uri.parser.search.SearchQueryToken.Token.PHRASE;
import static org.apache.olingo.server.core.uri.parser.search.SearchQueryToken.Token.WORD;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-
public class SearchTokenizerTest {
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/69f58e84/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
index f8fa7c8..f4c81c1 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
@@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.data.ContextURL.Builder;
import org.apache.olingo.commons.api.data.ContextURL.Suffix;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.EntityStreamCollection;
+import org.apache.olingo.commons.api.data.EntityIterator;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
@@ -556,8 +556,8 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
final ContentType requestedFormat, final ExpandOption expand, final SelectOption select,
final CountOption countOption, final String id) throws ODataLibraryException {
- EntityStreamCollection streamCollection = new EntityStreamCollection() {
- Iterator<Entity> entityIterator = entityCollection.getEntities().iterator();
+ EntityIterator streamCollection = new EntityIterator() {
+ Iterator<Entity> entityIterator = entityCollection.iterator();
@Override
public boolean hasNext() {
@@ -565,7 +565,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
}
@Override
- public Entity nextEntity() {
+ public Entity next() {
Entity next = entityIterator.next();
replacePrimitiveProperty(next, "PropertyString", generateData(28192));
// next.getProperties().remove(1);
@@ -576,10 +576,10 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
return next;
}
- @Override
- public List<Entity> getEntities() {
- return entityCollection.getEntities();
- }
+// @Override
+// public List<Entity> getEntities() {
+// return entityCollection.getEntities();
+// }
private void replacePrimitiveProperty(Entity entity, String name, Object data) {
List<Property> properties = entity.getProperties();
@@ -625,7 +625,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
final ContentType requestedFormat, final ExpandOption expand, final SelectOption select,
final CountOption countOption, final String id) throws ODataLibraryException {
- EntityStreamCollection streamCollection = new EntityStreamCollection() {
+ EntityIterator streamCollection = new EntityIterator() {
Iterator<Entity> test = entityCollection.getEntities().iterator();
@Override
public boolean hasNext() {
@@ -633,7 +633,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
}
@Override
- public Entity nextEntity() {
+ public Entity next() {
try {
TimeUnit.MILLISECONDS.sleep(1000);
} catch (InterruptedException e) { }