You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/02/19 11:30:12 UTC
[10/18] [OLINGO-170] Moved provider and implementation to server
module
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityTypeImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityTypeImpl.java
deleted file mode 100644
index 038f851..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityTypeImpl.java
+++ /dev/null
@@ -1,119 +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.odata4.commons.core.edm.provider;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
-import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntityType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.edm.provider.PropertyRef;
-
-public class EdmEntityTypeImpl extends EdmStructuralTypeImpl implements EdmEntityType {
-
- private EntityType entityType;
- private final List<String> keyPredicateNames = new ArrayList<String>();
- private final HashMap<String, EdmKeyPropertyRef> keyPropertyRefs = new HashMap<String, EdmKeyPropertyRef>();
- private final EdmEntityType entityBaseType;
- private ArrayList<EdmKeyPropertyRef> keyPropertyRefsList;
-
- public EdmEntityTypeImpl(final EdmProviderImpl edm, final FullQualifiedName name, final EntityType entityType) {
- super(edm, name, entityType, EdmTypeKind.ENTITY);
- this.entityType = entityType;
- if (baseType == null) {
- entityBaseType = null;
- List<PropertyRef> key = entityType.getKey();
- if (key == null && !entityType.isAbstract()) {
- throw new EdmException("Non-Abstract entity types must define a key.");
- }
- if (key != null) {
- for (PropertyRef ref : key) {
- EdmKeyPropertyRef edmKeyRef = new EdmKeyPropertyRefImpl(this, ref);
- if (ref.getAlias() != null) {
- keyPredicateNames.add(ref.getAlias());
- keyPropertyRefs.put(ref.getAlias(), edmKeyRef);
- } else {
- keyPredicateNames.add(ref.getPropertyName());
- keyPropertyRefs.put(ref.getPropertyName(), edmKeyRef);
- }
- }
- }
- } else {
- entityBaseType = (EdmEntityType) baseType;
- }
-
- }
-
- @Override
- public boolean hasStream() {
- return entityType.hasStream();
- }
-
- @Override
- public EdmEntityType getBaseType() {
- return entityBaseType;
- }
-
- @Override
- public List<String> getKeyPredicateNames() {
- if (keyPredicateNames.isEmpty() && baseType != null) {
- return entityBaseType.getKeyPredicateNames();
- }
- return keyPredicateNames;
- }
-
- @Override
- public List<EdmKeyPropertyRef> getKeyPropertyRefs() {
- if (keyPropertyRefsList == null) {
- keyPropertyRefsList = new ArrayList<EdmKeyPropertyRef>(keyPropertyRefs.values());
- }
- if (keyPropertyRefsList.isEmpty() && entityBaseType != null) {
- return entityBaseType.getKeyPropertyRefs();
- }
- return keyPropertyRefsList;
- }
-
- @Override
- public EdmKeyPropertyRef getKeyPropertyRef(final String keyPredicateName) {
- EdmKeyPropertyRef edmKeyPropertyRef = keyPropertyRefs.get(keyPredicateName);
- if (edmKeyPropertyRef == null && entityBaseType != null) {
- return entityBaseType.getKeyPropertyRef(keyPredicateName);
- }
- return edmKeyPropertyRef;
- }
-
- @Override
- protected EdmStructuralType buildBaseType(final FullQualifiedName baseTypeName) {
- EdmEntityType baseType = null;
- if (baseTypeName != null) {
- baseType = edm.getEntityType(baseTypeName);
- if (baseType == null) {
- throw new EdmException("Cannot find base type with name: " + baseTypeName + " for entity type: " + getName());
- }
- }
- return baseType;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEnumImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEnumImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEnumImpl.java
deleted file mode 100644
index 96c3c9b..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEnumImpl.java
+++ /dev/null
@@ -1,228 +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.odata4.commons.core.edm.provider;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
-import org.apache.olingo.odata4.commons.api.edm.EdmMember;
-import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.odata4.commons.api.edm.provider.EnumType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmInt64;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-
-public class EdmEnumImpl extends EdmNamedImpl implements EdmEnumType {
-
- private final FullQualifiedName enumName;
- private final EdmPrimitiveType edmPrimitiveTypeInstance;
- private final EnumType enumType;
- private final String uriPrefix;
- private final String uriSuffix;
- private List<String> memberNames;
-
- public EdmEnumImpl(final EdmProviderImpl edm, final FullQualifiedName enumName, final EnumType enumType) {
- super(edm, enumName.getName());
- this.enumName = enumName;
- this.enumType = enumType;
- uriPrefix = enumName.getFullQualifiedNameAsString() + '\'';
- uriSuffix = "'";
- FullQualifiedName underlyingTypeName = enumType.getUnderlyingType();
- if (underlyingTypeName == null) {
- edmPrimitiveTypeInstance = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
- } else {
- edmPrimitiveTypeInstance =
- EdmPrimitiveTypeKind.valueOf(underlyingTypeName.getName()).getEdmPrimitiveTypeInstance();
- // TODO: Should we validate that the underlying type is of byte, sbyte, in16, int32 or int64?
- }
-
- }
-
- @Override
- public boolean isCompatible(final EdmPrimitiveType primitiveType) {
- return equals(primitiveType);
- }
-
- @Override
- public Class<?> getDefaultType() {
- return edmPrimitiveTypeInstance.getDefaultType();
- }
-
- @Override
- public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale,
- final Boolean isUnicode) {
- try {
- valueOfString(value, isNullable, maxLength, precision, scale, isUnicode, getDefaultType());
- return true;
- } catch (final EdmPrimitiveTypeException e) {
- return false;
- }
- }
-
- @Override
- public <T> T valueOfString(final String value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale,
- final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
- if (value == null) {
- if (isNullable != null && !isNullable) {
- throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_NULL_NOT_ALLOWED");
- }
- return null;
- }
- return internalValueOfString(value, isNullable, maxLength, precision, scale, isUnicode, returnType);
- }
-
- @Override
- public String valueToString(final Object value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale,
- final Boolean isUnicode) throws EdmPrimitiveTypeException {
- if (value == null) {
- if (isNullable != null && !isNullable) {
- throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.VALUE_NULL_NOT_ALLOWED");
- }
- return null;
- }
- return internalValueToString(value, isNullable, maxLength, precision, scale, isUnicode);
- }
-
- @Override
- public String toUriLiteral(final String literal) {
- return literal == null ? null :
- uriPrefix.isEmpty() && uriSuffix.isEmpty() ? literal : uriPrefix + literal + uriSuffix;
- }
-
- @Override
- public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
- if (literal == null) {
- return null;
- } else if (uriPrefix.isEmpty() && uriSuffix.isEmpty()) {
- return literal;
- } else if (literal.length() >= uriPrefix.length() + uriSuffix.length()
- && literal.startsWith(uriPrefix) && literal.endsWith(uriSuffix)) {
- return literal.substring(uriPrefix.length(), literal.length() - uriSuffix.length());
- } else {
- throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(literal)");
- }
- }
-
- @Override
- public String getNamespace() {
- return enumName.getNamespace();
- }
-
- @Override
- public EdmTypeKind getKind() {
- return EdmTypeKind.ENUM;
- }
-
- @Override
- public EdmMember getMember(final String name) {
- for (EdmMember member : enumType.getMembers()) {
- if (member.getName().equals(name)) {
- return member;
- }
- }
- return null;
- }
-
- @Override
- public List<String> getMemberNames() {
- if (memberNames == null) {
- memberNames = new ArrayList<String>();
- for (final EdmMember member : enumType.getMembers()) {
- memberNames.add(member.getName());
- }
- }
- return memberNames;
- }
-
- @Override
- public EdmPrimitiveType getUnderlyingType() {
- return edmPrimitiveTypeInstance;
- }
-
- private <T> T internalValueOfString(final String value,
- final Boolean isNullable, final Integer maxLength, final Integer precision,
- final Integer scale, final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
- try {
- return EdmInt64.convertNumber(parseEnumValue(value), returnType);
- } catch (final IllegalArgumentException e) {
- throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.LITERAL_UNCONVERTIBLE_TO_VALUE_TYPE.addContent(value, returnType), e");
- } catch (final ClassCastException e) {
- throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType), e");
- }
- }
-
- private Long parseEnumValue(final String value) throws EdmPrimitiveTypeException {
- Long result = null;
- for (final String memberValue : value.split(",", enumType.isFlags() ? -1 : 1)) {
- Long memberValueLong = null;
- for (final EdmMember member : enumType.getMembers()) {
- if (member.getName().equals(memberValue) || member.getValue().equals(memberValue)) {
- memberValueLong = Long.decode(member.getValue());
- }
- }
- if (memberValueLong == null) {
- throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)");
- }
- result = result == null ? memberValueLong : result | memberValueLong;
- }
- return result;
- }
-
- protected String internalValueToString(final Object value,
- final Boolean isNullable, final Integer maxLength, final Integer precision,
- final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
- if (value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Long) {
- return constructEnumValue(((Number) value).longValue());
- } else {
- throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
- }
- }
-
- protected String constructEnumValue(final long value) throws EdmPrimitiveTypeException {
- long remaining = value;
- StringBuilder result = new StringBuilder();
-
- for (final EdmMember member : enumType.getMembers()) {
- final long memberValue = Long.parseLong(member.getValue());
- if ((memberValue & remaining) == memberValue) {
- if (result.length() > 0) {
- result.append(',');
- }
- result.append(member.getName());
- remaining ^= memberValue;
- }
- }
-
- if (remaining != 0) {
- throw new EdmPrimitiveTypeException(
- "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)");
- }
- return result.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImpl.java
deleted file mode 100644
index 4050b3d..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.commons.core.edm.provider;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
-import org.apache.olingo.odata4.commons.api.edm.EdmReturnType;
-import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.edm.provider.Function;
-
-public class EdmFunctionImpl extends EdmOperationImpl implements EdmFunction {
-
- private Function function;
-
- public EdmFunctionImpl(final EdmProviderImpl edm, final FullQualifiedName name, final Function function) {
- super(edm, name, function, EdmTypeKind.FUNCTION);
- this.function = function;
- }
-
- @Override
- public boolean isComposable() {
- return function.isComposable();
- }
-
- @Override
- public EdmReturnType getReturnType() {
- EdmReturnType returnType = super.getReturnType();
- if (returnType == null) {
- throw new EdmException("ReturnType for a function must not be null");
- }
- return returnType;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImportImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImportImpl.java
deleted file mode 100644
index 827c76f..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImportImpl.java
+++ /dev/null
@@ -1,43 +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.odata4.commons.core.edm.provider;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.odata4.commons.api.edm.provider.FunctionImport;
-
-public class EdmFunctionImportImpl extends EdmOperationImportImpl implements EdmFunctionImport {
-
- private final FunctionImport functionImport;
-
- public EdmFunctionImportImpl(final EdmProviderImpl edm, final String name, final EdmEntityContainer container,
- final FunctionImport functionImport) {
- super(edm, name, container, functionImport);
- this.functionImport = functionImport;
- }
-
- @Override
- public EdmFunction getFunction(final List<String> parameterNames) {
- return edm.getFunction(functionImport.getFunction(), null, null, parameterNames);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImportInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImportInfoImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImportInfoImpl.java
deleted file mode 100644
index 52f5b4d..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmFunctionImportInfoImpl.java
+++ /dev/null
@@ -1,53 +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.odata4.commons.core.edm.provider;
-
-import java.net.URI;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImportInfo;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntityContainer;
-import org.apache.olingo.odata4.commons.api.edm.provider.FunctionImport;
-
-public class EdmFunctionImportInfoImpl implements EdmFunctionImportInfo {
-
- private EntityContainer entityContainer;
- private FunctionImport functionImport;
-
- public EdmFunctionImportInfoImpl(final EntityContainer entityContainer, final FunctionImport functionImport) {
- this.entityContainer = entityContainer;
- this.functionImport = functionImport;
- }
-
- @Override
- public String getEntityContainerName() {
- return entityContainer.getName();
- }
-
- @Override
- public String getFunctionImportName() {
- return functionImport.getName();
- }
-
- @Override
- public URI getFunctionImportUri() {
- throw new EdmException("Not yet implemented");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmKeyPropertyRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmKeyPropertyRefImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmKeyPropertyRefImpl.java
deleted file mode 100644
index 8eb8ad4..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmKeyPropertyRefImpl.java
+++ /dev/null
@@ -1,89 +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.odata4.commons.core.edm.provider;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
-import org.apache.olingo.odata4.commons.api.edm.provider.PropertyRef;
-
-public class EdmKeyPropertyRefImpl implements EdmKeyPropertyRef {
-
- private PropertyRef ref;
- private EdmEntityType edmEntityType;
- private EdmProperty property;
-
- public EdmKeyPropertyRefImpl(final EdmEntityType edmEntityType, final PropertyRef ref) {
- this.edmEntityType = edmEntityType;
- this.ref = ref;
- }
-
- @Override
- public String getKeyPropertyName() {
- return ref.getPropertyName();
- }
-
- @Override
- public String getAlias() {
- return ref.getAlias();
- }
-
- @Override
- public String getPath() {
- return ref.getPath();
- }
-
- @Override
- public EdmProperty getProperty() {
- if (property == null) {
- if (ref.getAlias() == null) {
- property = (EdmProperty) edmEntityType.getProperty(ref.getPropertyName());
- if (property == null) {
- throw new EdmException("Invalid key property ref specified. Can´t find property with name: "
- + ref.getPropertyName());
- }
- } else {
- if (ref.getPath() == null || ref.getPath().isEmpty()) {
- throw new EdmException("Alias but no path specified for propertyRef");
- }
- String[] splitPath = ref.getPath().split("/");
- EdmStructuralType structType = edmEntityType;
- for (int i = 0; i < splitPath.length - 1; i++) {
- EdmProperty property = (EdmProperty) structType.getProperty(splitPath[i]);
- if (property == null) {
- throw new EdmException("Invalid property ref specified. Can´t find property with name: "
- + splitPath[i] + " at type: " + structType.getNamespace() + "." + structType.getName());
- }
- structType = (EdmStructuralType) property.getType();
- }
- property = (EdmProperty) structType.getProperty(splitPath[splitPath.length - 1]);
- if (property == null) {
- throw new EdmException("Invalid property ref specified. Can´t find property with name: "
- + splitPath[splitPath.length - 1] + " at type: " + structType.getNamespace() + "."
- + structType.getName());
- }
- }
- }
-
- return property;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmMemberImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmMemberImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmMemberImpl.java
deleted file mode 100644
index 6b69af7..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmMemberImpl.java
+++ /dev/null
@@ -1,38 +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.odata4.commons.core.edm.provider;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmMember;
-import org.apache.olingo.odata4.commons.api.edm.provider.EnumMember;
-
-public class EdmMemberImpl extends EdmNamedImpl implements EdmMember {
-
- private final EnumMember member;
-
- public EdmMemberImpl(final EdmProviderImpl edm, final EnumMember member) {
- super(edm, member.getName());
- this.member = member;
- }
-
- @Override
- public String getValue() {
- return member.getValue();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmNamedImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmNamedImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmNamedImpl.java
deleted file mode 100644
index be85736..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmNamedImpl.java
+++ /dev/null
@@ -1,39 +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.odata4.commons.core.edm.provider;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmNamed;
-
-public abstract class EdmNamedImpl implements EdmNamed {
-
- private String name;
- protected EdmProviderImpl edm;
-
- // TODO: ValidateName?
- public EdmNamedImpl(final EdmProviderImpl edm, final String name) {
- this.edm = edm;
- this.name = name;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmNavigationPropertyImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmNavigationPropertyImpl.java
deleted file mode 100644
index e11738b..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmNavigationPropertyImpl.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.odata4.commons.core.edm.provider;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmElement;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.NavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.provider.ReferentialConstraint;
-
-public class EdmNavigationPropertyImpl extends EdmElementImpl implements EdmNavigationProperty {
-
- private final NavigationProperty navigationProperty;
- private EdmEntityType typeImpl;
- private EdmNavigationProperty partnerNavigationProperty;
-
- public EdmNavigationPropertyImpl(final EdmProviderImpl edm, final NavigationProperty navigationProperty) {
- super(edm, navigationProperty.getName());
- this.navigationProperty = navigationProperty;
- }
-
- @Override
- public EdmType getType() {
- if (typeImpl == null) {
- typeImpl = edm.getEntityType(navigationProperty.getType());
- if (typeImpl == null) {
- throw new EdmException("Cannot find type with name: " + navigationProperty.getType());
- }
- }
- return typeImpl;
- }
-
- @Override
- public boolean isCollection() {
- return navigationProperty.isCollection();
- }
-
- @Override
- public Boolean isNullable() {
- return navigationProperty.getNullable();
- }
-
- @Override
- public EdmNavigationProperty getPartner() {
- if (partnerNavigationProperty == null) {
- String partner = navigationProperty.getPartner();
- if (partner != null) {
- EdmStructuralType type = (EdmStructuralType) getType();
- EdmElement property = null;
- String[] split = partner.split("/");
- for (String element : split) {
- property = type.getProperty(element);
- if (property == null) {
- throw new EdmException("Cannot find property with name: " + element + " at type " + type.getName());
- }
- type = (EdmStructuralType) property.getType();
- }
- partnerNavigationProperty = (EdmNavigationProperty) property;
- }
- }
- return partnerNavigationProperty;
- }
-
- @Override
- public String getReferencingPropertyName(final String referencedPropertyName) {
- List<ReferentialConstraint> referentialConstraints = navigationProperty.getReferentialConstraints();
- if (referentialConstraints != null) {
- for (ReferentialConstraint constraint : referentialConstraints) {
- if (constraint.getReferencedProperty().equals(referencedPropertyName)) {
- return constraint.getProperty();
- }
- }
- }
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmOperationImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmOperationImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmOperationImpl.java
deleted file mode 100644
index c0abd24..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmOperationImpl.java
+++ /dev/null
@@ -1,110 +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.odata4.commons.core.edm.provider;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmBindingTarget;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmOperation;
-import org.apache.olingo.odata4.commons.api.edm.EdmParameter;
-import org.apache.olingo.odata4.commons.api.edm.EdmReturnType;
-import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntitySetPath;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.edm.provider.Operation;
-import org.apache.olingo.odata4.commons.api.edm.provider.Parameter;
-
-public class EdmOperationImpl extends EdmTypeImpl implements EdmOperation {
-
- private final Map<String, EdmParameter> parameters = new HashMap<String, EdmParameter>();
- private final Operation operation;
- private EdmReturnType returnType;
- private List<String> parameterNames;
-
- public EdmOperationImpl(final EdmProviderImpl edm, final FullQualifiedName name, final Operation operation,
- final EdmTypeKind kind) {
- super(edm, name, kind);
- this.operation = operation;
- List<Parameter> providerParameters = operation.getParameters();
- if (providerParameters != null) {
- for (Parameter parameter : providerParameters) {
- parameters.put(parameter.getName(), new EdmParameterImpl(edm, parameter));
- }
- }
- }
-
- @Override
- public EdmParameter getParameter(final String name) {
- return parameters.get(name);
- }
-
- @Override
- public List<String> getParameterNames() {
- if (parameterNames == null) {
- parameterNames = new ArrayList<String>();
- List<Parameter> providerParameters = operation.getParameters();
- if (providerParameters != null) {
- for (Parameter parameter : providerParameters) {
- parameterNames.add(parameter.getName());
- }
- }
- }
- return parameterNames;
- }
-
- @Override
- public EdmEntitySet getReturnedEntitySet(final EdmEntitySet bindingParameterEntitySet) {
- EntitySetPath entitySetPath = operation.getEntitySetPath();
- EdmEntitySet returnedEntitySet = null;
- if (bindingParameterEntitySet != null && entitySetPath != null && entitySetPath.getBindingParameter() != null
- && entitySetPath.getPath() != null) {
- EdmBindingTarget relatedBindingTarget =
- bindingParameterEntitySet.getRelatedBindingTarget(entitySetPath.getPath());
- if (relatedBindingTarget == null) {
- throw new EdmException("Cannot find entity set with path: " + entitySetPath.getPath());
- }
- if (relatedBindingTarget instanceof EdmEntitySet) {
- returnedEntitySet = (EdmEntitySet) relatedBindingTarget;
- } else {
- throw new EdmException("BindingTarget with name: " + relatedBindingTarget.getName() + " must be an entity set");
- }
-
- }
- return returnedEntitySet;
- }
-
- @Override
- public EdmReturnType getReturnType() {
- if (returnType == null && operation.getReturnType() != null) {
- returnType = new EdmReturnTypeImpl(edm, operation.getReturnType());
- }
- return returnType;
- }
-
- @Override
- public boolean isBound() {
- return operation.isBound();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmOperationImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmOperationImportImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmOperationImportImpl.java
deleted file mode 100644
index 040510b..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmOperationImportImpl.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.odata4.commons.core.edm.provider;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmOperationImport;
-import org.apache.olingo.odata4.commons.api.edm.provider.OperationImport;
-import org.apache.olingo.odata4.commons.api.edm.provider.Target;
-
-public abstract class EdmOperationImportImpl extends EdmNamedImpl implements EdmOperationImport {
-
- private final OperationImport operationImport;
- private final EdmEntityContainer container;
- private EdmEntitySet returnedEntitySet;
-
- public EdmOperationImportImpl(final EdmProviderImpl edm, final String name, final EdmEntityContainer container,
- final OperationImport operationImport) {
- super(edm, name);
- this.container = container;
- this.operationImport = operationImport;
- }
-
- @Override
- public EdmEntitySet getReturnedEntitySet() {
- Target target = operationImport.getEntitySet();
- if (target != null && returnedEntitySet == null) {
- EdmEntityContainer entityContainer = edm.getEntityContainer(target.getEntityContainer());
- if (entityContainer == null) {
- throw new EdmException("Can´t find entity container with name: " + target.getEntityContainer());
- }
- returnedEntitySet = entityContainer.getEntitySet(target.getTargetName());
- if (returnedEntitySet == null) {
- throw new EdmException("Can´t find entity set with name: " + target.getTargetName());
- }
- }
- return returnedEntitySet;
- }
-
- @Override
- public EdmEntityContainer getEntityContainer() {
- return container;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmParameterImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmParameterImpl.java
deleted file mode 100644
index 9eb3b0f..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmParameterImpl.java
+++ /dev/null
@@ -1,99 +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.odata4.commons.core.edm.provider;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmMapping;
-import org.apache.olingo.odata4.commons.api.edm.EdmParameter;
-import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.edm.provider.Parameter;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-
-public class EdmParameterImpl extends EdmElementImpl implements EdmParameter {
-
- private final Parameter parameter;
- private EdmType typeImpl;
-
- public EdmParameterImpl(final EdmProviderImpl edm, final Parameter parameter) {
- super(edm, parameter.getName());
- this.parameter = parameter;
- }
-
- @Override
- public EdmType getType() {
- if (typeImpl == null) {
- FullQualifiedName typeName = parameter.getType();
- if (EdmPrimitiveType.EDM_NAMESPACE.equals(typeName.getNamespace())) {
- try {
- typeImpl = EdmPrimitiveTypeKind.valueOf(typeName.getName()).getEdmPrimitiveTypeInstance();
- } catch (IllegalArgumentException e) {
- throw new EdmException("Cannot find type with name: " + typeName, e);
- }
- } else {
- typeImpl = edm.getComplexType(typeName);
- if (typeImpl == null) {
- typeImpl = edm.getEntityType(typeName);
- if (typeImpl == null) {
- typeImpl = edm.getEnumType(typeName);
- if (typeImpl == null) {
- typeImpl = edm.getTypeDefinition(typeName);
- if (typeImpl == null) {
- throw new EdmException("Cannot find type with name: " + typeName);
- }
- }
- }
- }
- }
- }
- return typeImpl;
- }
-
- @Override
- public boolean isCollection() {
- return parameter.isCollection();
- }
-
- @Override
- public EdmMapping getMapping() {
- return parameter.getMapping();
- }
-
- @Override
- public Boolean isNullable() {
- return parameter.getNullable();
- }
-
- @Override
- public Integer getMaxLength() {
- return parameter.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return parameter.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return parameter.getScale();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmPropertyImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmPropertyImpl.java
deleted file mode 100644
index a87a461..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmPropertyImpl.java
+++ /dev/null
@@ -1,119 +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.odata4.commons.core.edm.provider;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmMapping;
-import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.edm.provider.Property;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-
-public class EdmPropertyImpl extends EdmElementImpl implements EdmProperty {
-
- private final Property property;
- private final boolean isPrimitive;
- private EdmType propertyType;
-
- public EdmPropertyImpl(final EdmProviderImpl edm, final Property property) {
- super(edm, property.getName());
- this.property = property;
- isPrimitive = EdmPrimitiveType.EDM_NAMESPACE.equals(property.getType().getNamespace());
- }
-
- @Override
- public EdmType getType() {
- if (propertyType == null) {
- FullQualifiedName typeName = property.getType();
- if (isPrimitive) {
- try {
- propertyType = EdmPrimitiveTypeKind.valueOf(typeName.getName()).getEdmPrimitiveTypeInstance();
- } catch (IllegalArgumentException e) {
- throw new EdmException("Cannot find type with name: " + typeName, e);
- }
- } else {
- propertyType = edm.getComplexType(typeName);
- if (propertyType == null) {
- propertyType = edm.getEnumType(typeName);
- if (propertyType == null) {
- propertyType = edm.getTypeDefinition(typeName);
- if (propertyType == null) {
- throw new EdmException("Cannot find type with name: " + typeName);
- }
- }
- }
- }
- }
-
- return propertyType;
- }
-
- @Override
- public boolean isCollection() {
- return property.isCollection();
- }
-
- @Override
- public EdmMapping getMapping() {
- return property.getMapping();
- }
-
- @Override
- public String getMimeType() {
- return property.getMimeType();
- }
-
- @Override
- public boolean isPrimitive() {
- return isPrimitive;
- }
-
- @Override
- public Boolean isNullable() {
- return property.getNullable();
- }
-
- @Override
- public Integer getMaxLength() {
- return property.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return property.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return property.getScale();
- }
-
- @Override
- public Boolean isUnicode() {
- return property.isUnicode();
- }
-
- @Override
- public String getDefaultValue() {
- return property.getDefaultValue();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmProviderImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmProviderImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmProviderImpl.java
deleted file mode 100644
index 50d201d..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmProviderImpl.java
+++ /dev/null
@@ -1,295 +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.odata4.commons.core.edm.provider;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmAction;
-import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
-import org.apache.olingo.odata4.commons.api.edm.EdmServiceMetadata;
-import org.apache.olingo.odata4.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.odata4.commons.api.edm.provider.Action;
-import org.apache.olingo.odata4.commons.api.edm.provider.AliasInfo;
-import org.apache.olingo.odata4.commons.api.edm.provider.ComplexType;
-import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntityContainerInfo;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntityType;
-import org.apache.olingo.odata4.commons.api.edm.provider.EnumType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.edm.provider.Function;
-import org.apache.olingo.odata4.commons.api.edm.provider.Parameter;
-import org.apache.olingo.odata4.commons.api.edm.provider.TypeDefinition;
-import org.apache.olingo.odata4.commons.api.exception.ODataException;
-import org.apache.olingo.odata4.commons.core.edm.EdmImpl;
-
-public class EdmProviderImpl extends EdmImpl {
-
- private final EdmProvider provider;
- private final Map<FullQualifiedName, List<Action>> actionsMap = new HashMap<FullQualifiedName, List<Action>>();
- private final Map<FullQualifiedName, List<Function>> functionsMap = new HashMap<FullQualifiedName, List<Function>>();
-
- public EdmProviderImpl(final EdmProvider provider) {
- this.provider = provider;
-
- }
-
- @Override
- public EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) {
- try {
- EntityContainerInfo entityContainerInfo = provider.getEntityContainerInfo(containerName);
- if (entityContainerInfo != null) {
- return new EdmEntityContainerImpl(this, provider, entityContainerInfo);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmEnumType createEnumType(final FullQualifiedName enumName) {
- try {
- EnumType enumType = provider.getEnumType(enumName);
- if (enumType != null) {
- return new EdmEnumImpl(this, enumName, enumType);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmTypeDefinition createTypeDefinition(final FullQualifiedName typeDefinitionName) {
- try {
- TypeDefinition typeDefinition = provider.getTypeDefinition(typeDefinitionName);
- if (typeDefinition != null) {
- return new EdmTypeDefinitionImpl(this, typeDefinitionName, typeDefinition);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmEntityType createEntityType(final FullQualifiedName entityTypeName) {
- try {
- EntityType entityType = provider.getEntityType(entityTypeName);
- if (entityType != null) {
- return new EdmEntityTypeImpl(this, entityTypeName, entityType);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmComplexType createComplexType(final FullQualifiedName complexTypeName) {
- try {
- ComplexType complexType = provider.getComplexType(complexTypeName);
- if (complexType != null) {
- return new EdmComplexTypeImpl(this, complexTypeName, complexType);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmAction createBoundAction(final FullQualifiedName actionName,
- final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) {
- try {
- List<Action> actions = actionsMap.get(actionName);
- if (actions == null) {
- actions = provider.getActions(actionName);
- if (actions != null) {
- actionsMap.put(actionName, actions);
- } else {
- return null;
- }
- }
- EdmActionImpl actionImpl = null;
- // Search for bound action where binding parameter matches
- for (Action action : actions) {
- if (action.isBound() == true) {
- List<Parameter> parameters = action.getParameters();
- Parameter parameter = parameters.get(0);
- if (bindingParameterTypeName.equals(parameter.getType())
- && isBindingParameterCollection.booleanValue() == parameter.isCollection()) {
- actionImpl = new EdmActionImpl(this, actionName, action);
- break;
- }
-
- }
- }
- return actionImpl;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmFunction createBoundFunction(final FullQualifiedName functionName,
- final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection,
- final List<String> parameterNames) {
- try {
- List<Function> functions = functionsMap.get(functionName);
- if (functions == null) {
- functions = provider.getFunctions(functionName);
- if (functions != null) {
- functionsMap.put(functionName, functions);
- } else {
- return null;
- }
- }
- List<String> parameterNamesCopy = parameterNames;
- if (parameterNamesCopy == null) {
- parameterNamesCopy = Collections.emptyList();
- }
- EdmFunctionImpl functionImpl = null;
- for (Function function : functions) {
- if (function.isBound() == true) {
- List<Parameter> providerParameters = function.getParameters();
- if (providerParameters == null || providerParameters.size() == 0) {
- throw new EdmException("No parameter specified for bound function: " + functionName);
- }
- Parameter bindingParameter = providerParameters.get(0);
- if (bindingParameterTypeName.equals(bindingParameter.getType())
- && isBindingParameterCollection.booleanValue() == bindingParameter.isCollection()) {
- if (parameterNamesCopy.size() == providerParameters.size() - 1) {
- List<String> providerParameterNames = new ArrayList<String>();
- for (int i = 1; i < providerParameters.size(); i++) {
- providerParameterNames.add(providerParameters.get(i).getName());
- }
- if (parameterNamesCopy.containsAll(providerParameterNames)) {
- functionImpl = new EdmFunctionImpl(this, functionName, function);
- break;
- }
- }
- }
- }
- }
- return functionImpl;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmServiceMetadata createServiceMetadata() {
- return new EdmServiceMetadataImpl(provider);
- }
-
- @Override
- protected Map<String, String> createAliasToNamespaceInfo() {
- Map<String, String> aliasToNamespaceInfos = new HashMap<String, String>();
- try {
- List<AliasInfo> aliasInfos = provider.getAliasInfos();
- if (aliasInfos != null) {
- for (AliasInfo info : aliasInfos) {
- aliasToNamespaceInfos.put(info.getAlias(), info.getNamespace());
- }
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- return aliasToNamespaceInfos;
- }
-
- @Override
- protected EdmAction createUnboundAction(final FullQualifiedName actionName) {
- try {
- List<Action> actions = actionsMap.get(actionName);
- if (actions == null) {
- actions = provider.getActions(actionName);
- if (actions != null) {
- actionsMap.put(actionName, actions);
- } else {
- return null;
- }
- }
- EdmActionImpl actionImpl = null;
- // Search for first unbound action
- for (Action action : actions) {
- if (action.isBound() == false) {
- actionImpl = new EdmActionImpl(this, actionName, action);
- break;
- }
- }
- return actionImpl;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- protected EdmFunction createUnboundFunction(final FullQualifiedName functionName, final List<String> parameterNames) {
- try {
- List<Function> functions = functionsMap.get(functionName);
- if (functions == null) {
- functions = provider.getFunctions(functionName);
- if (functions != null) {
- functionsMap.put(functionName, functions);
- } else {
- return null;
- }
- }
- List<String> parameterNamesCopy = parameterNames;
- if (parameterNamesCopy == null) {
- parameterNamesCopy = Collections.emptyList();
- }
- EdmFunctionImpl functionImpl = null;
- for (Function function : functions) {
- if (function.isBound() == false) {
- List<Parameter> providerParameters = function.getParameters();
- if (providerParameters == null) {
- providerParameters = Collections.emptyList();
- }
- if (parameterNamesCopy.size() == providerParameters.size()) {
- List<String> functionParameterNames = new ArrayList<String>();
- for (Parameter parameter : providerParameters) {
- functionParameterNames.add(parameter.getName());
- }
-
- if (parameterNamesCopy.containsAll(functionParameterNames)) {
- functionImpl = new EdmFunctionImpl(this, functionName, function);
- break;
- }
- }
- }
- }
- return functionImpl;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmReturnTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmReturnTypeImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmReturnTypeImpl.java
deleted file mode 100644
index d8ade82..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmReturnTypeImpl.java
+++ /dev/null
@@ -1,95 +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.odata4.commons.core.edm.provider;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.odata4.commons.api.edm.EdmReturnType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.edm.provider.ReturnType;
-import org.apache.olingo.odata4.commons.core.edm.EdmImpl;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-
-public class EdmReturnTypeImpl implements EdmReturnType {
-
- private final EdmImpl edm;
- private final ReturnType returnType;
- private EdmType typeImpl;
-
- public EdmReturnTypeImpl(final EdmImpl edm, final ReturnType returnType) {
- this.edm = edm;
- this.returnType = returnType;
- }
-
- @Override
- public EdmType getType() {
- if (typeImpl == null) {
- FullQualifiedName typeName = returnType.getType();
- if (EdmPrimitiveType.EDM_NAMESPACE.equals(typeName.getNamespace())) {
- try {
- typeImpl = EdmPrimitiveTypeKind.valueOf(typeName.getName()).getEdmPrimitiveTypeInstance();
- } catch (IllegalArgumentException e) {
- throw new EdmException("Cannot find type with name: " + typeName, e);
- }
- } else {
- typeImpl = edm.getComplexType(typeName);
- if (typeImpl == null) {
- typeImpl = edm.getEntityType(typeName);
- if (typeImpl == null) {
- typeImpl = edm.getEnumType(typeName);
- if (typeImpl == null) {
- typeImpl = edm.getTypeDefinition(typeName);
- if (typeImpl == null) {
- throw new EdmException("Cant find type with name: " + typeName);
- }
- }
- }
- }
- }
- }
- return typeImpl;
- }
-
- @Override
- public boolean isCollection() {
- return returnType.isCollection();
- }
-
- @Override
- public Boolean isNullable() {
- return returnType.getNullable();
- }
-
- @Override
- public Integer getMaxLength() {
- return returnType.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return returnType.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return returnType.getScale();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmServiceMetadataImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmServiceMetadataImpl.java
deleted file mode 100644
index cbf42ff..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmServiceMetadataImpl.java
+++ /dev/null
@@ -1,148 +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.odata4.commons.core.edm.provider;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntitySetInfo;
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImportInfo;
-import org.apache.olingo.odata4.commons.api.edm.EdmServiceMetadata;
-import org.apache.olingo.odata4.commons.api.edm.EdmSingletonInfo;
-import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntityContainer;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntitySet;
-import org.apache.olingo.odata4.commons.api.edm.provider.FunctionImport;
-import org.apache.olingo.odata4.commons.api.edm.provider.Schema;
-import org.apache.olingo.odata4.commons.api.edm.provider.Singleton;
-import org.apache.olingo.odata4.commons.api.exception.ODataException;
-
-public class EdmServiceMetadataImpl implements EdmServiceMetadata {
-
- private EdmProvider provider;
- private ArrayList<EdmEntitySetInfo> entitySetInfos;
- private ArrayList<EdmFunctionImportInfo> functionImportInfos;
- private ArrayList<EdmSingletonInfo> singletonInfos;
- private List<Schema> schemas;
-
- public EdmServiceMetadataImpl(final EdmProvider provider) {
- this.provider = provider;
- }
-
- @Override
- public InputStream getMetadata() {
- throw new RuntimeException("Not yet implemented");
- }
-
- @Override
- public String getDataServiceVersion() {
- return ODataServiceVersion.V40;
- }
-
- @Override
- public List<EdmEntitySetInfo> getEntitySetInfos() {
- if (entitySetInfos == null) {
- try {
- entitySetInfos = new ArrayList<EdmEntitySetInfo>();
- if (schemas == null) {
- schemas = provider.getSchemas();
- if (schemas == null) {
- throw new EdmException("Provider doe not define any schemas.");
- }
- }
- for (Schema schema : schemas) {
- EntityContainer entityContainer = schema.getEntityContainer();
- if (entityContainer != null) {
- List<EntitySet> entitySets = entityContainer.getEntitySets();
- if (entitySets != null) {
- for (EntitySet set : entitySets) {
- entitySetInfos.add(new EdmEntitySetInfoImpl(entityContainer, set));
- }
- }
- }
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
- return entitySetInfos;
- }
-
- @Override
- public List<EdmSingletonInfo> getSingletonInfos() {
- if (singletonInfos == null) {
- try {
- singletonInfos = new ArrayList<EdmSingletonInfo>();
- if (schemas == null) {
- schemas = provider.getSchemas();
- if (schemas == null) {
- throw new EdmException("Provider doe not define any schemas.");
- }
- }
- for (Schema schema : schemas) {
- EntityContainer entityContainer = schema.getEntityContainer();
- if (entityContainer != null) {
- List<Singleton> singletons = entityContainer.getSingletons();
- if (singletons != null) {
- for (Singleton singleton : singletons) {
- singletonInfos.add(new EdmSingletonInfoImpl(entityContainer, singleton));
- }
- }
- }
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
- return singletonInfos;
- }
-
- @Override
- public List<EdmFunctionImportInfo> getFunctionImportInfos() {
- if (functionImportInfos == null) {
- try {
- functionImportInfos = new ArrayList<EdmFunctionImportInfo>();
- if (schemas == null) {
- schemas = provider.getSchemas();
- if (schemas == null) {
- throw new EdmException("Provider doe not define any schemas.");
- }
- }
- for (Schema schema : schemas) {
- EntityContainer entityContainer = schema.getEntityContainer();
- if (entityContainer != null) {
- List<FunctionImport> functionImports = entityContainer.getFunctionImports();
- if (functionImports != null) {
- for (FunctionImport functionImport : functionImports) {
- functionImportInfos.add(new EdmFunctionImportInfoImpl(entityContainer, functionImport));
- }
- }
- }
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
- return functionImportInfos;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmSingletonImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmSingletonImpl.java
deleted file mode 100644
index 46856af..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmSingletonImpl.java
+++ /dev/null
@@ -1,30 +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.odata4.commons.core.edm.provider;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
-import org.apache.olingo.odata4.commons.api.edm.provider.Singleton;
-
-public class EdmSingletonImpl extends EdmBindingTargetImpl implements EdmSingleton {
-
- public EdmSingletonImpl(final EdmProviderImpl edm, final EdmEntityContainer container, final Singleton singleton) {
- super(edm, container, singleton);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmSingletonInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmSingletonInfoImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmSingletonInfoImpl.java
deleted file mode 100644
index 2e7e373..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmSingletonInfoImpl.java
+++ /dev/null
@@ -1,53 +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.odata4.commons.core.edm.provider;
-
-import java.net.URI;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmSingletonInfo;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntityContainer;
-import org.apache.olingo.odata4.commons.api.edm.provider.Singleton;
-
-public class EdmSingletonInfoImpl implements EdmSingletonInfo {
-
- private final EntityContainer entityContainer;
- private final Singleton singleton;
-
- public EdmSingletonInfoImpl(final EntityContainer entityContainer, final Singleton singleton) {
- this.entityContainer = entityContainer;
- this.singleton = singleton;
- }
-
- @Override
- public String getEntityContainerName() {
- return entityContainer.getName();
- }
-
- @Override
- public String getSingletonName() {
- return singleton.getName();
- }
-
- @Override
- public URI getEntitySetUri() {
- throw new EdmException("Not yet implemented");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmStructuralTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmStructuralTypeImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmStructuralTypeImpl.java
deleted file mode 100644
index 44c9be7..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmStructuralTypeImpl.java
+++ /dev/null
@@ -1,129 +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.odata4.commons.core.edm.provider;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmElement;
-import org.apache.olingo.odata4.commons.api.edm.EdmException;
-import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.edm.provider.NavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.provider.Property;
-import org.apache.olingo.odata4.commons.api.edm.provider.StructuralType;
-
-public abstract class EdmStructuralTypeImpl extends EdmTypeImpl implements EdmStructuralType {
-
- private final Map<String, EdmElement> properties = new HashMap<String, EdmElement>();
- private ArrayList<String> navigationPropertyNames;
- private ArrayList<String> propertyNames;
- protected final EdmStructuralType baseType;
- private final StructuralType structuralType;
-
- public EdmStructuralTypeImpl(final EdmProviderImpl edm, final FullQualifiedName name,
- final StructuralType structuralType, final EdmTypeKind kind) {
- super(edm, name, kind);
- this.structuralType = structuralType;
- baseType = buildBaseType(structuralType.getBaseType());
- buildProperties(structuralType.getProperties());
- buildNavigationProperties(structuralType.getNavigationProperties());
- }
-
- private void buildNavigationProperties(final List<NavigationProperty> providerNavigationProperties) {
- if (providerNavigationProperties != null) {
- for (NavigationProperty navigationProperty : providerNavigationProperties) {
- properties.put(navigationProperty.getName(), new EdmNavigationPropertyImpl(edm, navigationProperty));
- }
- }
-
- }
-
- private void buildProperties(final List<Property> providerProperties) {
- if (providerProperties != null) {
- for (Property property : providerProperties) {
- properties.put(property.getName(), new EdmPropertyImpl(edm, property));
- }
- }
-
- }
-
- @Override
- public EdmElement getProperty(final String name) {
- EdmElement property = null;
- if (baseType != null) {
- property = baseType.getProperty(name);
- }
- if (property == null) {
- property = properties.get(name);
- }
- return property;
- }
-
- @Override
- public List<String> getPropertyNames() {
- if (propertyNames == null) {
- propertyNames = new ArrayList<String>();
- if (baseType != null) {
- propertyNames.addAll(baseType.getPropertyNames());
- }
- for (Property property : structuralType.getProperties()) {
- propertyNames.add(property.getName());
- }
- }
- return propertyNames;
- }
-
- @Override
- public List<String> getNavigationPropertyNames() {
- if (navigationPropertyNames == null) {
- navigationPropertyNames = new ArrayList<String>();
- if (baseType != null) {
- navigationPropertyNames.addAll(baseType.getNavigationPropertyNames());
- }
- for (NavigationProperty navProperty : structuralType.getNavigationProperties()) {
- navigationPropertyNames.add(navProperty.getName());
- }
- }
- return navigationPropertyNames;
- }
-
- @Override
- public boolean compatibleTo(final EdmType targetType) {
- EdmStructuralType sourceType = this;
- if (targetType == null) {
- throw new EdmException("Target type must not be null");
- }
- while (sourceType.getName() != targetType.getName() ||
- sourceType.getNamespace() != targetType.getNamespace()) {
- sourceType = sourceType.getBaseType();
- if (sourceType == null) {
- return false;
- }
- }
-
- return true;
- }
-
- protected abstract EdmStructuralType buildBaseType(FullQualifiedName baseTypeName);
-}