Repository: olingo-odata4 Updated Branches: refs/heads/OLINGO-564 3c0990910 -> 53b10f6b7
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyPath.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyPath.java deleted file mode 100644 index b74da28..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyPath.java +++ /dev/null @@ -1,27 +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.client.core.edm.xml; - -import org.apache.olingo.commons.api.edm.provider.annotation.PropertyPath; - -class ClientPropertyPath extends AbstractClientElementOrAttributeExpression implements PropertyPath { - - private static final long serialVersionUID = -9133862135834738470L; - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyRef.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyRef.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyRef.java deleted file mode 100644 index 17bdc33..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyRef.java +++ /dev/null @@ -1,54 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef; - -import java.io.IOException; - -@JsonDeserialize(using = ClientPropertyRef.PropertyRefDeserializer.class) -class ClientPropertyRef extends CsdlPropertyRef { - - private static final long serialVersionUID = 1504095609268590326L; - - static class PropertyRefDeserializer extends AbstractClientEdmDeserializer<CsdlPropertyRef> { - @Override - protected CsdlPropertyRef doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - - final CsdlPropertyRef propertyRef = new ClientPropertyRef(); - - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Name".equals(jp.getCurrentName())) { - propertyRef.setName(jp.nextTextValue()); - } else if ("Alias".equals(jp.getCurrentName())) { - propertyRef.setAlias(jp.nextTextValue()); - } - } - } - return propertyRef; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyValue.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyValue.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyValue.java deleted file mode 100644 index 9b9aa8e..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyValue.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientPropertyValue.PropertyValueDeserializer.class) -class ClientPropertyValue extends AbstractClientAnnotatableDynamicAnnotationExpression implements PropertyValue { - - private static final long serialVersionUID = -8437649215282645228L; - - private String property; - - private AnnotationExpression value; - - @Override - public String getProperty() { - return property; - } - - public void setProperty(final String property) { - this.property = property; - } - - @Override - public AnnotationExpression getValue() { - return value; - } - - public void setValue(final AnnotationExpression value) { - this.value = value; - } - - static class PropertyValueDeserializer extends AbstractClientEdmDeserializer<ClientPropertyValue> { - @Override - protected ClientPropertyValue doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientPropertyValue propValue = new ClientPropertyValue(); - 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.getAnnotations().add(jp.readValueAs(ClientAnnotation.class)); - } else if (isAnnotationConstExprConstruct(jp)) { - propValue.setValue(parseAnnotationConstExprConstruct(jp)); - } else { - propValue.setValue(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class)); - } - } - } - return propValue; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientRecord.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientRecord.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientRecord.java deleted file mode 100644 index 264adae..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientRecord.java +++ /dev/null @@ -1,76 +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.client.core.edm.xml; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue; -import org.apache.olingo.commons.api.edm.provider.annotation.Record; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -@JsonDeserialize(using = ClientRecord.RecordDeserializer.class) -class ClientRecord extends AbstractClientAnnotatableDynamicAnnotationExpression implements Record { - - private static final long serialVersionUID = 4275271751615410709L; - - private String type; - - private final List<PropertyValue> propertyValues = new ArrayList<PropertyValue>(); - - @Override - public String getType() { - return type; - } - - public void setType(final String type) { - this.type = type; - } - - @Override - public List<PropertyValue> getPropertyValues() { - return propertyValues; - } - - static class RecordDeserializer extends AbstractClientEdmDeserializer<ClientRecord> { - @Override - protected ClientRecord doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientRecord record = new ClientRecord(); - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Type".equals(jp.getCurrentName())) { - record.setType(jp.nextTextValue()); - } else if ("Annotation".equals(jp.getCurrentName())) { - record.getAnnotations().add(jp.readValueAs(ClientAnnotation.class)); - } else { - record.getPropertyValues().add(jp.readValueAs(ClientPropertyValue.class)); - } - } - } - return record; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReference.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReference.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReference.java deleted file mode 100644 index 36b43d6..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReference.java +++ /dev/null @@ -1,98 +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.client.core.edm.xml; - -import java.io.IOException; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.client.api.edm.xml.Include; -import org.apache.olingo.client.api.edm.xml.IncludeAnnotations; -import org.apache.olingo.client.api.edm.xml.Reference; -import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmItem; -import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -@JsonDeserialize(using = ClientReference.ReferenceDeserializer.class) -class ClientReference extends CsdlAbstractEdmItem implements Reference { - - private static final long serialVersionUID = 7720274712545267654L; - - private URI uri; - private final List<Include> includes = new ArrayList<Include>(); - private final List<IncludeAnnotations> includeAnnotations = new ArrayList<IncludeAnnotations>(); - private final List<CsdlAnnotation> annotations = new ArrayList<CsdlAnnotation>(); - - @Override - public List<CsdlAnnotation> getAnnotations() { - return annotations; - } - - @Override - public URI getUri() { - return uri; - } - - public void setUri(final URI uri) { - this.uri = uri; - } - - @Override - public List<Include> getIncludes() { - return includes; - } - - @Override - public List<IncludeAnnotations> getIncludeAnnotations() { - return includeAnnotations; - } - - static class ReferenceDeserializer extends AbstractClientEdmDeserializer<ClientReference> { - @Override - protected ClientReference doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientReference reference = new ClientReference(); - - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Uri".equals(jp.getCurrentName())) { - reference.setUri(URI.create(jp.nextTextValue())); - } else if ("Include".equals(jp.getCurrentName())) { - jp.nextToken(); - reference.getIncludes().add(jp.readValueAs( ClientInclude.class)); - } else if ("IncludeAnnotations".equals(jp.getCurrentName())) { - jp.nextToken(); - reference.getIncludeAnnotations().add(jp.readValueAs( ClientIncludeAnnotations.class)); - } else if ("Annotation".equals(jp.getCurrentName())) { - jp.nextToken(); - reference.getAnnotations().add(jp.readValueAs( ClientAnnotation.class)); - } - } - } - - return reference; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReferentialConstraint.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReferentialConstraint.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReferentialConstraint.java deleted file mode 100644 index e613563..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReferentialConstraint.java +++ /dev/null @@ -1,54 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.apache.olingo.commons.api.edm.provider.CsdlReferentialConstraint; - -import java.io.IOException; - -@JsonDeserialize(using = ClientReferentialConstraint.ReferentialConstraintDeserializer.class) -class ClientReferentialConstraint extends CsdlReferentialConstraint { - - private static final long serialVersionUID = -5822115908069878139L; - - static class ReferentialConstraintDeserializer extends AbstractClientEdmDeserializer<CsdlReferentialConstraint> { - @Override - protected CsdlReferentialConstraint doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - - final CsdlReferentialConstraint refConst = new ClientReferentialConstraint(); - - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Property".equals(jp.getCurrentName())) { - refConst.setProperty(jp.nextTextValue()); - } else if ("ReferencedProperty".equals(jp.getCurrentName())) { - refConst.setReferencedProperty(jp.nextTextValue()); - } - } - } - return refConst; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReturnType.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReturnType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReturnType.java deleted file mode 100644 index 72db23f..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReturnType.java +++ /dev/null @@ -1,78 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.olingo.commons.api.edm.geo.SRID; -import org.apache.olingo.commons.api.edm.provider.CsdlReturnType; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientReturnType.ReturnTypeDeserializer.class) -class ClientReturnType extends CsdlReturnType { - - private static final long serialVersionUID = 6261092793901735110L; - - static class ReturnTypeDeserializer extends AbstractClientEdmDeserializer<ClientReturnType> { - @Override - protected ClientReturnType doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientReturnType returnType = new ClientReturnType(); - - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Type".equals(jp.getCurrentName())) { - String metadataTypeName = jp.nextTextValue(); - if (metadataTypeName.startsWith("Collection(")) { - returnType.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1, - metadataTypeName.length() - 1)); - returnType.setCollection(true); - } else { - returnType.setType(metadataTypeName); - returnType.setCollection(false); - } - } else if ("Nullable".equals(jp.getCurrentName())) { - returnType.setNullable(BooleanUtils.toBoolean(jp.nextTextValue())); - } else if ("MaxLength".equals(jp.getCurrentName())) { - final String maxLenght = jp.nextTextValue(); - returnType.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght)); - } else if ("Precision".equals(jp.getCurrentName())) { - returnType.setPrecision(Integer.valueOf(jp.nextTextValue())); - } else if ("Scale".equals(jp.getCurrentName())) { - final String scale = jp.nextTextValue(); - returnType.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale)); - } else if ("SRID".equals(jp.getCurrentName())) { - final String srid = jp.nextTextValue(); - if (srid != null) { - returnType.setSrid(SRID.valueOf(srid)); - } - } - } - } - - return returnType; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSchema.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSchema.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSchema.java deleted file mode 100644 index a4a0dd7..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSchema.java +++ /dev/null @@ -1,86 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.CsdlSchema; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientSchema.SchemaDeserializer.class) -class ClientSchema extends CsdlSchema { - - private static final long serialVersionUID = 1911087363912024939L; - - static class SchemaDeserializer extends AbstractClientEdmDeserializer<ClientSchema> { - @Override - protected ClientSchema doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientSchema schema = new ClientSchema(); - - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Namespace".equals(jp.getCurrentName())) { - schema.setNamespace(jp.nextTextValue()); - } else if ("Alias".equals(jp.getCurrentName())) { - schema.setAlias(jp.nextTextValue()); - } else if ("ComplexType".equals(jp.getCurrentName())) { - jp.nextToken(); - schema.getComplexTypes().add(jp.readValueAs(ClientComplexType.class)); - } else if ("EntityType".equals(jp.getCurrentName())) { - jp.nextToken(); - schema.getEntityTypes().add(jp.readValueAs(ClientEntityType.class)); - } else if ("EnumType".equals(jp.getCurrentName())) { - jp.nextToken(); - schema.getEnumTypes().add(jp.readValueAs(ClientEnumType.class)); - } else if ("EntityContainer".equals(jp.getCurrentName())) { - jp.nextToken(); - ClientEntityContainer entityContainer = jp.readValueAs(ClientEntityContainer.class); - schema.setEntityContainer(entityContainer); - } else if ("Action".equals(jp.getCurrentName())) { - jp.nextToken(); - schema.getActions().add(jp.readValueAs(ClientAction.class)); - } else if ("Function".equals(jp.getCurrentName())) { - jp.nextToken(); - schema.getFunctions().add(jp.readValueAs(ClientFunction.class)); - } else if ("TypeDefinition".equals(jp.getCurrentName())) { - jp.nextToken(); - schema.getTypeDefinitions().add(jp.readValueAs(ClientTypeDefinition.class)); - } - } else if ("Annotations".equals(jp.getCurrentName())) { - jp.nextToken(); - schema.getAnnotationGroups().add(jp.readValueAs(ClientAnnotations.class)); - } else if ("Annotation".equals(jp.getCurrentName())) { - jp.nextToken(); - schema.getAnnotations().add(jp.readValueAs(ClientAnnotation.class)); - } else if ("Term".equals(jp.getCurrentName())) { - jp.nextToken(); - schema.getTerms().add(jp.readValueAs(ClientTerm.class)); - } - } - - return schema; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSingleton.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSingleton.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSingleton.java deleted file mode 100644 index a06d6e8..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSingleton.java +++ /dev/null @@ -1,62 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.CsdlSingleton; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientSingleton.SingletonDeserializer.class) -class ClientSingleton extends CsdlSingleton { - - private static final long serialVersionUID = 1656749615107151921L; - - static class SingletonDeserializer extends AbstractClientEdmDeserializer<ClientSingleton> { - @Override - protected ClientSingleton doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientSingleton singleton = new ClientSingleton(); - - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Name".equals(jp.getCurrentName())) { - singleton.setName(jp.nextTextValue()); - } else if ("Type".equals(jp.getCurrentName())) { - singleton.setType(jp.nextTextValue()); - } else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) { - jp.nextToken(); - singleton.getNavigationPropertyBindings().add( - jp.readValueAs(ClientNavigationPropertyBinding.class)); - } else if ("Annotation".equals(jp.getCurrentName())) { - jp.nextToken(); - singleton.getAnnotations().add(jp.readValueAs(ClientAnnotation.class)); - } - } - } - - return singleton; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTerm.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTerm.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTerm.java deleted file mode 100644 index f0904dd..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTerm.java +++ /dev/null @@ -1,83 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.olingo.commons.api.edm.geo.SRID; -import org.apache.olingo.commons.api.edm.provider.CsdlTerm; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; -import java.util.Arrays; - -@JsonDeserialize(using = ClientTerm.TermDeserializer.class) -class ClientTerm extends CsdlTerm { - - private static final long serialVersionUID = -8350072064720586186L; - - static class TermDeserializer extends AbstractClientEdmDeserializer<ClientTerm> { - @Override - protected ClientTerm doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientTerm term = new ClientTerm(); - - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Name".equals(jp.getCurrentName())) { - term.setName(jp.nextTextValue()); - } else if ("Type".equals(jp.getCurrentName())) { - term.setType(jp.nextTextValue()); - } else if ("BaseTerm".equals(jp.getCurrentName())) { - term.setBaseTerm(jp.nextTextValue()); - } else if ("DefaultValue".equals(jp.getCurrentName())) { - term.setDefaultValue(jp.nextTextValue()); - } else if ("Nullable".equals(jp.getCurrentName())) { - term.setNullable(BooleanUtils.toBoolean(jp.nextTextValue())); - } else if ("MaxLength".equals(jp.getCurrentName())) { - final String maxLenght = jp.nextTextValue(); - term.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght)); - } else if ("Precision".equals(jp.getCurrentName())) { - term.setPrecision(Integer.valueOf(jp.nextTextValue())); - } else if ("Scale".equals(jp.getCurrentName())) { - final String scale = jp.nextTextValue(); - term.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale)); - } else if ("SRID".equals(jp.getCurrentName())) { - final String srid = jp.nextTextValue(); - if (srid != null) { - term.setSrid(SRID.valueOf(srid)); - } - } else if ("AppliesTo".equals(jp.getCurrentName())) { - term.getAppliesTo().addAll(Arrays.asList(StringUtils.split(jp.nextTextValue()))); - } else if ("Annotation".equals(jp.getCurrentName())) { - jp.nextToken(); - term.getAnnotations().add(jp.readValueAs(ClientAnnotation.class)); - } - } - } - - return term; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTwoParamsOpDynamicAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTwoParamsOpDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTwoParamsOpDynamicAnnotationExpression.java deleted file mode 100644 index 8ce3167..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTwoParamsOpDynamicAnnotationExpression.java +++ /dev/null @@ -1,62 +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.client.core.edm.xml; - -import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression; - -class ClientTwoParamsOpDynamicAnnotationExpression - extends AbstractClientDynamicAnnotationExpression implements TwoParamsOpDynamicAnnotationExpression { - - private static final long serialVersionUID = 6241842185452451946L; - - private Type type; - - private DynamicAnnotationExpression left; - - private DynamicAnnotationExpression right; - - @Override - public Type getType() { - return type; - } - - public void setType(final Type type) { - this.type = type; - } - - @Override - public DynamicAnnotationExpression getLeftExpression() { - return left; - } - - public void setLeftExpression(final DynamicAnnotationExpression left) { - this.left = left; - } - - @Override - public DynamicAnnotationExpression getRightExpression() { - return right; - } - - public void setRightExpression(final DynamicAnnotationExpression right) { - this.right = right; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTypeDefinition.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTypeDefinition.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTypeDefinition.java deleted file mode 100644 index fd79ec4..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTypeDefinition.java +++ /dev/null @@ -1,74 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.olingo.commons.api.edm.geo.SRID; -import org.apache.olingo.commons.api.edm.provider.CsdlTypeDefinition; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientTypeDefinition.TypeDefinitionDeserializer.class) -class ClientTypeDefinition extends CsdlTypeDefinition { - - private static final long serialVersionUID = -902407149079419602L; - - static class TypeDefinitionDeserializer extends AbstractClientEdmDeserializer<ClientTypeDefinition> { - @Override - protected ClientTypeDefinition doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientTypeDefinition typeDefinition = new ClientTypeDefinition(); - - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Name".equals(jp.getCurrentName())) { - typeDefinition.setName(jp.nextTextValue()); - } else if ("UnderlyingType".equals(jp.getCurrentName())) { - typeDefinition.setUnderlyingType(jp.nextTextValue()); - } else if ("MaxLength".equals(jp.getCurrentName())) { - typeDefinition.setMaxLength(jp.nextIntValue(0)); - } else if ("Unicode".equals(jp.getCurrentName())) { - typeDefinition.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue())); - } else if ("Precision".equals(jp.getCurrentName())) { - typeDefinition.setPrecision(jp.nextIntValue(0)); - } else if ("Scale".equals(jp.getCurrentName())) { - final String scale = jp.nextTextValue(); - typeDefinition.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale)); - } else if ("SRID".equals(jp.getCurrentName())) { - final String srid = jp.nextTextValue(); - if (srid != null) { - typeDefinition.setSrid(SRID.valueOf(srid)); - } - } else if ("Annotation".equals(jp.getCurrentName())) { - jp.nextToken(); - typeDefinition.getAnnotations().add(jp.readValueAs(ClientAnnotation.class)); - } - } - } - - return typeDefinition; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientUrlRef.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientUrlRef.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientUrlRef.java deleted file mode 100644 index 053a52e..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientUrlRef.java +++ /dev/null @@ -1,65 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientUrlRef.UrlRefDeserializer.class) -class ClientUrlRef extends AbstractClientDynamicAnnotationExpression implements UrlRef { - - private static final long serialVersionUID = -7693224811739000440L; - - private AnnotationExpression value; - - @Override - public AnnotationExpression getValue() { - return value; - } - - public void setValue(final AnnotationExpression value) { - this.value = value; - } - - static class UrlRefDeserializer extends AbstractClientEdmDeserializer<ClientUrlRef> { - @Override - protected ClientUrlRef doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientUrlRef urlref = new ClientUrlRef(); - 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(AbstractClientDynamicAnnotationExpression.class)); - } - } - } - return urlref; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java index 55a02d4..a668aaf 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java @@ -28,8 +28,8 @@ import org.apache.olingo.client.api.edm.xml.XMLMetadata; import org.apache.olingo.client.api.serialization.ClientODataDeserializer; import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer; import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer; -import org.apache.olingo.client.core.edm.xml.ClientEdmx; -import org.apache.olingo.client.core.edm.ClientXMLMetadata; +import org.apache.olingo.client.core.edm.xml.ClientCsdlEdmx; +import org.apache.olingo.client.core.edm.ClientCsdlXMLMetadata; import org.apache.olingo.commons.api.data.Delta; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; @@ -114,7 +114,7 @@ public class ClientODataDeserializerImpl implements ClientODataDeserializer { @Override public XMLMetadata toMetadata(final InputStream input) { try { - return new ClientXMLMetadata(getXmlMapper().readValue(input, ClientEdmx.class)); + return new ClientCsdlXMLMetadata(getXmlMapper().readValue(input, ClientCsdlEdmx.class)); } catch (Exception e) { throw new IllegalArgumentException("Could not parse as Edmx document", e); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java index c1b4e7c..c0af3af 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java @@ -28,7 +28,7 @@ import org.apache.olingo.client.api.data.ServiceDocument; import org.apache.olingo.client.api.domain.ODataEntitySetIterator; import org.apache.olingo.client.api.edm.xml.XMLMetadata; import org.apache.olingo.client.api.serialization.ODataReader; -import org.apache.olingo.client.core.edm.ClientEdmProvider; +import org.apache.olingo.client.core.edm.ClientCsdlEdmProvider; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; @@ -68,7 +68,7 @@ public class ODataReaderImpl implements ODataReader { @Override public Edm readMetadata(final Map<String, CsdlSchema> xmlSchemas) { - ClientEdmProvider prov = new ClientEdmProvider(xmlSchemas); + ClientCsdlEdmProvider prov = new ClientCsdlEdmProvider(xmlSchemas); return new EdmProviderImpl(prov); }
