You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2013/12/06 15:51:50 UTC
[14/21] [OLINGO-77] Refactored java package names
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumImpl.java
deleted file mode 100644
index b3cd6c6..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumImpl.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.commons.core.edm.provider;
-
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmMember;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.EnumType;
-
-public class EdmEnumImpl extends EdmNamedImpl implements EdmEnumType {
-
- private final FullQualifiedName enumName;
-
- public EdmEnumImpl(final EdmProviderImpl edm, final FullQualifiedName enumName, final EnumType enumType) {
- super(edm, enumName.getName());
- this.enumName = enumName;
- }
-
- @Override
- public boolean isCompatible(final EdmPrimitiveType primitiveType) {
- return false;
- }
-
- @Override
- public Class<?> getDefaultType() {
- return null;
- }
-
- @Override
- public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale,
- final Boolean isUnicode) {
- 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 {
- return null;
- }
-
- @Override
- public String valueToString(final Object value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale,
- final Boolean isUnicode) throws EdmPrimitiveTypeException {
- return null;
- }
-
- @Override
- public String toUriLiteral(final String literal) {
- return null;
- }
-
- @Override
- public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
- return null;
- }
-
- @Override
- public String getNamespace() {
- return enumName.getNamespace();
- }
-
- @Override
- public EdmTypeKind getKind() {
- return null;
- }
-
- @Override
- public EdmMember getMember(final String name) {
- return null;
- }
-
- @Override
- public List<String> getMemberNames() {
- return null;
- }
-
- @Override
- public EdmPrimitiveType getUnderlyingType() {
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java
deleted file mode 100644
index f56c0fc..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
-import org.apache.olingo.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();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImportImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImportImpl.java
deleted file mode 100644
index ec5f8e8..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/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.commons.core.edm.provider;
-
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.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/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmKeyPropertyRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmKeyPropertyRefImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmKeyPropertyRefImpl.java
deleted file mode 100644
index c60ebe9..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/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.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmStructuralType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.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 {
- String[] splitPath = ref.getPath().split("/");
- EdmStructuralType structType = edmEntityType;
- for (int i = 0; i < splitPath.length; i++) {
- property = (EdmProperty) structType.getProperty(splitPath[i]);
- if (property == null) {
- throw new EdmException("Invalid key property ref specified. Can´t find property with name: "
- + splitPath[i]);
- }
- EdmType childType = property.getType();
- if (childType.getKind() == EdmTypeKind.COMPLEX) {
- structType = (EdmStructuralType) childType;
- } else {
- if (i + 1 != splitPath.length) {
- throw new EdmException("Invalid path: " + ref.getPath() + " Must end after: " + splitPath[i]);
- }
- }
- }
- }
- }
-
- return property;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmMemberImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmMemberImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmMemberImpl.java
deleted file mode 100644
index fff0200..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/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.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmMember;
-import org.apache.olingo.commons.api.edm.provider.EnumMember;
-
-public class EdmMemberImpl extends EdmNamedImpl implements EdmMember {
-
- private final EnumMember member;
-
- public EdmMemberImpl(EdmProviderImpl edm, 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/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNamedImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNamedImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNamedImpl.java
deleted file mode 100644
index 2e9afed..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/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.commons.core.edm.provider;
-
-import org.apache.olingo.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/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java
deleted file mode 100644
index c973fff..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
-
-public class EdmNavigationPropertyImpl extends EdmElementImpl implements EdmNavigationProperty {
-
- private final NavigationProperty navigationProperty;
- private EdmEntityType typeImpl;
-
- 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("Can�t find type with name: " + navigationProperty.getType());
- }
- }
- return typeImpl;
- }
-
- @Override
- public boolean isCollection() {
- return navigationProperty.isCollection();
- }
-
- @Override
- public Boolean isNullable() {
- return navigationProperty.getNullable();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImpl.java
deleted file mode 100644
index 2131074..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImpl.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.commons.core.edm.provider;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmOperation;
-import org.apache.olingo.commons.api.edm.EdmParameter;
-import org.apache.olingo.commons.api.edm.EdmReturnType;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.Operation;
-import org.apache.olingo.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, final String path) {
- //TODO: What here?
- return null;
- }
-
- @Override
- public EdmReturnType getReturnType() {
- if (returnType == 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/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImportImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmOperationImportImpl.java
deleted file mode 100644
index d509080..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/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.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmOperationImport;
-import org.apache.olingo.commons.api.edm.provider.OperationImport;
-import org.apache.olingo.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/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java
deleted file mode 100644
index 496e671..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmParameter;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.helper.EdmMapping;
-import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.Parameter;
-import org.apache.olingo.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())) {
- EdmPrimitiveTypeKind kind = EdmPrimitiveTypeKind.valueOf(typeName.getName());
- if (kind != null) {
- typeImpl = kind.getEdmPrimitiveTypeInstance();
- } else {
- throw new EdmException("Cant find type with name: " + typeName);
- }
- } 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 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/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java
deleted file mode 100644
index 71bab4a..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.helper.EdmMapping;
-import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.Property;
-import org.apache.olingo.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;
- if (EdmPrimitiveType.EDM_NAMESPACE.equals(property.getType().getNamespace())) {
- isPrimitive = true;
- } else {
- isPrimitive = false;
- }
- }
-
- @Override
- public EdmType getType() {
- if (propertyType == null) {
- FullQualifiedName typeName = property.getType();
- if (isPrimitive) {
- EdmPrimitiveTypeKind kind = EdmPrimitiveTypeKind.valueOf(typeName.getName());
- if (kind != null) {
- propertyType = kind.getEdmPrimitiveTypeInstance();
- } else {
- throw new EdmException("Can�t find type with name: " + typeName);
- }
- } 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("Can�t 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/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java
deleted file mode 100644
index d885bab..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.commons.core.edm.provider;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.helper.AliasInfo;
-import org.apache.olingo.commons.api.edm.helper.EntityContainerInfo;
-import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.Action;
-import org.apache.olingo.commons.api.edm.provider.ComplexType;
-import org.apache.olingo.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.commons.api.edm.provider.EntityType;
-import org.apache.olingo.commons.api.edm.provider.EnumType;
-import org.apache.olingo.commons.api.edm.provider.Function;
-import org.apache.olingo.commons.api.edm.provider.Parameter;
-import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
-import org.apache.olingo.commons.api.exception.ODataException;
-import org.apache.olingo.commons.core.edm.EdmImpl;
-
-public class EdmProviderImpl extends EdmImpl {
-
- private final EdmProvider provider;
-
- 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 createAction(final FullQualifiedName actionName, final FullQualifiedName bindingParameterTypeName,
- final Boolean isBindingParameterCollection) {
-
- try {
- List<Action> actions = provider.getActions(actionName);
- if (actions != null) {
- EdmActionImpl actionImpl = null;
- if (bindingParameterTypeName == null) {
- // Search for first unbound action
- for (Action action : actions) {
- if (action.isBound() == false) {
- actionImpl = new EdmActionImpl(this, actionName, action);
- break;
- }
- }
- } else {
- // Search for bound action where binding parameter matches
- boolean isCollection = false;
- if (isBindingParameterCollection == null) {
- isCollection = false;
- } else {
- isCollection = isBindingParameterCollection;
- }
- for (Action action : actions) {
- if (action.isBound() == true) {
- List<Parameter> parameters = action.getParameters();
- Parameter parameter = parameters.get(0);
- if (bindingParameterTypeName.equals(parameter.getType()) && isCollection == parameter.isCollection()) {
- actionImpl = new EdmActionImpl(this, actionName, action);
- break;
- }
-
- }
- }
- }
-
- return actionImpl;
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmFunction createFunction(final FullQualifiedName functionName,
- final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection,
- final List<String> parameterNames) {
- try {
- List<Function> functions = provider.getFunctions(functionName);
- if (functions != null) {
- EdmFunctionImpl functionImpl = null;
- // TODO: Should we throw an edmexception when parameternames is null?
- if (bindingParameterTypeName == null) {
- // Search for matching unbound function
- for (Function function : functions) {
- if (function.isBound() == false) {
- List<Parameter> parameters = function.getParameters();
- if (parameterNames.size() == parameters.size()) {
- List<String> functionParameterNames = new ArrayList<String>();
- for (Parameter parameter : parameters) {
- functionParameterNames.add(parameter.getName());
- }
-
- if (parameterNames.containsAll(functionParameterNames)) {
- functionImpl = new EdmFunctionImpl(this, functionName, function);
- break;
- }
- }
- }
- }
- } else {
- // Search for matching bound function
- boolean isCollection = false;
- if (isBindingParameterCollection == null) {
- isCollection = false;
- } else {
- isCollection = isBindingParameterCollection;
- }
- for (Function function : functions) {
- if (function.isBound() == true) {
- List<Parameter> parameters = function.getParameters();
- Parameter bindingParameter = parameters.get(0);
- if (bindingParameterTypeName.equals(bindingParameter.getType())
- && isCollection == bindingParameter.isCollection()) {
- // bindingparameter type matches now only parameter names have to match
- List<String> functionParameterNames = new ArrayList<String>();
- for (int i = 1; i < parameters.size(); i++) {
- functionParameterNames.add(parameters.get(i).getName());
- }
-
- if (parameterNames.containsAll(functionParameterNames)) {
- functionImpl = new EdmFunctionImpl(this, functionName, function);
- break;
- }
- }
- }
- }
- }
-
- return functionImpl;
- }
- return null;
- } 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;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java
deleted file mode 100644
index 8b6154c..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmReturnType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.ReturnType;
-import org.apache.olingo.commons.core.edm.EdmImpl;
-import org.apache.olingo.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())) {
- EdmPrimitiveTypeKind kind = EdmPrimitiveTypeKind.valueOf(typeName.getName());
- if (kind != null) {
- typeImpl = kind.getEdmPrimitiveTypeInstance();
- } else {
- throw new EdmException("Can�t find type with name: " + typeName);
- }
- } 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/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmServiceMetadataImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmServiceMetadataImpl.java
deleted file mode 100644
index 5feb519..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmServiceMetadataImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.commons.core.edm.provider;
-
-import java.io.InputStream;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
-import org.apache.olingo.commons.api.edm.helper.EdmEntitySetInfo;
-import org.apache.olingo.commons.api.edm.helper.EdmFunctionImportInfo;
-import org.apache.olingo.commons.api.edm.helper.EdmSingletonInfo;
-import org.apache.olingo.commons.api.edm.provider.EdmProvider;
-
-public class EdmServiceMetadataImpl implements EdmServiceMetadata {
-
- public EdmServiceMetadataImpl(final EdmProvider provider) {}
-
- @Override
- public InputStream getMetadata() {
- return null;
- }
-
- @Override
- public String getDataServiceVersion() {
- // TODO: make constant
- return "4.0";
- }
-
- @Override
- public List<EdmEntitySetInfo> getEntitySetInfos() {
- return null;
- }
-
- @Override
- public List<EdmSingletonInfo> getSingletonInfos() {
- return null;
- }
-
- @Override
- public List<EdmFunctionImportInfo> getFunctionImportInfos() {
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSingletonImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSingletonImpl.java
deleted file mode 100644
index 7dcab20..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/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.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.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/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuralTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuralTypeImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuralTypeImpl.java
deleted file mode 100644
index 942c816..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuralTypeImpl.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.commons.core.edm.provider;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmStructuralType;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
-import org.apache.olingo.commons.api.edm.provider.Property;
-import org.apache.olingo.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;
- }
-
- protected abstract EdmStructuralType buildBaseType(FullQualifiedName baseTypeName);
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java
deleted file mode 100644
index 18e28e4..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
-
-public class EdmTypeDefinitionImpl extends EdmNamedImpl implements EdmTypeDefinition {
-
- private final FullQualifiedName typeDefinitionName;
-
- public EdmTypeDefinitionImpl(final EdmProviderImpl edm, final FullQualifiedName typeDefinitionName,
- final TypeDefinition typeDefinition) {
- super(edm, typeDefinitionName.getName());
- this.typeDefinitionName = typeDefinitionName;
- }
-
- @Override
- public boolean isCompatible(final EdmPrimitiveType primitiveType) {
- return false;
- }
-
- @Override
- public Class<?> getDefaultType() {
- return null;
- }
-
- @Override
- public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale,
- final Boolean isUnicode) {
- 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 {
- return null;
- }
-
- @Override
- public String valueToString(final Object value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale,
- final Boolean isUnicode) throws EdmPrimitiveTypeException {
- return null;
- }
-
- @Override
- public String toUriLiteral(final String literal) {
- return null;
- }
-
- @Override
- public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
- return null;
- }
-
- @Override
- public String getNamespace() {
- return typeDefinitionName.getNamespace();
- }
-
- @Override
- public EdmTypeKind getKind() {
- return null;
- }
-
- @Override
- public EdmPrimitiveType getUnderlyingType() {
- return null;
- }
-
- @Override
- public Integer getMaxLength() {
- return null;
- }
-
- @Override
- public Integer getPrecision() {
- return null;
- }
-
- @Override
- public Integer getScale() {
- return null;
- }
-
- @Override
- public Boolean isUnicode() {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java
deleted file mode 100644
index d82f711..0000000
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.helper.FullQualifiedName;
-
-public abstract class EdmTypeImpl extends EdmNamedImpl implements EdmType {
-
- private final EdmTypeKind kind;
- private final String namespace;
-
- public EdmTypeImpl(final EdmProviderImpl edm, final FullQualifiedName name, final EdmTypeKind kind) {
- super(edm, name.getName());
- namespace = name.getNamespace();
- this.kind = kind;
- }
-
- @Override
- public String getNamespace() {
- return namespace;
- }
-
- @Override
- public EdmTypeKind getKind() {
- return kind;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/ODataCommonsCoreImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/ODataCommonsCoreImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/ODataCommonsCoreImpl.java
new file mode 100644
index 0000000..62171af
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/ODataCommonsCoreImpl.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+
+public class ODataCommonsCoreImpl {
+
+ public Edm createEdm(final EdmProvider provider) {
+ return new EdmProviderImpl(provider);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/ActionMapKey.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/ActionMapKey.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/ActionMapKey.java
new file mode 100644
index 0000000..713803a
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/ActionMapKey.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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;
+
+import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
+
+public class ActionMapKey {
+ private final FullQualifiedName actionName;
+ private final FullQualifiedName bindingParameterTypeName;
+ private final Boolean isBindingParameterCollection;
+
+ public ActionMapKey(final FullQualifiedName actionName, final FullQualifiedName bindingParameterTypeName,
+ final Boolean isBindingParameterCollection) {
+ this.actionName = actionName;
+ this.bindingParameterTypeName = bindingParameterTypeName;
+ this.isBindingParameterCollection = isBindingParameterCollection;
+ }
+
+ @Override
+ public int hashCode() {
+ String forHash = actionName.toString();
+
+ if (bindingParameterTypeName != null) {
+ forHash = forHash + bindingParameterTypeName.toString();
+ } else {
+ forHash = forHash + "TypeNull";
+ }
+
+ if (isBindingParameterCollection != null) {
+ forHash = forHash + isBindingParameterCollection.toString();
+ } else {
+ forHash = forHash + "CollectionNull";
+ }
+
+ return forHash.hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if ((obj == null) || !(obj instanceof ActionMapKey)) {
+ return false;
+ }
+ final ActionMapKey other = (ActionMapKey) obj;
+
+ if (actionName.equals(other.actionName)) {
+ if ((bindingParameterTypeName == null && other.bindingParameterTypeName == null)
+ || (bindingParameterTypeName != null && bindingParameterTypeName.equals(other.bindingParameterTypeName))) {
+ if ((isBindingParameterCollection == null && other.isBindingParameterCollection == null)
+ || (isBindingParameterCollection != null && isBindingParameterCollection
+ .equals(other.isBindingParameterCollection))) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmImpl.java
new file mode 100644
index 0000000..9f919a5
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmImpl.java
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+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.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.helper.FullQualifiedName;
+
+public abstract class EdmImpl implements Edm {
+
+ private final Map<FullQualifiedName, EdmEntityContainer> entityContainers =
+ new HashMap<FullQualifiedName, EdmEntityContainer>();
+ private final Map<FullQualifiedName, EdmEnumType> enumTypes = new HashMap<FullQualifiedName, EdmEnumType>();
+ private final Map<FullQualifiedName, EdmTypeDefinition> typeDefinitions =
+ new HashMap<FullQualifiedName, EdmTypeDefinition>();
+ private final Map<FullQualifiedName, EdmEntityType> entityTypes = new HashMap<FullQualifiedName, EdmEntityType>();
+ private final Map<FullQualifiedName, EdmComplexType> complexTypes = new HashMap<FullQualifiedName, EdmComplexType>();
+ private final Map<ActionMapKey, EdmAction> actions = new HashMap<ActionMapKey, EdmAction>();
+ private final Map<FunctionMapKey, EdmFunction> functions = new HashMap<FunctionMapKey, EdmFunction>();
+ private EdmServiceMetadata serviceMetadata;
+ private Map<String, String> aliasToNamespaceInfo;
+
+ @Override
+ public EdmEntityContainer getEntityContainer(final FullQualifiedName namespaceOrAliasFQN) {
+ FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+ EdmEntityContainer container = entityContainers.get(fqn);
+ if (container == null) {
+ container = createEntityContainer(fqn);
+ if (container != null) {
+ entityContainers.put(fqn, container);
+ if (fqn == null) {
+ entityContainers.put(new FullQualifiedName(container.getNamespace(), container.getName()), container);
+ }
+ }
+ }
+ return container;
+ }
+
+ @Override
+ public EdmEnumType getEnumType(final FullQualifiedName namespaceOrAliasFQN) {
+ FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+ EdmEnumType enumType = enumTypes.get(fqn);
+ if (enumType == null) {
+ enumType = createEnumType(fqn);
+ if (enumType != null) {
+ enumTypes.put(fqn, enumType);
+ }
+ }
+ return enumType;
+ }
+
+ @Override
+ public EdmTypeDefinition getTypeDefinition(final FullQualifiedName namespaceOrAliasFQN) {
+ FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+ EdmTypeDefinition typeDefinition = typeDefinitions.get(fqn);
+ if (typeDefinition == null) {
+ typeDefinition = createTypeDefinition(fqn);
+ if (typeDefinition != null) {
+ typeDefinitions.put(fqn, typeDefinition);
+ }
+ }
+ return typeDefinition;
+ }
+
+ @Override
+ public EdmEntityType getEntityType(final FullQualifiedName namespaceOrAliasFQN) {
+ FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+ EdmEntityType entityType = entityTypes.get(fqn);
+ if (entityType == null) {
+ entityType = createEntityType(fqn);
+ if (entityType != null) {
+ entityTypes.put(fqn, entityType);
+ }
+ }
+ return entityType;
+ }
+
+ @Override
+ public EdmComplexType getComplexType(final FullQualifiedName namespaceOrAliasFQN) {
+ FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
+ EdmComplexType complexType = complexTypes.get(fqn);
+ if (complexType == null) {
+ complexType = createComplexType(fqn);
+ if (complexType != null) {
+ complexTypes.put(fqn, complexType);
+ }
+ }
+ return complexType;
+ }
+
+ @Override
+ public EdmAction getAction(final FullQualifiedName actionName, final FullQualifiedName bindingParameterTypeName,
+ final Boolean isBindingParameterCollection) {
+ FullQualifiedName actionFqn = resolvePossibleAlias(actionName);
+ FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
+ ActionMapKey key = new ActionMapKey(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
+ EdmAction action = actions.get(key);
+ if (action == null) {
+ action = createAction(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
+ if (action != null) {
+ actions.put(key, action);
+ }
+ }
+ return action;
+ }
+
+ @Override
+ public EdmFunction getFunction(final FullQualifiedName functionName,
+ final FullQualifiedName bindingParameterTypeName,
+ final Boolean isBindingParameterCollection, final List<String> parameterNames) {
+ FullQualifiedName functionFqn = resolvePossibleAlias(functionName);
+ FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
+ FunctionMapKey key =
+ new FunctionMapKey(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection, parameterNames);
+ EdmFunction function = functions.get(key);
+ if (function == null) {
+ function = createFunction(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection,
+ parameterNames);
+ if (function != null) {
+ functions.put(key, function);
+ }
+ }
+ return function;
+ }
+
+ @Override
+ public EdmServiceMetadata getServiceMetadata() {
+ if (serviceMetadata == null) {
+ serviceMetadata = createServiceMetadata();
+ }
+ return serviceMetadata;
+ }
+
+ private FullQualifiedName resolvePossibleAlias(final FullQualifiedName namespaceOrAliasFQN) {
+ if (aliasToNamespaceInfo == null) {
+ aliasToNamespaceInfo = createAliasToNamespaceInfo();
+ }
+ FullQualifiedName finalFQN = null;
+ if (namespaceOrAliasFQN != null) {
+ String namespace = aliasToNamespaceInfo.get(namespaceOrAliasFQN.getNamespace());
+ // If not contained in info it must be a namespace
+ if (namespace == null) {
+ finalFQN = namespaceOrAliasFQN;
+ } else {
+ finalFQN = new FullQualifiedName(namespace, namespaceOrAliasFQN.getName());
+ }
+ }
+ return finalFQN;
+ }
+
+ protected abstract Map<String, String> createAliasToNamespaceInfo();
+
+ protected abstract EdmEntityContainer createEntityContainer(FullQualifiedName containerName);
+
+ protected abstract EdmEnumType createEnumType(FullQualifiedName enumName);
+
+ protected abstract EdmTypeDefinition createTypeDefinition(FullQualifiedName typeDefinitionName);
+
+ protected abstract EdmEntityType createEntityType(FullQualifiedName entityTypeName);
+
+ protected abstract EdmComplexType createComplexType(FullQualifiedName complexTypeName);
+
+ protected abstract EdmAction createAction(FullQualifiedName actionName, FullQualifiedName bindingParameterTypeName,
+ Boolean isBindingParameterCollection);
+
+ protected abstract EdmFunction createFunction(FullQualifiedName functionName,
+ FullQualifiedName bindingParameterTypeName, Boolean isBindingParameterCollection,
+ List<String> parameterNames);
+
+ protected abstract EdmServiceMetadata createServiceMetadata();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/FunctionMapKey.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/FunctionMapKey.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/FunctionMapKey.java
new file mode 100644
index 0000000..f0b55fd
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/FunctionMapKey.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
+
+public class FunctionMapKey {
+
+ private final FullQualifiedName functionName;
+ private final FullQualifiedName bindingParameterTypeName;
+ private final Boolean isBindingParameterCollection;
+ private final List<String> parameterNames;
+
+ public FunctionMapKey(final FullQualifiedName functionName, final FullQualifiedName bindingParameterTypeName,
+ final Boolean isBindingParameterCollection, final List<String> parameterNames) {
+ this.functionName = functionName;
+ this.bindingParameterTypeName = bindingParameterTypeName;
+ this.isBindingParameterCollection = isBindingParameterCollection;
+ if (parameterNames != null) {
+ this.parameterNames = new ArrayList<String>();
+ this.parameterNames.addAll(parameterNames);
+ Collections.sort(this.parameterNames);
+ } else {
+ this.parameterNames = null;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ String hash = functionName.toString();
+
+ if (bindingParameterTypeName != null) {
+ hash = hash + bindingParameterTypeName.toString();
+ } else {
+ hash = hash + "typeNull";
+ }
+
+ if (isBindingParameterCollection != null) {
+ hash = hash + isBindingParameterCollection.toString();
+ } else {
+ hash = hash + "collectionNull";
+ }
+
+ if (parameterNames != null) {
+ for (String name : parameterNames) {
+ hash = hash + name;
+ }
+ } else {
+ hash = hash + "parameterNamesNull";
+ }
+
+ return hash.hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if ((obj == null) || !(obj instanceof FunctionMapKey)) {
+ return false;
+ }
+ final FunctionMapKey other = (FunctionMapKey) obj;
+
+ if (functionName.equals(other.functionName)) {
+ if ((bindingParameterTypeName == null && other.bindingParameterTypeName == null)
+ || (bindingParameterTypeName != null && bindingParameterTypeName.equals(other.bindingParameterTypeName))) {
+ if ((isBindingParameterCollection == null && other.isBindingParameterCollection == null)
+ || (isBindingParameterCollection != null && isBindingParameterCollection
+ .equals(other.isBindingParameterCollection))) {
+ if (parameterNames == null && other.parameterNames == null) {
+ return true;
+ } else if (parameterNames != null && other.parameterNames != null
+ && parameterNames.size() == other.parameterNames.size()) {
+ for (String name : parameterNames) {
+ if (!other.parameterNames.contains(name)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+}