You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/03/10 10:02:52 UTC
[36/51] [abbrv] [partial] [OLINGO-192] rename java packages
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java
new file mode 100644
index 0000000..831a8a3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructDeserializer.java
@@ -0,0 +1,147 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonLocation;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.ClassUtils;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class DynExprConstructDeserializer extends AbstractEdmDeserializer<DynExprConstructImpl> {
+
+ private static final String[] EL_OR_ATTR = { AnnotationPath.class.getSimpleName(), Path.class.getSimpleName() };
+
+ private static final String APPLY = Apply.class.getSimpleName();
+
+ private static final String CAST = Cast.class.getSimpleName();
+
+ private static final String COLLECTION = Collection.class.getSimpleName();
+
+ private static final String IF = If.class.getSimpleName();
+
+ private static final String IS_OF = IsOf.class.getSimpleName();
+
+ private static final String LABELED_ELEMENT = LabeledElement.class.getSimpleName();
+
+ private static final String NULL = Null.class.getSimpleName();
+
+ private static final String RECORD = Record.class.getSimpleName();
+
+ private static final String URL_REF = UrlRef.class.getSimpleName();
+
+ private AbstractElOrAttrConstruct getElOrAttrInstance(final String simpleClassName) throws JsonParseException {
+ try {
+ @SuppressWarnings("unchecked")
+ Class<? extends AbstractElOrAttrConstruct> elOrAttrClass =
+ (Class<? extends AbstractElOrAttrConstruct>) ClassUtils.getClass(
+ getClass().getPackage().getName() + "." + simpleClassName);
+ return elOrAttrClass.newInstance();
+ } catch (Exception e) {
+ throw new JsonParseException("Could not instantiate " + simpleClassName, JsonLocation.NA, e);
+ }
+ }
+
+ private ExprConstructImpl parseConstOrEnumExprConstruct(final JsonParser jp) throws IOException {
+ ExprConstructImpl result;
+ if (isAnnotationConstExprConstruct(jp)) {
+ result = parseAnnotationConstExprConstruct(jp);
+ } else {
+ result = jp.readValueAs( DynExprConstructImpl.class);
+ }
+ jp.nextToken();
+
+ return result;
+ }
+
+ @Override
+ protected DynExprConstructImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ DynExprConstructImpl construct = null;
+
+ if (DynExprSingleParamOp.Type.fromString(jp.getCurrentName()) != null) {
+ final DynExprSingleParamOp dynExprSingleParamOp = new DynExprSingleParamOp();
+ dynExprSingleParamOp.setType(DynExprSingleParamOp.Type.fromString(jp.getCurrentName()));
+
+ jp.nextToken();
+ jp.nextToken();
+ dynExprSingleParamOp.setExpression(jp.readValueAs( DynExprConstructImpl.class));
+
+ construct = dynExprSingleParamOp;
+ } else if (DynExprDoubleParamOp.Type.fromString(jp.getCurrentName()) != null) {
+ final DynExprDoubleParamOp dynExprDoubleParamOp = new DynExprDoubleParamOp();
+ dynExprDoubleParamOp.setType(DynExprDoubleParamOp.Type.fromString(jp.getCurrentName()));
+
+ jp.nextToken();
+ jp.nextToken();
+ dynExprDoubleParamOp.setLeft(jp.readValueAs( DynExprConstructImpl.class));
+ dynExprDoubleParamOp.setRight(jp.readValueAs( DynExprConstructImpl.class));
+
+ construct = dynExprDoubleParamOp;
+ } else if (ArrayUtils.contains(EL_OR_ATTR, jp.getCurrentName())) {
+ final AbstractElOrAttrConstruct elOrAttr = getElOrAttrInstance(jp.getCurrentName());
+ elOrAttr.setValue(jp.nextTextValue());
+
+ construct = elOrAttr;
+ } else if (APPLY.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( Apply.class);
+ } else if (CAST.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( Cast.class);
+ } else if (COLLECTION.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( Collection.class);
+ } else if (IF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ jp.nextToken();
+
+ final If _if = new If();
+ _if.setGuard(parseConstOrEnumExprConstruct(jp));
+ _if.setThen(parseConstOrEnumExprConstruct(jp));
+ _if.setElse(parseConstOrEnumExprConstruct(jp));
+
+ construct = _if;
+ } else if (IS_OF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( IsOf.class);
+ } else if (LABELED_ELEMENT.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( LabeledElement.class);
+ } else if (NULL.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( Null.class);
+ } else if (RECORD.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( Record.class);
+ } else if (URL_REF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( UrlRef.class);
+ }
+
+ return construct;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructImpl.java
new file mode 100644
index 0000000..8d73943
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprConstructImpl.java
@@ -0,0 +1,30 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
+
+@JsonDeserialize(using = DynExprConstructDeserializer.class)
+public abstract class DynExprConstructImpl extends ExprConstructImpl implements DynExprConstruct {
+
+ private static final long serialVersionUID = -642012862023177349L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprDoubleParamOp.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprDoubleParamOp.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprDoubleParamOp.java
new file mode 100644
index 0000000..85ec044
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprDoubleParamOp.java
@@ -0,0 +1,73 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
+
+public class DynExprDoubleParamOp extends DynExprConstructImpl {
+
+ private static final long serialVersionUID = -7974475975925167731L;
+
+ public static enum Type {
+
+ And,
+ Or;
+
+ public static Type fromString(final String value) {
+ Type result = null;
+ for (Type type : values()) {
+ if (value.equals(type.name())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+ }
+
+ private Type type;
+
+ private DynExprConstruct left;
+
+ private DynExprConstruct right;
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ public DynExprConstruct getLeft() {
+ return left;
+ }
+
+ public void setLeft(final DynExprConstruct left) {
+ this.left = left;
+ }
+
+ public DynExprConstruct getRight() {
+ return right;
+ }
+
+ public void setRight(final DynExprConstruct right) {
+ this.right = right;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprSingleParamOp.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprSingleParamOp.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprSingleParamOp.java
new file mode 100644
index 0000000..06797e9
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/DynExprSingleParamOp.java
@@ -0,0 +1,69 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
+
+public class DynExprSingleParamOp extends DynExprConstructImpl {
+
+ private static final long serialVersionUID = -7974475975925167731L;
+
+ public static enum Type {
+
+ Not,
+ Eq,
+ Ne,
+ Gt,
+ Ge,
+ Lt,
+ Le;
+
+ public static Type fromString(final String value) {
+ Type result = null;
+ for (Type type : values()) {
+ if (value.equals(type.name())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+
+ }
+
+ private Type type;
+
+ private DynExprConstruct expression;
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ public DynExprConstruct getExpression() {
+ return expression;
+ }
+
+ public void setExpression(final DynExprConstruct expression) {
+ this.expression = expression;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ExprConstructImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ExprConstructImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ExprConstructImpl.java
new file mode 100644
index 0000000..c0bd626
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/ExprConstructImpl.java
@@ -0,0 +1,28 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.ExprConstruct;
+import org.apache.olingo.client.core.edm.xml.AbstractEdmItem;
+
+public abstract class ExprConstructImpl extends AbstractEdmItem implements ExprConstruct {
+
+ private static final long serialVersionUID = 7108626008005050492L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/If.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/If.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/If.java
new file mode 100644
index 0000000..8477bd4
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/If.java
@@ -0,0 +1,57 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.ExprConstruct;
+
+public class If extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 6752952406406218936L;
+
+ private ExprConstruct guard;
+
+ private ExprConstruct _then;
+
+ private ExprConstruct _else;
+
+ public ExprConstruct getGuard() {
+ return guard;
+ }
+
+ public void setGuard(final ExprConstruct guard) {
+ this.guard = guard;
+ }
+
+ public ExprConstruct getThen() {
+ return _then;
+ }
+
+ public void setThen(final ExprConstruct _then) {
+ this._then = _then;
+ }
+
+ public ExprConstruct getElse() {
+ return _else;
+ }
+
+ public void setElse(final ExprConstruct _else) {
+ this._else = _else;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOf.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOf.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOf.java
new file mode 100644
index 0000000..6854fd2
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOf.java
@@ -0,0 +1,92 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.math.BigInteger;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
+
+@JsonDeserialize(using = IsOfDeserializer.class)
+public class IsOf extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 6958304670385303776L;
+
+ private String type;
+
+ private String maxLength;
+
+ private BigInteger precision;
+
+ private BigInteger scale;
+
+ private String srid;
+
+ private DynExprConstruct value;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+ public DynExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final DynExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java
new file mode 100644
index 0000000..51bafd6
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/IsOfDeserializer.java
@@ -0,0 +1,64 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+import java.math.BigInteger;
+
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class IsOfDeserializer extends AbstractEdmDeserializer<IsOf> {
+
+ @Override
+ protected IsOf doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final IsOf isof = new IsOf();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Type".equals(jp.getCurrentName())) {
+ isof.setType(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ isof.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ isof.setMaxLength(jp.nextTextValue());
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ isof.setPrecision(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ isof.setScale(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ isof.setSrid(jp.nextTextValue());
+ } else {
+ isof.setValue(jp.readValueAs(DynExprConstructImpl.class));
+ }
+ }
+ }
+
+ return isof;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElement.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElement.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElement.java
new file mode 100644
index 0000000..ccfdc37
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElement.java
@@ -0,0 +1,50 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
+
+@JsonDeserialize(using = LabeledElementDeserializer.class)
+public class LabeledElement extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 6938971787086282939L;
+
+ private String name;
+
+ private DynExprConstruct value;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public DynExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final DynExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java
new file mode 100644
index 0000000..da99713
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementDeserializer.java
@@ -0,0 +1,55 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class LabeledElementDeserializer extends AbstractEdmDeserializer<LabeledElement> {
+
+ @Override
+ protected LabeledElement doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final LabeledElement element = new LabeledElement();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ element.setName(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ element.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ } else {
+ element.setValue(jp.readValueAs(DynExprConstructImpl.class));
+ }
+ }
+ }
+
+ return element;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementReference.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementReference.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementReference.java
new file mode 100644
index 0000000..d33c955
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/LabeledElementReference.java
@@ -0,0 +1,25 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+public class LabeledElementReference extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = 3649068436729494270L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NavigationPropertyPath.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NavigationPropertyPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NavigationPropertyPath.java
new file mode 100644
index 0000000..f6b21d1
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NavigationPropertyPath.java
@@ -0,0 +1,25 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+public class NavigationPropertyPath extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = -8066400142504963043L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Null.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Null.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Null.java
new file mode 100644
index 0000000..0ff8a1e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Null.java
@@ -0,0 +1,28 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = NullDeserializer.class)
+public class Null extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = -3611384710172781951L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java
new file mode 100644
index 0000000..192be27
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/NullDeserializer.java
@@ -0,0 +1,51 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class NullDeserializer extends AbstractEdmDeserializer<Null> {
+
+ @Override
+ protected Null doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Null _null = new Null();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Annotation".equals(jp.getCurrentName())) {
+ _null.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return _null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Path.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Path.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Path.java
new file mode 100644
index 0000000..b9c4136
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Path.java
@@ -0,0 +1,25 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+public class Path extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = -2551058493469292082L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyPath.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyPath.java
new file mode 100644
index 0000000..ca47253
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyPath.java
@@ -0,0 +1,25 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+public class PropertyPath extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = 2328584735437885159L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValue.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValue.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValue.java
new file mode 100644
index 0000000..5493c33
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValue.java
@@ -0,0 +1,50 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.ExprConstruct;
+
+@JsonDeserialize(using = PropertyValueDeserializer.class)
+public class PropertyValue extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 3081968466425707461L;
+
+ private String property;
+
+ private ExprConstruct value;
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(final String property) {
+ this.property = property;
+ }
+
+ public ExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final ExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
new file mode 100644
index 0000000..7a52412
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/PropertyValueDeserializer.java
@@ -0,0 +1,57 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class PropertyValueDeserializer extends AbstractEdmDeserializer<PropertyValue> {
+
+ @Override
+ protected PropertyValue doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final PropertyValue propValue = new PropertyValue();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Property".equals(jp.getCurrentName())) {
+ propValue.setProperty(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ propValue.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ } else if (isAnnotationConstExprConstruct(jp)) {
+ propValue.setValue(parseAnnotationConstExprConstruct(jp));
+ } else {
+ propValue.setValue(jp.readValueAs(DynExprConstructImpl.class));
+ }
+ }
+ }
+
+ return propValue;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Record.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Record.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Record.java
new file mode 100644
index 0000000..862a677
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/Record.java
@@ -0,0 +1,46 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+
+@JsonDeserialize(using = RecordDeserializer.class)
+public class Record extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = -2886526224721870304L;
+
+ private String type;
+
+ private final List<PropertyValue> propertyValues = new ArrayList<PropertyValue>();
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public List<PropertyValue> getPropertyValues() {
+ return propertyValues;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java
new file mode 100644
index 0000000..efe49cc
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/RecordDeserializer.java
@@ -0,0 +1,55 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.core.edm.xml.v4.AnnotationImpl;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class RecordDeserializer extends AbstractEdmDeserializer<Record> {
+
+ @Override
+ protected Record doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Record record = new Record();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Tyoe".equals(jp.getCurrentName())) {
+ record.setType(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ record.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ } else {
+ record.getPropertyValues().add(jp.readValueAs(PropertyValue.class));
+ }
+ }
+ }
+
+ return record;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRef.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRef.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRef.java
new file mode 100644
index 0000000..ebaea99
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRef.java
@@ -0,0 +1,40 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.ExprConstruct;
+
+@JsonDeserialize(using = UrlRefDeserializer.class)
+public class UrlRef extends DynExprConstructImpl {
+
+ private static final long serialVersionUID = 3755101394647430897L;
+
+ private ExprConstruct value;
+
+ public ExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final ExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
new file mode 100644
index 0000000..f4fab83
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/annotation/UrlRefDeserializer.java
@@ -0,0 +1,52 @@
+/*
+ * 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.client.core.edm.xml.v4.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class UrlRefDeserializer extends AbstractEdmDeserializer<UrlRef> {
+
+ @Override
+ protected UrlRef doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final UrlRef urlref = new UrlRef();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if (isAnnotationConstExprConstruct(jp)) {
+ urlref.setValue(parseAnnotationConstExprConstruct(jp));
+ } else {
+ urlref.setValue(jp.readValueAs( DynExprConstructImpl.class));
+ }
+ }
+ }
+
+ return urlref;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractBasicAuthHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractBasicAuthHttpClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractBasicAuthHttpClientFactory.java
new file mode 100644
index 0000000..806bfb5
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractBasicAuthHttpClientFactory.java
@@ -0,0 +1,51 @@
+/*
+ * 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.client.core.http;
+
+import java.net.URI;
+
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.olingo.client.api.http.HttpMethod;
+
+/**
+ * Base implementation for working with Basic Authentication: needs to be subclassed in order to provide actual username
+ * and password.
+ */
+public abstract class AbstractBasicAuthHttpClientFactory extends DefaultHttpClientFactory {
+
+ private static final long serialVersionUID = 7985626503125490244L;
+
+ protected abstract String getUsername();
+
+ protected abstract String getPassword();
+
+ @Override
+ public HttpClient createHttpClient(final HttpMethod method, final URI uri) {
+ final DefaultHttpClient httpclient = (DefaultHttpClient) super.createHttpClient(method, uri);
+
+ httpclient.getCredentialsProvider().setCredentials(
+ new AuthScope(uri.getHost(), uri.getPort()),
+ new UsernamePasswordCredentials(getUsername(), getPassword()));
+
+ return httpclient;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractNTLMAuthHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractNTLMAuthHttpClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractNTLMAuthHttpClientFactory.java
new file mode 100644
index 0000000..e7c0ca0
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/AbstractNTLMAuthHttpClientFactory.java
@@ -0,0 +1,63 @@
+/*
+ * 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.client.core.http;
+
+import java.net.URI;
+
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.NTCredentials;
+import org.apache.http.client.CredentialsProvider;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.olingo.client.api.http.HttpMethod;
+
+/**
+ * Base implementation for working with NTLM Authentication via embedded HttpClient features: needs to be subclassed in
+ * order to provide all needed login information.
+ * <br/>
+ * External NTLM engine such as <a href="http://jcifs.samba.org/">JCIFS</a> library developed by the
+ * <a href="http://www.samba.org/">Samba</a> project as a part of their Windows interoperability suite of programs.
+ *
+ * @see NTCredentials
+ * @see http://hc.apache.org/httpcomponents-client-ga/ntlm.html#Using_Samba_JCIFS_as_an_alternative_NTLM_engine
+ */
+public abstract class AbstractNTLMAuthHttpClientFactory extends DefaultHttpClientFactory {
+
+ protected abstract String getUsername();
+
+ protected abstract String getPassword();
+
+ protected abstract String getWorkstation();
+
+ protected abstract String getDomain();
+
+ @Override
+ public HttpClient createHttpClient(final HttpMethod method, final URI uri) {
+ final DefaultHttpClient httpclient = (DefaultHttpClient) super.createHttpClient(method, uri);
+
+ final CredentialsProvider credsProvider = new BasicCredentialsProvider();
+ credsProvider.setCredentials(AuthScope.ANY,
+ new NTCredentials(getUsername(), getPassword(), getWorkstation(), getDomain()));
+
+ httpclient.setCredentialsProvider(credsProvider);
+
+ return httpclient;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/http/DefaultHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/DefaultHttpClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/DefaultHttpClientFactory.java
new file mode 100644
index 0000000..30336bb
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/DefaultHttpClientFactory.java
@@ -0,0 +1,40 @@
+/*
+ * 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.client.core.http;
+
+import java.io.Serializable;
+import java.net.URI;
+
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.olingo.client.api.http.HttpClientFactory;
+import org.apache.olingo.client.api.http.HttpMethod;
+
+/**
+ * Default implementation returning HttpClients with default parameters.
+ */
+public class DefaultHttpClientFactory implements HttpClientFactory, Serializable {
+
+ private static final long serialVersionUID = -2461355444507227332L;
+
+ @Override
+ public HttpClient createHttpClient(final HttpMethod method, final URI uri) {
+ return new DefaultHttpClient();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/http/DefaultHttpUriRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/DefaultHttpUriRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/DefaultHttpUriRequestFactory.java
new file mode 100644
index 0000000..aaa17c0
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/DefaultHttpUriRequestFactory.java
@@ -0,0 +1,69 @@
+/*
+ * 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.client.core.http;
+
+import java.net.URI;
+
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.api.http.HttpUriRequestFactory;
+
+/**
+ * Default implementation returning default HttpUriRequest implementations.
+ */
+public class DefaultHttpUriRequestFactory implements HttpUriRequestFactory {
+
+ @Override
+ public HttpUriRequest createHttpUriRequest(final HttpMethod method, final URI uri) {
+ HttpUriRequest result;
+
+ switch (method) {
+ case POST:
+ result = new HttpPost(uri);
+ break;
+
+ case PUT:
+ result = new HttpPut(uri);
+ break;
+
+ case PATCH:
+ result = new HttpPatch(uri);
+ break;
+
+ case MERGE:
+ result = new HttpMerge(uri);
+ break;
+
+ case DELETE:
+ result = new HttpDelete(uri);
+ break;
+
+ case GET:
+ default:
+ result = new HttpGet(uri);
+ break;
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/http/HttpMerge.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/HttpMerge.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/HttpMerge.java
new file mode 100644
index 0000000..3dead87
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/HttpMerge.java
@@ -0,0 +1,70 @@
+/*
+ * 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.client.core.http;
+
+import java.net.URI;
+import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+
+/**
+ * Class identifying MERGE HTTP method.
+ */
+@NotThreadSafe
+public class HttpMerge extends HttpEntityEnclosingRequestBase {
+
+ public final static String METHOD_NAME = "MERGE";
+
+ /**
+ * Constructor.
+ */
+ public HttpMerge() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param uri request URI.
+ */
+ public HttpMerge(final URI uri) {
+ super();
+ setURI(uri);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param uri request URI.
+ * @throws IllegalArgumentException if the uri is invalid.
+ */
+ public HttpMerge(final String uri) {
+ super();
+ setURI(URI.create(uri));
+ }
+
+ /**
+ * Gets HTTP method name.
+ *
+ * @return HTTP method name.
+ */
+ @Override
+ public String getMethod() {
+ return METHOD_NAME;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/http/HttpPatch.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/http/HttpPatch.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/HttpPatch.java
new file mode 100644
index 0000000..9e85cc7
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/http/HttpPatch.java
@@ -0,0 +1,70 @@
+/*
+ * 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.client.core.http;
+
+import java.net.URI;
+import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+
+/**
+ * Class identifying PATCH HTTP method.
+ */
+@NotThreadSafe
+public class HttpPatch extends HttpEntityEnclosingRequestBase {
+
+ public final static String METHOD_NAME = "PATCH";
+
+ /**
+ * Constructor.
+ */
+ public HttpPatch() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param uri request URI.
+ */
+ public HttpPatch(final URI uri) {
+ super();
+ setURI(uri);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param uri request URI.
+ * @throws IllegalArgumentException if the uri is invalid.
+ */
+ public HttpPatch(final String uri) {
+ super();
+ setURI(URI.create(uri));
+ }
+
+ /**
+ * Gets HTTP method name.
+ *
+ * @return HTTP method name.
+ */
+ @Override
+ public String getMethod() {
+ return METHOD_NAME;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java
new file mode 100644
index 0000000..71dcb7c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractEdmDeserializer.java
@@ -0,0 +1,71 @@
+/*
+ * 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.client.core.op.impl;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.edm.xml.v4.ReturnTypeImpl;
+import org.apache.olingo.client.core.edm.xml.v4.annotation.ConstExprConstructImpl;
+
+public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
+
+ protected ODataClient client;
+
+ protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
+ return ConstExprConstructImpl.Type.fromString(jp.getCurrentName()) != null;
+ }
+
+ protected ConstExprConstructImpl parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
+ final ConstExprConstructImpl constExpr = new ConstExprConstructImpl();
+ constExpr.setType(ConstExprConstructImpl.Type.fromString(jp.getCurrentName()));
+ constExpr.setValue(jp.nextTextValue());
+ return constExpr;
+ }
+
+ protected ReturnTypeImpl parseReturnType(final JsonParser jp, final String elementName) throws IOException {
+ ReturnTypeImpl returnType;
+ if (elementName.equals(((FromXmlParser) jp).getStaxReader().getLocalName())) {
+ returnType = new ReturnTypeImpl();
+ returnType.setType(jp.nextTextValue());
+ } else {
+ jp.nextToken();
+ returnType = jp.readValueAs( ReturnTypeImpl.class);
+ }
+ return returnType;
+ }
+
+ protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt)
+ throws IOException, JsonProcessingException;
+
+ @Override
+ public T deserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ client = (ODataClient) ctxt.findInjectableValue(ODataClient.class.getName(), null, null);
+ return doDeserialize(jp, ctxt);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java
new file mode 100644
index 0000000..2c5e0cb
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/AbstractJacksonTool.java
@@ -0,0 +1,85 @@
+/*
+ * 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.client.core.op.impl;
+
+import com.fasterxml.aalto.stax.InputFactoryImpl;
+import com.fasterxml.aalto.stax.OutputFactoryImpl;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.InjectableValues;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.deser.DeserializationProblemHandler;
+import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
+import com.fasterxml.jackson.dataformat.xml.XmlFactory;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+abstract class AbstractJacksonTool {
+
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractJacksonTool.class);
+
+ protected final ODataClient client;
+
+ protected AbstractJacksonTool(final ODataClient client) {
+ this.client = client;
+ }
+
+ protected ObjectMapper getObjectMapper() {
+ final ObjectMapper mapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
+
+ mapper.setInjectableValues(new InjectableValues.Std().addValue(ODataClient.class, client));
+
+ mapper.setSerializerProvider(new InjectableSerializerProvider(mapper.getSerializerProvider(),
+ mapper.getSerializationConfig().withAttribute(ODataClient.class, client),
+ mapper.getSerializerFactory()));
+
+ return mapper;
+ }
+
+ protected XmlMapper getXmlMapper() {
+ final XmlMapper xmlMapper = new XmlMapper(
+ new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule());
+
+ xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(ODataClient.class, client));
+
+ xmlMapper.addHandler(new DeserializationProblemHandler() {
+
+ @Override
+ public boolean handleUnknownProperty(final DeserializationContext ctxt, final JsonParser jp,
+ final JsonDeserializer<?> deserializer, final Object beanOrClass, final String propertyName)
+ throws IOException, JsonProcessingException {
+
+ // skip any unknown property
+ LOG.warn("Skipping unknown property {}", propertyName);
+ ctxt.getParser().skipChildren();
+ return true;
+ }
+ });
+ return xmlMapper;
+ }
+
+}