olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From archana...@apache.org
Subject [22/24] olingo-odata2 git commit: [OLINGO-1253]Client Module for Olingo v2
Date Mon, 02 Apr 2018 11:32:03 GMT
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmFunctionImportParameter.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmFunctionImportParameter.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmFunctionImportParameter.java
new file mode 100644
index 0000000..7a0ca1f
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmFunctionImportParameter.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmFacets;
+import org.apache.olingo.odata2.api.edm.EdmMapping;
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
+import org.apache.olingo.odata2.client.api.edm.EdmDocumentation;
+
+/**
+ * Objects of this class represent function import parameters
+ * 
+ */
+public class EdmFunctionImportParameter {
+
+  private String name;
+  private String mode;
+  private EdmSimpleTypeKind type;
+  private EdmFacets facets;
+  private EdmMapping mapping;
+  private EdmDocumentation documentation;
+  private EdmAnnotations annotations;
+
+  /**
+   * @return <b>String</b> name of the parameter
+   */
+  public String getName() {
+    return name;
+  }
+
+  /**
+   * @return {@link EdmSimpleTypeKind} of this parameter
+   */
+  public EdmSimpleTypeKind getType() {
+    return type;
+  }
+
+  /**
+   * @return {@link EdmFacets} of this parameter
+   */
+  public EdmFacets getFacets() {
+    return facets;
+  }
+
+  /**
+   * @return {@link EdmMappingImpl} of this parameter
+   */
+  public EdmMapping getMapping() {
+    return mapping;
+  }
+
+  /**
+   * Sets the name of this {@link EdmFunctionImportParameter}
+   * @param name
+   * @return {@link EdmFunctionImportParameter} for method chaining
+   */
+  public EdmFunctionImportParameter setName(final String name) {
+    this.name = name;
+    return this;
+  }
+
+  /**
+   * Sets the mode of this {@link EdmFunctionImportParameter}
+   * @param mode
+   * @return {@link EdmFunctionImportParameter} for method chaining
+   */
+  public EdmFunctionImportParameter setMode(final String mode) {
+    this.mode = mode;
+    return this;
+  }
+
+  /**
+   * Sets the {@link EdmSimpleTypeKind} of this {@link EdmFunctionImportParameter}
+   * @param type
+   * @return {@link EdmFunctionImportParameter} for method chaining
+   */
+  public EdmFunctionImportParameter setType(final EdmSimpleTypeKind type) {
+    this.type = type;
+    return this;
+  }
+
+  /**
+   * Sets the {@link EdmFacets} of this {@link EdmFunctionImportParameter}
+   * @param facets
+   * @return {@link EdmFunctionImportParameter} for method chaining
+   */
+  public EdmFunctionImportParameter setFacets(final EdmFacets facets) {
+    this.facets = facets;
+    return this;
+  }
+
+  /**
+   * Sets the {@link EdmMappingImpl} of this {@link EdmFunctionImportParameter}
+   * @param mapping
+   * @return {@link EdmFunctionImportParameter} for method chaining
+   */
+  public EdmFunctionImportParameter setMapping(final EdmMapping mapping) {
+    this.mapping = mapping;
+    return this;
+  }
+
+  /**
+   * Sets the {@link Documentation} of this {@link EdmFunctionImportParameter}
+   * @param documentation
+   * @return {@link EdmFunctionImportParameter} for method chaining
+   */
+  public EdmFunctionImportParameter setDocumentation(final EdmDocumentation documentation) {
+    this.documentation = documentation;
+    return this;
+  }
+
+  public void setAnnotations(EdmAnnotationsImpl annotations) {
+    this.annotations = annotations;
+  }
+  
+  public EdmAnnotations getAnnotations() {
+    return this.annotations;
+  }  
+  @Override
+  public String toString() {
+      return String.format(name);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmImpl.java
new file mode 100644
index 0000000..3933cb0
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmImpl.java
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.olingo.odata2.api.edm.EdmAssociation;
+import org.apache.olingo.odata2.api.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmServiceMetadata;
+import org.apache.olingo.odata2.api.edm.FullQualifiedName;
+import org.apache.olingo.odata2.client.api.edm.ClientEdm;
+import org.apache.olingo.odata2.client.api.edm.EdmSchema;
+
+/**
+ * Objects of this class represent Edm
+ */
+public class EdmImpl implements ClientEdm {
+
+  protected Map<FullQualifiedName, EdmEntityContainer> edmEntityContainers;
+  protected Map<FullQualifiedName, EdmEntityType> edmEntityTypes;
+  private Map<FullQualifiedName, EdmComplexType> edmComplexTypes;
+  private Map<FullQualifiedName, EdmAssociation> edmAssociations;
+  private Map<String, String> aliasToNamespaceInfo;
+  private List<EdmEntitySet> edmEntitySets;
+  private List<EdmFunctionImport> edmFunctionImports;
+  private List<EdmSchema> edmSchema;
+  private EdmEntityContainer defaultEdmEntityContainer;
+
+  public EdmImpl() {
+    edmEntityContainers = new HashMap<FullQualifiedName, EdmEntityContainer>();
+    edmEntityTypes = new HashMap<FullQualifiedName, EdmEntityType>();
+    edmComplexTypes = new HashMap<FullQualifiedName, EdmComplexType>();
+    edmAssociations = new HashMap<FullQualifiedName, EdmAssociation>();
+    aliasToNamespaceInfo = new HashMap<String, String>();
+  }
+
+  @Override
+  public EdmEntityContainer getEntityContainer(final String name)
+      throws EdmException {
+    for (Entry<FullQualifiedName, EdmEntityContainer> entry : edmEntityContainers.entrySet()) {
+      if (entry.getKey().getName().equals(name)) {
+        return entry.getValue();
+      }
+    }
+    return null;
+  }
+
+  public EdmImpl setEdmSchemas(List<EdmSchema> edmSchema) {
+    this.edmSchema = edmSchema;
+    return this;
+  }
+
+  @Override
+  public EdmEntityType getEntityType(final String namespaceOrAlias,
+      final String name) throws EdmException {
+    FullQualifiedName fqName = getNamespaceForAlias(namespaceOrAlias, name);
+    return edmEntityTypes.get(fqName);
+  }
+
+  private FullQualifiedName getNamespaceForAlias(final String namespaceOrAlias, String name)
+      throws EdmException {
+    String namespace = aliasToNamespaceInfo.get(namespaceOrAlias);
+    if (namespace != null) {
+      //Namespace to alias mapping found
+      return new FullQualifiedName(namespace, name);
+    } else {
+      //No mapping found. Parameter must be the namespace
+      return new FullQualifiedName(namespaceOrAlias, name);
+    }
+  }
+
+  @Override
+  public EdmComplexType getComplexType(final String namespaceOrAlias,
+      final String name) throws EdmException {
+    FullQualifiedName fqName = getNamespaceForAlias(namespaceOrAlias, name);
+    return edmComplexTypes.get(fqName);
+  }
+
+  @Override
+  public EdmAssociation getAssociation(final String namespaceOrAlias,
+      final String name) throws EdmException {
+    FullQualifiedName fqName = getNamespaceForAlias(namespaceOrAlias, name);
+    return edmAssociations.get(fqName);
+  }
+
+  public EdmImpl setDefaultEntityContainer(EdmEntityContainer defaultEdmEntityContainer) throws EdmException {
+    this.defaultEdmEntityContainer = defaultEdmEntityContainer;
+    return this;
+  }
+
+  @Override
+  public EdmEntityContainer getDefaultEntityContainer() throws EdmException {
+    return defaultEdmEntityContainer;
+  }
+
+  @Override
+  public List<EdmEntitySet> getEntitySets() throws EdmException {
+    return edmEntitySets;
+  }
+
+  @Override
+  public List<EdmFunctionImport> getFunctionImports() throws EdmException {
+    return edmFunctionImports;
+  }
+
+  @Override
+  public EdmServiceMetadata getServiceMetadata() {
+    return null;
+  }
+
+  public Map<FullQualifiedName, EdmEntityContainer> getEdmEntityContainers() {
+    return edmEntityContainers;
+  }
+
+  public EdmImpl setEdmEntityContainers(Map<FullQualifiedName, EdmEntityContainer> edmEntityContainers) {
+    this.edmEntityContainers = edmEntityContainers;
+    return this;
+  }
+
+  public Map<FullQualifiedName, EdmEntityType> getEdmEntityTypes() {
+    return edmEntityTypes;
+  }
+
+  public EdmImpl setEdmEntityTypes(Map<FullQualifiedName, EdmEntityType> edmEntityTypes) {
+    this.edmEntityTypes = edmEntityTypes;
+    return this;
+  }
+
+  public Map<FullQualifiedName, EdmComplexType> getEdmComplexTypes() {
+    return edmComplexTypes;
+  }
+
+  public EdmImpl setEdmComplexTypes(Map<FullQualifiedName, EdmComplexType> edmComplexTypes) {
+    this.edmComplexTypes = edmComplexTypes;
+    return this;
+  }
+
+  public Map<FullQualifiedName, EdmAssociation> getEdmAssociations() {
+    return edmAssociations;
+  }
+
+  public EdmImpl setEdmAssociations(Map<FullQualifiedName, EdmAssociation> edmAssociations) {
+    this.edmAssociations = edmAssociations;
+    return this;
+  }
+
+  public Map<String, String> getAliasToNamespaceInfo() {
+    return aliasToNamespaceInfo;
+  }
+
+  public EdmImpl setAliasToNamespaceInfo(Map<String, String> aliasToNamespaceInfo) {
+    this.aliasToNamespaceInfo = aliasToNamespaceInfo;
+    return this;
+  }
+
+  public List<EdmEntitySet> getEdmEntitySets() {
+    return edmEntitySets;
+  }
+
+  public EdmImpl setEdmEntitySets(List<EdmEntitySet> edmEntitySets) {
+    this.edmEntitySets = edmEntitySets;
+    return this;
+  }
+
+  public List<EdmFunctionImport> getEdmFunctionImports() {
+    return edmFunctionImports;
+  }
+
+  public EdmImpl setEdmFunctionImports(List<EdmFunctionImport> edmFunctionImports) {
+    this.edmFunctionImports = edmFunctionImports;
+    return this;
+  }
+
+  @Override
+  public List<EdmSchema> getSchemas() {
+    return edmSchema;
+  }
+
+  @Override
+  public String toString() {
+    return String.format("EdmImpl");
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmKeyImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmKeyImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmKeyImpl.java
new file mode 100644
index 0000000..6a3ad4b
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmKeyImpl.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotationAttribute;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationElement;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+
+/**
+ * Objects of this class represent a key for an entity type
+ * 
+ */
+public class EdmKeyImpl {
+
+  private List<EdmProperty> keys;
+  private List<EdmAnnotationAttribute> annotationAttributes;
+  private List<EdmAnnotationElement> annotationElements;
+
+  /**
+   * @return List<{@link PropertyRef}> references to the key properties
+   */
+  public List<EdmProperty> getKeys() {
+    return keys;
+  }
+
+  /**
+   * @return List of {@link AnnotationAttribute} annotation attributes
+   */
+  public List<EdmAnnotationAttribute> getAnnotationAttributes() {
+    return annotationAttributes;
+  }
+
+  /**
+   * @return List of {@link AnnotationElement} annotation elements
+   */
+  public List<EdmAnnotationElement> getAnnotationElements() {
+    return annotationElements;
+  }
+
+  /**
+   * Sets the {@link Property}s by their {@link PropertyRef} for this {@link EdmKeyImpl}
+   * @param keys
+   * @return {@link EdmKeyImpl} for method chaining
+   */
+  public EdmKeyImpl setKeys(final List<EdmProperty> keys) {
+    this.keys = keys;
+    return this;
+  }
+
+  /**
+   * Sets the List of {@link AnnotationAttribute} for this {@link EdmKeyImpl}
+   * @param annotationAttributes
+   * @return {@link EdmKeyImpl} for method chaining
+   */
+  public EdmKeyImpl setAnnotationAttributes(final List<EdmAnnotationAttribute> annotationAttributes) {
+    this.annotationAttributes = annotationAttributes;
+    return this;
+  }
+
+  /**
+   * Sets the List of {@link AnnotationElement} for this {@link EdmKeyImpl}
+   * @param annotationElements
+   * @return {@link EdmKeyImpl} for method chaining
+   */
+  public EdmKeyImpl setAnnotationElements(final List<EdmAnnotationElement> annotationElements) {
+    this.annotationElements = annotationElements;
+    return this;
+  }
+  @Override
+  public String toString() {
+    StringBuffer keyValues = new StringBuffer();
+    for(EdmProperty key:keys){
+      try {
+        keyValues.append(key.getName().toString());
+      } catch (EdmException e) {
+        keyValues.append("null");
+      }
+      keyValues.append(",");
+    }
+    return String.format((keyValues.substring(0, keyValues.length()-1)).toString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmMappingImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmMappingImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmMappingImpl.java
new file mode 100644
index 0000000..6d09bb6
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmMappingImpl.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmMapping;
+
+/**
+ * Object of this class represent the mapping of a value to a MIME type.
+ * 
+ */
+public class EdmMappingImpl implements EdmMapping {
+
+  private String value;
+  private Object object;
+  private String mediaResourceSourceKey;
+  private String mediaResourceMimeTypeKey;
+
+  @Override
+  public String getInternalName() {
+    return value;
+  }
+
+  @Override
+  public Object getObject() {
+    return object;
+  }
+
+  @Override
+  public String getMediaResourceSourceKey() {
+    return mediaResourceSourceKey;
+  }
+
+  @Override
+  public String getMediaResourceMimeTypeKey() {
+    return mediaResourceMimeTypeKey;
+  }
+
+  /**
+   * Sets the value for this {@link EdmMappingImpl}.
+   * @param value
+   * @return {@link EdmMappingImpl} for method chaining
+   */
+  public EdmMappingImpl setInternalName(final String value) {
+    this.value = value;
+    return this;
+  }
+
+  /**
+   * Sets an object. This method can be used by a provider to set whatever it wants to associate with this.
+   * @param object
+   * @return {@link EdmMappingImpl} for method chaining
+   */
+  public EdmMappingImpl setObject(final Object object) {
+    this.object = object;
+    return this;
+  }
+
+  /**
+   * Sets the key for the resource source key which is used for the lookup in the data map
+   * @param mediaResourceSourceKey under which the source can be found in the data map
+   * @return {@link EdmMappingImpl} for method chaining
+   */
+  public EdmMappingImpl setMediaResourceSourceKey(final String mediaResourceSourceKey) {
+    this.mediaResourceSourceKey = mediaResourceSourceKey;
+    return this;
+  }
+
+  /**
+   * Sets the key for the resource mime type key which is used for the lookup in the data map
+   * @param mediaResourceMimeTypeKey under which the mime type can be found in the data map
+   * @return {@link EdmMappingImpl} for method chaining
+   */
+  public EdmMappingImpl setMediaResourceMimeTypeKey(final String mediaResourceMimeTypeKey) {
+    this.mediaResourceMimeTypeKey = mediaResourceMimeTypeKey;
+    return this;
+  }
+  
+  @Override
+  public String toString() {
+      return String.format(value);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmNamedImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmNamedImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmNamedImpl.java
new file mode 100644
index 0000000..6d9411c
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmNamedImpl.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmNamed;
+
+/**
+ * See in ABNF
+ * <p>
+ * <code>
+ *   Note:this pattern is overly restrictive, the normative definition is type TSimpleIdentifier in OData EDM XML Schema
+ *   <br/>
+ *   odataIdentifier             = identifierLeadingCharacter *127identifierCharacter
+ *   <br/>
+ *   identifierLeadingCharacter  = ALPHA / "_"         ; plus Unicode characters from the categories L or Nl
+ *   <br/>
+ *   identifierCharacter         = ALPHA / "_" / DIGIT ; plus Unicode characters from the categories L, Nl, Nd, Mn,
+ *   Mc, Pc, or Cf
+ *   <br/>
+ * </code>
+ * </p>
+ * And in OData V2 MC-CSDL (Release v20110610)
+ * <p>
+ * Section 2.2.6 SimpleIdentifier<br/>
+ * SimpleIdentifier is a string-based representation. The maximum length of the identifier MUST be less than 480.
+ * The below pattern represents the allowed identifiers in ECMA specification:
+ * Pattern: <code>value="[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}"</code>
+ * </p>
+ *
+ */
+public abstract class EdmNamedImpl implements EdmNamed {
+  
+  private static final Pattern PATTERN_VALID_NAME = Pattern.compile(
+      "\\A[_\\p{L}\\p{Nl}][_\\p{L}\\p{Nl}\\p{Nd}\\p{Mn}\\p{Mc}\\p{Pc}\\p{Cf}]{0,}\\Z");
+ 
+  protected EdmImpl edm;
+  protected String name;
+
+  public void setEdm(EdmImpl edm) {
+    this.edm = edm;
+  }
+
+  public void setName(String name) throws EdmException  {
+    this.name = getValidatedName(name);
+  }
+
+  @Override
+  public String getName() throws EdmException {
+    return name;
+  }
+  private String getValidatedName(final String name) throws EdmException {
+    Matcher matcher = PATTERN_VALID_NAME.matcher(name);
+    if (matcher.matches()) {
+      return name;
+    }
+    throw new EdmException(EdmException.NAMINGERROR.addContent(name));
+  }
+  @Override
+  public String toString() {
+      return String.format(name);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmNavigationPropertyImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmNavigationPropertyImpl.java
new file mode 100644
index 0000000..11aa7e9
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmNavigationPropertyImpl.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmAssociation;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmMapping;
+import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.edm.FullQualifiedName;
+import org.apache.olingo.odata2.api.edm.provider.Mapping;
+import org.apache.olingo.odata2.client.api.edm.EdmDocumentation;
+
+/**
+ * Objects of this class represent EdmNavigationProperty
+ *
+ */
+public class EdmNavigationPropertyImpl extends EdmTypedImpl implements EdmNavigationProperty, EdmAnnotatable {
+
+  private EdmAnnotations annotations;
+  private FullQualifiedName relationship;
+  private String fromRole;
+  private String toRole;
+  private EdmDocumentation documentation;
+  private Mapping mapping;
+
+  public EdmDocumentation getDocumentation() {
+    return documentation;
+  }
+
+  public void setDocumentation(EdmDocumentation documentation) {
+    this.documentation = documentation;
+  }
+
+  public void setMapping(Mapping mapping) {
+    this.mapping = mapping;
+  }
+
+
+  public void setAnnotations(EdmAnnotations annotations) {
+    this.annotations = annotations;
+  }
+
+  public void setFromRole(String fromRole) {
+    this.fromRole = fromRole;
+  }
+
+  public void setToRole(String toRole) {
+    this.toRole = toRole;
+  }
+
+  @Override
+  public EdmType getType() throws EdmException {
+    return edmType;
+  }
+
+  @Override
+  public EdmMultiplicity getMultiplicity() throws EdmException {
+    return multiplicity;
+  }
+
+  @Override
+  public EdmAssociation getRelationship() throws EdmException {
+    return edm.getAssociation(relationship.getNamespace(), relationship.getName());
+  }
+  
+  public FullQualifiedName getRelationshipName() throws EdmException {
+    return relationship;
+  }
+  
+  public void setRelationshipName( FullQualifiedName relationship){
+    this.relationship = relationship;
+  }
+
+  @Override
+  public String getFromRole() throws EdmException {
+    return fromRole;
+  }
+
+  @Override
+  public String getToRole() throws EdmException {
+    return toRole;
+  }
+
+  @Override
+  public EdmAnnotations getAnnotations() throws EdmException {
+    return annotations;
+  }
+
+  @Override
+  public EdmMapping getMapping() throws EdmException {
+    return mapping;
+  }
+  
+  @Override
+  public String toString() {
+      return String.format(name);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmOnDeleteImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmOnDeleteImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmOnDeleteImpl.java
new file mode 100644
index 0000000..3f0fc01
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmOnDeleteImpl.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmAction;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationAttribute;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationElement;
+import org.apache.olingo.odata2.client.api.edm.EdmDocumentation;
+import org.apache.olingo.odata2.client.core.edm.EdmOnDelete;
+
+/**
+ * Objects of this class represent an OnDelete Action
+ * 
+ */
+public class EdmOnDeleteImpl implements EdmOnDelete{
+
+  private EdmAction action;
+  private EdmDocumentation documentation;
+  private List<EdmAnnotationAttribute> annotationAttributes;
+  private List<EdmAnnotationElement> annotationElements;
+
+  /**
+   * @return {@link EdmAction} action
+   */
+  public EdmAction getAction() {
+    return action;
+  }
+
+  /**
+   * @return {@link Documentation} documentation
+   */
+  public EdmDocumentation getDocumentation() {
+    return documentation;
+  }
+
+  /**
+   * @return List of {@link AnnotationAttribute} annotation attributes
+   */
+  public List<EdmAnnotationAttribute> getAnnotationAttributes() {
+    return annotationAttributes;
+  }
+
+  /**
+   * @return List of {@link AnnotationElement} annotation elements
+   */
+  public List<EdmAnnotationElement> getAnnotationElements() {
+    return annotationElements;
+  }
+
+  /**
+   * Sets the {@link EdmAction} for this {@link EdmOnDeleteImpl}
+   * @param action
+   * @return {@link EdmOnDeleteImpl} for method chaining
+   */
+  public EdmOnDeleteImpl setAction(final EdmAction action) {
+    this.action = action;
+    return this;
+  }
+
+  /**
+   * Sets the {@link Documentation} for this {@link EdmOnDeleteImpl}
+   * @param documentation
+   * @return {@link EdmOnDeleteImpl} for method chaining
+   */
+  public EdmOnDeleteImpl setDocumentation(final EdmDocumentation documentation) {
+    this.documentation = documentation;
+    return this;
+  }
+
+  /**
+   * Sets the List of {@link AnnotationAttribute} for this {@link EdmOnDeleteImpl}
+   * @param annotationAttributes
+   * @return {@link EdmOnDeleteImpl} for method chaining
+   */
+  public EdmOnDeleteImpl setAnnotationAttributes(final List<EdmAnnotationAttribute> annotationAttributes) {
+    this.annotationAttributes = annotationAttributes;
+    return this;
+  }
+
+  /**
+   * Sets the List of {@link AnnotationElement} for this {@link EdmOnDeleteImpl}
+   * @param annotationElements
+   * @return {@link EdmOnDeleteImpl} for method chaining
+   */
+  public EdmOnDeleteImpl setAnnotationElements(final List<EdmAnnotationElement> annotationElements) {
+    this.annotationElements = annotationElements;
+    return this;
+  }
+  
+  @Override
+  public String toString() {
+      return String.format(action.name());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmParameterImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmParameterImpl.java
new file mode 100644
index 0000000..239c99d
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmParameterImpl.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.odata2.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmParameter;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.core.edm.EdmSimpleTypeFacadeImpl;
+
+/**
+ *  Objects of this class represent EdmParameter
+ */
+public class EdmParameterImpl extends EdmElementImpl implements EdmParameter, EdmAnnotatable {
+
+  private EdmFunctionImportParameter parameter;
+  private EdmAnnotations annotations;
+
+  
+  @Override
+  public EdmType getType() throws EdmException {
+    if (edmType == null) {
+      edmType = EdmSimpleTypeFacadeImpl.getEdmSimpleType(parameter.getType());
+      if (edmType == null) {
+        throw new EdmException(EdmException.TYPEPROBLEM);
+      }
+    }
+    return edmType;
+  }
+
+  /**
+   * @param parameter the parameter to set
+   */
+  public void setParameter(EdmFunctionImportParameter parameter) {
+    this.parameter = parameter;
+  }
+
+  @Override
+  public EdmAnnotations getAnnotations() throws EdmException {
+    return annotations;
+  }
+
+  /**
+   * @param annotations the annotations to set
+   */
+  public void setAnnotations(EdmAnnotations annotations) {
+    this.annotations = annotations;
+  }
+  
+  @Override
+  public String toString() {
+      return String.format(name);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmPropertyImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmPropertyImpl.java
new file mode 100644
index 0000000..91c0b00
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmPropertyImpl.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmCustomizableFeedMappings;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmFacets;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.edm.provider.Mapping;
+import org.apache.olingo.odata2.client.api.edm.EdmDocumentation;
+
+/**
+ * Objects of this class represent EdmProperty
+ *
+ */
+public abstract class EdmPropertyImpl extends EdmElementImpl implements EdmProperty, EdmAnnotatable {
+
+  private EdmFacets facets;
+  private EdmCustomizableFeedMappings customizableFeedMappings;
+  private String mimeType;
+  private Mapping mapping;
+  private EdmDocumentation documentation;
+  private EdmAnnotations annotations;
+
+  public EdmFacets getFacets() {
+    return facets;
+  }
+
+  @Override
+  public void setFacets(EdmFacets facets) {
+    this.facets = facets;
+  }
+  
+  public void setMapping(Mapping mapping) {
+    this.mapping = mapping;
+  }
+
+  public void setDocumentation(EdmDocumentation documentation) {
+    this.documentation = documentation;
+  }
+
+  public void setCustomizableFeedMappings(EdmCustomizableFeedMappings customizableFeedMappings) {
+    this.customizableFeedMappings = customizableFeedMappings;
+  }
+
+  public void setMimeType(String mimeType) {
+    this.mimeType = mimeType;
+  }
+
+  @Override
+  public EdmCustomizableFeedMappings getCustomizableFeedMappings() throws EdmException {
+    return customizableFeedMappings;
+  }
+
+
+  public void setAnnotations(EdmAnnotations annotations) {
+    this.annotations = annotations;
+  }
+
+  @Override
+  public String getMimeType() throws EdmException {
+    return mimeType;
+  }
+
+  @Override
+  public EdmAnnotations getAnnotations() throws EdmException {
+    return annotations;
+  }
+  @Override
+  public String toString() {
+      return String.format(name);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmPropertyRefImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmPropertyRefImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmPropertyRefImpl.java
new file mode 100644
index 0000000..864e979
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmPropertyRefImpl.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+
+/**
+ * Objects of this class represent a reference to a property via its name
+ * 
+ * 
+ */
+public class EdmPropertyRefImpl extends EdmPropertyImpl {
+
+  protected boolean isSimple;
+
+  /**
+   * @return <b>String</b> name of the {@link Property} this {@link EdmPropertyRefImpl} is referencing to
+   */
+
+  public void setIsSimple(boolean isSimple) {
+    this.isSimple = isSimple;
+  }
+
+  @Override
+  public boolean isSimple() {
+    return isSimple;
+  }
+  @Override
+  public String toString() {
+      return String.format(name);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmReferentialConstraintImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmReferentialConstraintImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmReferentialConstraintImpl.java
new file mode 100644
index 0000000..131beaf
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmReferentialConstraintImpl.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmReferentialConstraint;
+import org.apache.olingo.odata2.api.edm.EdmReferentialConstraintRole;
+
+/**
+ * Objects of this class represent EdmReferentialConstraint
+ *
+ */
+public class EdmReferentialConstraintImpl implements EdmReferentialConstraint, EdmAnnotatable {
+  private EdmAnnotations annotations;
+  private EdmReferentialConstraintRole referentialConstraintDependentRole;
+  private EdmReferentialConstraintRole referentialConstraintPrincipalRole;
+
+
+  @Override
+  public EdmReferentialConstraintRole getPrincipal() throws EdmException {
+    return referentialConstraintPrincipalRole;
+  }
+
+  @Override
+  public EdmReferentialConstraintRole getDependent() throws EdmException {
+    return referentialConstraintDependentRole;
+  }
+
+  @Override
+  public EdmAnnotations getAnnotations() throws EdmException {
+    return annotations;
+  }
+
+
+  public void setPrincipal(EdmReferentialConstraintRole referentialConstraintPrincipalRole) {
+    this.referentialConstraintPrincipalRole = referentialConstraintPrincipalRole;
+    
+  }
+
+  public void setDependent(EdmReferentialConstraintRole referentialConstraintDependentRole) {
+    this.referentialConstraintDependentRole = referentialConstraintDependentRole;
+    
+  }
+
+  public void setAnnotations(EdmAnnotations annotations) {
+    this.annotations = annotations;
+    
+  }
+  @Override
+  public String toString() {
+      return String.format("Dependent Role: " + referentialConstraintDependentRole.getRole() + 
+          "PrincipalRole: "+ referentialConstraintPrincipalRole);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmReferentialConstraintRoleImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmReferentialConstraintRoleImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmReferentialConstraintRoleImpl.java
new file mode 100644
index 0000000..d370e43
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmReferentialConstraintRoleImpl.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmReferentialConstraintRole;
+
+/**
+ * Objects of this class represent EdmReferentialConstraintRole
+ *
+ */
+public class EdmReferentialConstraintRoleImpl implements EdmReferentialConstraintRole, EdmAnnotatable {
+  protected List<String> refNames;
+  private EdmReferentialConstraintRole role;
+  private EdmAnnotations annotations;
+  private String roleName;
+  private List<EdmPropertyImpl> property;
+
+
+  public List<String> getRefNames() {
+    return refNames;
+  }
+
+  public void setRefNames(List<String> refNames) {
+    this.refNames = refNames;
+  }
+
+  public String getRoleName() {
+    return roleName;
+  }
+
+  @Override
+  public String getRole() {
+    return roleName;
+  }
+
+  /**
+   * @return the propertyRefs
+   */
+  public List<EdmPropertyImpl> getProperty() {
+    return property;
+  }
+
+  @Override
+  public List<String> getPropertyRefNames() {
+    return refNames;
+  }
+
+  @Override
+  public EdmAnnotations getAnnotations() throws EdmException {
+    return annotations;
+  }
+
+  /**
+   * @param role the role to set
+   */
+  public void setRole(EdmReferentialConstraintRole role) {
+    this.role = role;
+  }
+
+  public void setRoleName(String roleName) {
+    this.roleName = roleName;
+    
+  }
+
+  public void setProperty(List<EdmPropertyImpl> property) {
+    this.property = property;
+    
+  }
+
+  public void setAnnotations(EdmAnnotations annotations) {
+   this.annotations = annotations;
+    
+  }  @Override
+  public String toString() {
+    return String.format(role.getRole());
+}
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmSchemaImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmSchemaImpl.java
new file mode 100644
index 0000000..68ec632
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmSchemaImpl.java
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import java.util.List;
+import org.apache.olingo.odata2.client.api.edm.EdmSchema;
+import org.apache.olingo.odata2.client.api.edm.EdmUsing;
+import org.apache.olingo.odata2.api.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmAssociation;
+import org.apache.olingo.odata2.api.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationAttribute;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationElement;
+
+/**
+ * Objects of this class represent a schema
+ * 
+ */
+public class EdmSchemaImpl implements EdmSchema{
+
+  private String namespace;
+  private String alias;
+  private List<EdmUsing > usings;
+  private List<EdmEntityType> entityTypes;
+  private List<EdmComplexType> complexTypes;
+  private List<EdmAssociation> associations;
+  private List<EdmEntityContainer> entityContainers;
+  private List<EdmAnnotationAttribute> annotationAttributes;
+  private List<EdmAnnotationElement> annotationElements;
+
+  /**
+   * Sets the namespace for this {@link EdmSchemaImpl}
+   * @param namespace
+   * @return {@link EdmSchemaImpl} for method chaining
+   */
+  public EdmSchemaImpl setNamespace(final String namespace) {
+    this.namespace = namespace;
+    return this;
+  }
+
+  /**
+   * Sets the alias for this {@link EdmSchemaImpl}
+   * @param alias
+   * @return {@link EdmSchemaImpl} for method chaining
+   */
+  public EdmSchemaImpl setAlias(final String alias) {
+    this.alias = alias;
+    return this;
+  }
+
+  /**
+   * Sets the {@link Using} for this {@link EdmSchemaImpl}
+   * @param usings
+   * @return {@link EdmSchemaImpl} for method chaining
+   */
+  public EdmSchemaImpl setUsings(final List<EdmUsing> usings) {
+    this.usings = usings;
+    return this;
+  }
+
+  /**
+   * Sets the {@link EntityType}s for this {@link EdmSchemaImpl}
+   * @param entityTypes
+   * @return {@link EdmSchemaImpl} for method chaining
+   */
+  public EdmSchemaImpl setEntityTypes(final List<EdmEntityType> entityTypes) {
+    this.entityTypes = entityTypes;
+    return this;
+  }
+
+  /**
+   * Sets the {@link ComplexType}s for this {@link EdmSchemaImpl}
+   * @param complexTypes
+   * @return {@link EdmSchemaImpl} for method chaining
+   */
+  public EdmSchemaImpl setComplexTypes(final List<EdmComplexType> complexTypes) {
+    this.complexTypes = complexTypes;
+    return this;
+  }
+
+  /**
+   * Sets the {@link Association}s for this {@link EdmSchemaImpl}
+   * @param associations
+   * @return {@link EdmSchemaImpl} for method chaining
+   */
+  public EdmSchemaImpl setAssociations(final List<EdmAssociation> associations) {
+    this.associations = associations;
+    return this;
+  }
+
+  /**
+   * Sets the {@link EntityContainer}s for this {@link EdmSchemaImpl}
+   * @param entityContainers
+   * @return {@link EdmSchemaImpl} for method chaining
+   */
+  public EdmSchemaImpl setEntityContainers(final List<EdmEntityContainer> entityContainers) {
+    this.entityContainers = entityContainers;
+    return this;
+  }
+
+  /**
+   * Sets the List of {@link AnnotationAttribute} for this {@link EdmSchemaImpl}
+   * @param annotationAttributes
+   * @return {@link EdmSchemaImpl} for method chaining
+   */
+  public EdmSchemaImpl setAnnotationAttributes(final List<EdmAnnotationAttribute> annotationAttributes) {
+    this.annotationAttributes = annotationAttributes;
+    return this;
+  }
+
+  /**
+   * Sets the List of {@link AnnotationElement} for this {@link EdmSchemaImpl}
+   * @param annotationElements
+   * @return {@link EdmSchemaImpl} for method chaining
+   */
+  public EdmSchemaImpl setAnnotationElements(final List<EdmAnnotationElement> annotationElements) {
+    this.annotationElements = annotationElements;
+    return this;
+  }
+
+  /**
+   * @return <b>String</b> namespace of this {@link EdmSchemaImpl}
+   */
+  public String getNamespace() {
+    return namespace;
+  }
+
+  /**
+   * @return <b>String</b> alias of this {@link EdmSchemaImpl}
+   */
+  public String getAlias() {
+    return alias;
+  }
+
+  /**
+   * @return List<{@link Using}> of this {@link EdmSchemaImpl}
+   */
+  public List<EdmUsing> getUsings() {
+    return usings;
+  }
+
+  /**
+   * @return List<{@link EntityType}> of this {@link EdmSchemaImpl}
+   */
+  public List<EdmEntityType> getEntityTypes() {
+    return entityTypes;
+  }
+
+  /**
+   * @return List<{@link ComplexType}> of this {@link EdmSchemaImpl}
+   */
+  public List<EdmComplexType> getComplexTypes() {
+    return complexTypes;
+  }
+
+  /**
+   * @return List<{@link Association}> of this {@link EdmSchemaImpl}
+   */
+  public List<EdmAssociation> getAssociations() {
+    return associations;
+  }
+
+  /**
+   * @return List<{@link EntityContainer}> of this {@link EdmSchemaImpl}
+   */
+  public List<EdmEntityContainer> getEntityContainers() {
+    return entityContainers;
+  }
+
+  /**
+   * @return List of {@link AnnotationAttribute} annotation attributes
+   */
+  public List<EdmAnnotationAttribute> getAnnotationAttributes() {
+    return annotationAttributes;
+  }
+
+  /**
+   * @return List of {@link AnnotationElement} annotation elements
+   */
+  public List<EdmAnnotationElement> getAnnotationElements() {
+    return annotationElements;
+  }
+  
+  @Override
+  public String toString() {
+      return String.format(namespace + Edm.DELIMITER  + alias);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmSimplePropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmSimplePropertyImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmSimplePropertyImpl.java
new file mode 100644
index 0000000..07c97f7
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmSimplePropertyImpl.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.core.edm.EdmSimpleTypeFacadeImpl;
+
+/**
+ * Objects of this class represent EdmSimpleProperty
+ *
+ */
+public class EdmSimplePropertyImpl extends EdmPropertyImpl {
+
+  private EdmSimpleTypeKind simpleType;
+
+  @Override
+  public EdmType getType() throws EdmException {
+    if (edmType == null) {
+      edmType = EdmSimpleTypeFacadeImpl.getEdmSimpleType(getSimpleType());
+      if (edmType == null) {
+        throw new EdmException(EdmException.TYPEPROBLEM);
+      }
+    }
+    return edmType;
+  }
+
+  public EdmSimpleTypeKind getSimpleType() {
+    return simpleType;
+  }
+
+  public void setSimpleType(EdmSimpleTypeKind simpleType) {
+    this.simpleType = simpleType;
+  }
+
+  @Override
+  public boolean isSimple() {
+    return true;
+  }
+  
+  @Override
+  public String toString() {
+      return String.format(name);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmStructuralTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmStructuralTypeImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmStructuralTypeImpl.java
new file mode 100644
index 0000000..6a91ecf
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmStructuralTypeImpl.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmMapping;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.edm.EdmStructuralType;
+import org.apache.olingo.odata2.api.edm.EdmTypeKind;
+import org.apache.olingo.odata2.api.edm.EdmTyped;
+
+/**
+ *  Objects of this class represent structural type of the entity 
+ */
+public abstract class EdmStructuralTypeImpl extends EdmNamedImpl implements EdmStructuralType, EdmAnnotatable {
+
+  protected EdmStructuralType edmBaseType;
+  protected EdmComplexType structuralType;
+  private EdmTypeKind edmTypeKind;
+  protected String namespace;
+  private List<EdmProperty> properties;
+  private List<String> edmPropertyNames;
+  private EdmAnnotations annotations;
+
+
+  public EdmStructuralType getEdmBaseType() {
+    return edmBaseType;
+  }
+
+  public void setEdmBaseType(EdmStructuralType edmBaseType) {
+    this.edmBaseType = edmBaseType;
+  }
+
+  public EdmComplexType getStructuralType() {
+    return structuralType;
+  }
+
+  public void setStructuralType(EdmComplexType structuralType) {
+    this.structuralType = structuralType;
+  }
+
+  public EdmTypeKind getEdmTypeKind() {
+    return edmTypeKind;
+  }
+
+  public void setEdmTypeKind(EdmTypeKind edmTypeKind) {
+    this.edmTypeKind = edmTypeKind;
+  }
+
+  public void setEdmPropertyNames(List<String> edmPropertyNames) {
+    this.edmPropertyNames = edmPropertyNames;
+  }
+
+  public void setNamespace(String namespace) {
+    this.namespace = namespace;
+  }
+
+  public void setAnnotations(EdmAnnotations annotations) {
+    this.annotations = annotations;
+  }
+
+
+  public List<EdmProperty> getProperties() {
+    return properties;
+  }
+
+  public void setProperties(List<EdmProperty> properties) {
+    this.properties = properties;
+  }
+
+  @Override
+  public String getNamespace() throws EdmException {
+    return namespace;
+  }
+
+  @Override
+  public EdmTyped getProperty(final String name) throws EdmException {
+    EdmTyped property = getPropertyInternal(name);
+    if (property == null && edmBaseType != null) {
+      property = edmBaseType.getProperty(name);
+    }
+    return property;
+  }
+
+  @Override
+  public List<String> getPropertyNames() throws EdmException {
+    return edmPropertyNames;
+  }
+
+  @Override
+  public EdmStructuralType getBaseType() throws EdmException {
+    return edmBaseType;
+  }
+
+  @Override
+  public EdmTypeKind getKind() {
+    return edmTypeKind;
+  }
+
+  @Override
+  public EdmMapping getMapping() throws EdmException {
+    return structuralType.getMapping();
+  }
+
+  protected EdmTyped getPropertyInternal(final String name) throws EdmException {
+    EdmTyped edmProperty = null;
+    for (EdmProperty property : properties) {
+      if (property.getName().equals(name)) {
+        return property;
+      } 
+    }
+    if (edmBaseType!=null) {
+      edmProperty = edmBaseType.getProperty(name);
+    }
+    return edmProperty;
+  }
+
+  @Override
+  public String toString() {
+    try {
+      return namespace + Edm.DELIMITER + getName();
+    } catch (final EdmException e) {
+      return null; //NOSONAR
+    }
+  }
+
+  @Override
+  public EdmAnnotations getAnnotations() throws EdmException {
+    return annotations;
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmTypedImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmTypedImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmTypedImpl.java
new file mode 100644
index 0000000..597d426
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmTypedImpl.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
+import org.apache.olingo.odata2.api.edm.EdmSimpleType;
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.edm.EdmTyped;
+import org.apache.olingo.odata2.api.edm.FullQualifiedName;
+import org.apache.olingo.odata2.core.edm.EdmSimpleTypeFacadeImpl;
+
+/**
+ *  Objects of this class represent type of the entity
+ */
+public class EdmTypedImpl extends EdmNamedImpl implements EdmTyped {
+
+  protected EdmType edmType;
+  protected FullQualifiedName typeName;
+  protected EdmMultiplicity multiplicity;
+
+  public void setEdmType(EdmType edmType) {
+    this.edmType = edmType;
+  }
+
+  public EdmTypedImpl setTypeName(FullQualifiedName typeName) {
+    this.typeName = typeName;
+    return this;
+  }
+
+  public EdmTypedImpl setMultiplicity(EdmMultiplicity multiplicity) {
+    this.multiplicity = multiplicity;
+    return this;
+  }
+
+  @Override
+  public EdmType getType() throws EdmException {
+    if (edmType == null) {
+      final String namespace = typeName.getNamespace();
+      if (EdmSimpleType.EDM_NAMESPACE.equals(typeName.getNamespace())) {
+        edmType = EdmSimpleTypeFacadeImpl.getEdmSimpleType(EdmSimpleTypeKind.valueOf(typeName.getName()));
+      } else {
+        edmType = edm.getComplexType(namespace, typeName.getName());
+      }
+      if (edmType == null) {
+        edmType = edm.getEntityType(namespace, typeName.getName());
+      }
+
+      if (edmType == null) {
+        throw new EdmException(EdmException.TYPEPROBLEM);
+      }
+
+    }
+    return edmType;
+  }
+
+  @Override
+  public EdmMultiplicity getMultiplicity() throws EdmException {
+    return multiplicity;
+  }
+  
+  @Override
+  public String toString() {
+    return typeName.getNamespace() + Edm.DELIMITER + typeName.getName();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmUsingImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmUsingImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmUsingImpl.java
new file mode 100644
index 0000000..0bfdec2
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmUsingImpl.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * 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.odata2.client.core.edm.Impl;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationAttribute;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationElement;
+import org.apache.olingo.odata2.client.api.edm.EdmUsing;
+
+/**
+ *  Objects of this class represent EdmUsing
+ */
+public class EdmUsingImpl implements EdmUsing{
+
+  private String namespace;
+  private String alias;
+  private EdmDocumentationImpl documentation;
+  private List<EdmAnnotationAttribute> annotationAttributes;
+  private List<EdmAnnotationElement> annotationElements;
+
+  /**
+   * Sets the namespace for this {@link EdmUsingImpl}
+   * @param namespace
+   * @return {@link EdmUsingImpl} for method chaining
+   */
+  public EdmUsingImpl setNamespace(final String namespace) {
+    this.namespace = namespace;
+    return this;
+  }
+
+  /**
+   * Sets the alias for this {@link EdmUsingImpl}
+   * @param alias
+   * @return {@link EdmUsingImpl} for method chaining
+   */
+  public EdmUsingImpl setAlias(final String alias) {
+    this.alias = alias;
+    return this;
+  }
+
+  /**
+   * Sets the {@link EdmDocumentation} for this {@link EdmUsingImpl}
+   * @param documentation
+   * @return {@link EdmUsingImpl} for method chaining
+   */
+  public EdmUsingImpl setDocumentation(final EdmDocumentationImpl documentation) {
+    this.documentation = documentation;
+    return this;
+  }
+
+  /**
+   * Sets the collection of {@link AnnotationAttribute} for this {@link EdmUsingImpl}
+   * @param annotationAttributes
+   * @return {@link EdmUsingImpl} for method chaining
+   */
+  public EdmUsingImpl setAnnotationAttributes(final List<EdmAnnotationAttribute> annotationAttributes) {
+    this.annotationAttributes = annotationAttributes;
+    return this;
+  }
+
+  /**
+   * Sets the collection of {@link AnnotationElement} for this {@link EdmUsingImpl}
+   * @param annotationElements
+   * @return {@link EdmUsingImpl} for method chaining
+   */
+  public EdmUsingImpl setAnnotationElements(final List<EdmAnnotationElement> annotationElements) {
+    this.annotationElements = annotationElements;
+    return this;
+  }
+
+  /**
+   * @return <b>String</b> namespace
+   */
+  public String getNamespace() {
+    return namespace;
+  }
+
+  /**
+   * @return <b>String</b> alias
+   */
+  public String getAlias() {
+    return alias;
+  }
+
+  /**
+   * @return {@link EdmDocumentation} documentation
+   */
+  public EdmDocumentationImpl getDocumentation() {
+    return documentation;
+  }
+
+  /**
+   * @return collection of {@link AnnotationAttribute} annotation attributes
+   */
+  public Collection<EdmAnnotationAttribute> getAnnotationAttributes() {
+    return annotationAttributes;
+  }
+
+  /**
+   * @return collection of {@link AnnotationElement} annotation elements
+   */
+  public Collection<EdmAnnotationElement> getAnnotationElements() {
+    return annotationElements;
+  }
+  
+  @Override
+  public String toString() {
+    return namespace + Edm.DELIMITER + alias;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/ep/AtomSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/ep/AtomSerializerDeserializer.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/ep/AtomSerializerDeserializer.java
new file mode 100644
index 0000000..0298567
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/ep/AtomSerializerDeserializer.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * 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.odata2.client.core.ep;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.olingo.odata2.api.batch.BatchException;
+import org.apache.olingo.odata2.api.batch.BatchResponsePart;
+import org.apache.olingo.odata2.api.client.batch.BatchPart;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
+import org.apache.olingo.odata2.api.edm.EdmTypeKind;
+import org.apache.olingo.odata2.api.ep.EntityProviderException;
+import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
+import org.apache.olingo.odata2.api.processor.ODataErrorContext;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.processor.ODataResponse.ODataResponseBuilder;
+import org.apache.olingo.odata2.client.api.ep.ContentTypeBasedDeserializer;
+import org.apache.olingo.odata2.client.api.ep.ContentTypeBasedSerializer;
+import org.apache.olingo.odata2.client.api.ep.Entity;
+import org.apache.olingo.odata2.client.api.ep.EntityCollection;
+import org.apache.olingo.odata2.client.api.ep.EntityCollectionSerializerProperties;
+import org.apache.olingo.odata2.client.api.ep.EntitySerializerProperties;
+import org.apache.olingo.odata2.client.api.ep.EntityStream;
+import org.apache.olingo.odata2.client.core.ep.deserializer.XmlEntityDeserializer;
+import org.apache.olingo.odata2.client.core.ep.deserializer.XmlErrorDocumentDeserializer;
+import org.apache.olingo.odata2.client.core.ep.serializer.AtomEntryEntitySerializer;
+import org.apache.olingo.odata2.client.core.ep.serializer.AtomFeedSerializer;
+import org.apache.olingo.odata2.core.batch.BatchRequestWriter;
+import org.apache.olingo.odata2.core.batch.BatchResponseWriter;
+import org.apache.olingo.odata2.core.commons.ContentType;
+import org.apache.olingo.odata2.core.commons.ContentType.ODataFormat;
+import org.apache.olingo.odata2.core.commons.XmlHelper;
+import org.apache.olingo.odata2.core.ep.EntityProviderProducerException;
+import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
+import org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo;
+import org.apache.olingo.odata2.core.ep.util.CircleStreamBuffer;
+
+/**
+ *  This class includes methods to serialize deserialize XML Content type
+ */
+public class AtomSerializerDeserializer implements ContentTypeBasedSerializer, ContentTypeBasedDeserializer {
+
+  /** Default used charset for writer and response content header */
+  private static final String DEFAULT_CHARSET = ContentType.CHARSET_UTF_8;
+  private static final String XML_VERSION = "1.0";
+
+  /**
+   * 
+   * @throws EntityProviderException
+   */
+  public AtomSerializerDeserializer() throws EntityProviderException {
+    this(ODataFormat.ATOM);
+  }
+
+  /**
+   * 
+   * @param odataFormat
+   * @throws EntityProviderException
+   */
+  public AtomSerializerDeserializer(final ODataFormat odataFormat) throws EntityProviderException {
+    if (odataFormat != ODataFormat.ATOM && odataFormat != ODataFormat.XML) {
+      throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT
+          .addContent("Got unsupported ODataFormat '" + odataFormat + "'."));
+    }
+  }
+
+
+  @Override
+  public ODataResponse writeEntry( EdmEntitySet entitySet, Entity data
+      ) throws EntityProviderException {
+
+    CircleStreamBuffer csb = new CircleStreamBuffer();
+    
+    try {
+      if(data == null){
+        throw new EntityProviderProducerException(EntityProviderException.NULL_VALUE);
+      }
+      OutputStream outStream = csb.getOutputStream();
+      XMLStreamWriter writer = XmlHelper.getXMLOutputFactory().createXMLStreamWriter(outStream, DEFAULT_CHARSET);
+      writer.writeStartDocument(DEFAULT_CHARSET, XML_VERSION);
+      EntitySerializerProperties properties = data.getWriteProperties();
+      AtomEntryEntitySerializer as = new AtomEntryEntitySerializer(properties );
+      EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet, null);
+      as.append(writer, eia, data, true, false);
+
+      writer.flush();
+      csb.closeWrite();
+
+      ODataResponseBuilder response = ODataResponse.entity(csb.getInputStream());
+      return response.build();
+    } catch (EntityProviderException e) {
+      csb.close();
+      throw e;
+    } catch (Exception e) {
+      csb.close();
+      throw new EntityProviderProducerException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+          .getSimpleName()), e);
+    }
+  
+  }
+
+  @Override
+  public ODataFeed readFeed( EdmEntitySet entitySet, EntityStream content)
+      throws EntityProviderException {
+    XmlEntityDeserializer xec = new XmlEntityDeserializer();
+    return xec.readFeed(entitySet, content);
+  }
+
+  @Override
+  public ODataEntry readEntry( EdmEntitySet entitySet, EntityStream content)
+      throws EntityProviderException {
+
+    XmlEntityDeserializer xec = new XmlEntityDeserializer();
+    return xec.readEntry(entitySet, content);
+  
+  }
+
+  @Override
+  public ODataErrorContext readErrorDocument(InputStream errorDocument) throws EntityProviderException {
+    XmlErrorDocumentDeserializer xmlErrorDocumentConsumer = new XmlErrorDocumentDeserializer();
+    return xmlErrorDocumentConsumer.readError(errorDocument);
+  }
+
+  @Override
+  public ODataResponse writeFeed(EdmEntitySet entitySet, EntityCollection data) throws EntityProviderException {
+    CircleStreamBuffer csb = new CircleStreamBuffer();
+
+    try {
+      if(data == null){
+        throw new EntityProviderProducerException(EntityProviderException.NULL_VALUE);
+      }
+      
+      OutputStream outStream = csb.getOutputStream();
+      XMLStreamWriter writer = XmlHelper.getXMLOutputFactory().createXMLStreamWriter(outStream, DEFAULT_CHARSET);
+      writer.writeStartDocument(DEFAULT_CHARSET, XML_VERSION);
+
+      EntityCollectionSerializerProperties properties = data.getCollectionProperties();
+      AtomFeedSerializer atomFeedProvider = new AtomFeedSerializer(properties);
+      EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet, null);
+      atomFeedProvider.append(writer, eia, data, false);
+
+      writer.flush();
+      csb.closeWrite();
+
+      return ODataResponse.entity(csb.getInputStream()).build();
+    } catch (EntityProviderException e) {
+      csb.close();
+      throw e;
+    } catch (XMLStreamException e) {
+      csb.close();
+      throw new EntityProviderProducerException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+          .getSimpleName()), e);
+    }
+  }
+
+  @Override
+  public InputStream readBatchRequest(List<BatchPart> batchParts, String boundary) {
+    BatchRequestWriter batchWriter = new BatchRequestWriter();
+    return batchWriter.writeBatchRequest(batchParts, boundary);
+  }
+
+  @Override
+  public ODataResponse writeBatchResponse(List<BatchResponsePart> batchResponseParts) throws BatchException {
+    BatchResponseWriter batchWriter = new BatchResponseWriter();
+    return batchWriter.writeResponse(batchResponseParts);
+  }
+
+  @Override
+  public Object readFunctionImport(EdmFunctionImport functionImport, EntityStream content)
+      throws EntityProviderException {
+    try {
+      if (functionImport.getReturnType().getType().getKind() == EdmTypeKind.ENTITY) {
+        return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY
+            ? new XmlEntityDeserializer().readFeed(functionImport.getEntitySet(), content)
+            : new XmlEntityDeserializer().readEntry(functionImport.getEntitySet(), content);
+      } else {
+        final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport);
+        return functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY ?
+          new XmlEntityDeserializer().readCollection(info, content) :
+          new XmlEntityDeserializer().readProperty(info, content).get(info.getName());
+      }
+    } catch (final EdmException e) {
+      throw new EntityProviderException(e.getMessageReference(), e);
+    }
+  }
+}


Mime
View raw message