You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/03/10 10:02:32 UTC
[16/51] [abbrv] [partial] [OLINGO-192] rename java packages
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmServiceMetadata.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmServiceMetadata.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmServiceMetadata.java
deleted file mode 100644
index be6f2c4..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmServiceMetadata.java
+++ /dev/null
@@ -1,59 +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.api.edm;
-
-import java.io.InputStream;
-import java.util.List;
-
-/**
- * This interface gives access to the metadata of a service, the calculated Data Service Version and an info list of all
- * entity sets, singletons, and function imports inside this EntityDataModel.
- */
-public interface EdmServiceMetadata {
-
- /**
- * @return {@link InputStream} containing the metadata document
- */
- InputStream getMetadata();
-
- /**
- * @return <b>String</b> data service version of this service
- */
- String getDataServiceVersion();
-
- /**
- * @return a list of {@link EdmEntitySetInfo} objects inside the data model
- */
- List<EdmEntitySetInfo> getEntitySetInfos();
-
- /**
- * @return a list of {@link EdmSingletonInfo} objects inside the data model
- */
- List<EdmSingletonInfo> getSingletonInfos();
-
- /**
- * @return a list of {@link EdmActionImportInfo} objects inside the data model
- */
- List<EdmActionImportInfo> getActionImportInfos();
-
- /**
- * @return a list of {@link EdmFunctionImportInfo} objects inside the data model
- */
- List<EdmFunctionImportInfo> getFunctionImportInfos();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmSingleton.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmSingleton.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmSingleton.java
deleted file mode 100644
index 1fa60ab..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmSingleton.java
+++ /dev/null
@@ -1,26 +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.api.edm;
-
-/**
- * An {@link EdmSingleton} represents a single entity inside the entity model.
- */
-public interface EdmSingleton extends EdmBindingTarget {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmSingletonInfo.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmSingletonInfo.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmSingletonInfo.java
deleted file mode 100644
index c709d72..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmSingletonInfo.java
+++ /dev/null
@@ -1,45 +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.api.edm;
-
-import java.net.URI;
-
-/**
- * Objects of this class contain information about one singleton inside the EntityDataModel.
- */
-public interface EdmSingletonInfo {
-
- /**
- * @return the entity container name which contains this singleton.
- */
- String getEntityContainerName();
-
- /**
- * @return the singleton name
- */
- String getSingletonName();
-
- /**
- * We use a {@link URI} object here to ensure the right encoding. If a string representation is needed the
- * toASCIIString() method can be used.
- *
- * @return the uri to this singleton e.g. "EmployeeOfTheMonth"
- */
- URI getEntitySetUri();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmStructuredType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmStructuredType.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmStructuredType.java
deleted file mode 100644
index b515957..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmStructuredType.java
+++ /dev/null
@@ -1,82 +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.api.edm;
-
-import java.util.List;
-
-/**
- * EdmStructuralType is the base for a complex type or an entity type.
- *
- * Complex types and entity types are described in the Conceptual Schema Definition of the OData protocol.
- */
-public interface EdmStructuredType extends EdmType {
-
- /**
- * Get property by name
- *
- * @param name
- * @return simple, complex or navigation property as {@link EdmTyped}
- */
- EdmElement getProperty(String name);
-
- /**
- * Get all simple and complex property names.
- *
- * @return property names as type List<String>
- */
- List<String> getPropertyNames();
-
- /**
- * Get structural property by name.
- *
- * @param name
- * @return simple or complex property as {@link EdmTyped}
- */
- EdmProperty getStructuralProperty(String name);
-
- /**
- * Get navigation property by name.
- *
- * @param name
- * @return navigation property as {@link EdmTyped}
- */
- EdmNavigationProperty getNavigationProperty(String name);
-
- /**
- * Get all navigation property names.
- *
- * @return navigation property names as type List<String>
- */
- List<String> getNavigationPropertyNames();
-
- /**
- * Base types are described in the OData protocol specification.
- *
- * @return {@link EdmStructuredType}
- */
- EdmStructuredType getBaseType();
-
- /**
- * Checks if this type is convertible to parameter {@link targetType}
- *
- * @param targetType
- * @return true if this type is compatible to the testType ( i.e. this type is a subtype of targetType )
- */
- boolean compatibleTo(EdmType targetType);
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTerm.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTerm.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTerm.java
deleted file mode 100644
index 3a84bd0..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTerm.java
+++ /dev/null
@@ -1,50 +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.api.edm;
-
-/**
- * An {@link EdmTerm} defines a term in a vocabulary.
- */
-public interface EdmTerm extends EdmNamed {
-
- /**
- * @return true if nullable or null if not specified
- */
- Boolean isNullable();
-
- /**
- * @return the maximum length as an Integer or null if not specified
- */
- Integer getMaxLength();
-
- /**
- * @return the precision as an Integer or null if not specified
- */
- Integer getPrecision();
-
- /**
- * @return the scale as an Integer or null if not specified
- */
- Integer getScale();
-
- /**
- * @return the default value as a String or null if not specified
- */
- String getDefaultValue();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmType.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmType.java
deleted file mode 100644
index bee2fa5..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmType.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.odata4.commons.api.edm;
-
-import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
-
-/**
- * EdmType holds the namespace of a given type and its type as {@link EdmTypeKind}.
- */
-public interface EdmType extends EdmNamed {
-
- /**
- * Namespace of this {@link EdmType}.
- *
- * @return namespace as String
- */
- String getNamespace();
-
- /**
- * @return {@link EdmTypeKind} of this {@link EdmType}
- */
- EdmTypeKind getKind();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTypeDefinition.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTypeDefinition.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTypeDefinition.java
deleted file mode 100644
index ce3103c..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTypeDefinition.java
+++ /dev/null
@@ -1,52 +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.api.edm;
-
-/**
- * An {@link EdmTypeDefinition} defines a specialization of one of the possible primitive types.
- * <br/>
- * For more information on primitive types refer to {@link EdmPrimitiveType}.
- */
-public interface EdmTypeDefinition extends EdmPrimitiveType {
-
- /**
- * @return {@link EdmPrimitiveType} this type definition is based upon
- */
- EdmPrimitiveType getUnderlyingType();
-
- /**
- * @return the maximum length as an Integer or null if not specified
- */
- Integer getMaxLength();
-
- /**
- * @return the precision as an Integer or null if not specified
- */
- Integer getPrecision();
-
- /**
- * @return the scale as an Integer or null if not specified
- */
- Integer getScale();
-
- /**
- * @return true if unicode or null if not specified
- */
- Boolean isUnicode();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTyped.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTyped.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTyped.java
deleted file mode 100644
index 010d231..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmTyped.java
+++ /dev/null
@@ -1,37 +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.api.edm;
-
-/**
- * EdmTyped indicates if an EDM element is of a special type and holds the multiplicity of that type.
- */
-public interface EdmTyped {
-
- /**
- * See {@link EdmType} for more information about possible types.
- *
- * @return {@link EdmType}
- */
- EdmType getType();
-
- /**
- * @return true if this typed element is a collection
- */
- boolean isCollection();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/FullQualifiedName.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/FullQualifiedName.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/FullQualifiedName.java
deleted file mode 100644
index f7f6358..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/FullQualifiedName.java
+++ /dev/null
@@ -1,84 +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.api.edm;
-
-/**
- * A full qualified name of any element in the EDM consists of a name and a namespace.
- */
-public class FullQualifiedName {
-
- private final String namespace;
-
- private final String name;
-
- private final String fqn;
-
- /**
- * @param namespace
- * @param name
- */
- public FullQualifiedName(final String namespace, final String name) {
- this.namespace = namespace;
- this.name = name;
- fqn = namespace + "." + name;
- }
-
- /**
- * @return namespace
- */
- public String getNamespace() {
- return namespace;
- }
-
- /**
- * @return name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @return namespace.name
- */
- public String getFullQualifiedNameAsString() {
- return fqn;
- }
-
- @Override
- public int hashCode() {
- return toString().hashCode();
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if ((obj == null) || !(obj instanceof FullQualifiedName)) {
- return false;
- }
- final FullQualifiedName other = (FullQualifiedName) obj;
- return namespace.equals(other.getNamespace()) && name.equals(other.getName());
- }
-
- @Override
- public String toString() {
- return fqn;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/Target.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/Target.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/Target.java
deleted file mode 100644
index 5acadc4..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/Target.java
+++ /dev/null
@@ -1,71 +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.api.edm;
-
-public class Target {
-
- private String targetName;
-
- private FullQualifiedName entityContainer;
-
- public static class Builder {
-
- private final Target instance;
-
- public Builder(final String target, final EdmEntityContainer defaultContainer) {
- final String[] bindingTargetParts = target.split("/");
-
- instance = new Target();
- if (bindingTargetParts.length == 1) {
- instance.
- setEntityContainer(new FullQualifiedName(defaultContainer.getNamespace(), defaultContainer.getName())).
- setTargetName(bindingTargetParts[0]);
- } else {
- final int idx = bindingTargetParts[0].lastIndexOf('.');
- instance.
- setEntityContainer(new FullQualifiedName(
- bindingTargetParts[0].substring(0, idx), bindingTargetParts[0].substring(idx))).
- setTargetName(bindingTargetParts[1]);
- }
- }
-
- public Target build() {
- return instance;
- }
- }
-
- public String getTargetName() {
- return targetName;
- }
-
- public Target setTargetName(final String targetPathName) {
- targetName = targetPathName;
- return this;
- }
-
- public FullQualifiedName getEntityContainer() {
- return entityContainer;
- }
-
- public Target setEntityContainer(final FullQualifiedName entityContainer) {
- this.entityContainer = entityContainer;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ConcurrencyMode.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ConcurrencyMode.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ConcurrencyMode.java
deleted file mode 100644
index 335ae8d..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ConcurrencyMode.java
+++ /dev/null
@@ -1,26 +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.api.edm.constants;
-
-public enum ConcurrencyMode {
-
- None,
- Fixed
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmContentKind.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmContentKind.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmContentKind.java
deleted file mode 100644
index 9ec3c7a..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmContentKind.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.api.edm.constants;
-
-/**
- * Specifies the content type of the value of the property being mapped via a customizable feed mapping.
- */
-public enum EdmContentKind {
-
- text,
- html,
- xhtml;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmOnDelete.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmOnDelete.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmOnDelete.java
deleted file mode 100644
index 0ee60c6..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmOnDelete.java
+++ /dev/null
@@ -1,25 +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.api.edm.constants;
-
-public enum EdmOnDelete {
-
- Cascade, None, SetNull, SetDefault;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmTargetPath.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmTargetPath.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmTargetPath.java
deleted file mode 100644
index 4028f84..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmTargetPath.java
+++ /dev/null
@@ -1,50 +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.api.edm.constants;
-
-/**
- * EdmTargetPath specifies the possible default targets for an EDM property which is mapped to an atom element.
- */
-public class EdmTargetPath {
-
- public static final String SYNDICATION_AUTHORNAME = "SyndicationAuthorName";
-
- public static final String SYNDICATION_AUTHOREMAIL = "SyndicationAuthorEmail";
-
- public static final String SYNDICATION_AUTHORURI = "SyndicationAuthorUri";
-
- public static final String SYNDICATION_PUBLISHED = "SyndicationPublished";
-
- public static final String SYNDICATION_RIGHTS = "SyndicationRights";
-
- public static final String SYNDICATION_TITLE = "SyndicationTitle";
-
- public static final String SYNDICATION_UPDATED = "SyndicationUpdated";
-
- public static final String SYNDICATION_CONTRIBUTORNAME = "SyndicationContributorName";
-
- public static final String SYNDICATION_CONTRIBUTOREMAIL = "SyndicationContributorEmail";
-
- public static final String SYNDICATION_CONTRIBUTORURI = "SyndicationContributorUri";
-
- public static final String SYNDICATION_SOURCE = "SyndicationSource";
-
- public static final String SYNDICATION_SUMMARY = "SyndicationSummary";
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmTypeKind.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmTypeKind.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmTypeKind.java
deleted file mode 100644
index 6134851..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/EdmTypeKind.java
+++ /dev/null
@@ -1,28 +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.api.edm.constants;
-
-/**
- * EdmTypeKind specifies the type of an EDM element.
- */
-public enum EdmTypeKind {
-
- UNDEFINED, PRIMITIVE, ENUM, DEFINITION, COMPLEX, ENTITY, NAVIGATION, ACTION, FUNCTION, SYSTEM;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ODataServiceVersion.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ODataServiceVersion.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ODataServiceVersion.java
deleted file mode 100644
index 4f35ebd..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/ODataServiceVersion.java
+++ /dev/null
@@ -1,140 +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.api.edm.constants;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * This class is a container for the supported ODataServiceVersions.
- */
-public enum ODataServiceVersion {
-
- V10("1.0"),
- V20("2.0"),
- V30("3.0"),
- V40("4.0");
-
- private static final Pattern DATASERVICEVERSIONPATTERN = Pattern.compile("(\\p{Digit}+\\.\\p{Digit}+)(:?;.*)?");
-
- public static final String NS_DATASERVICES = "dataservices";
-
- public static final String NS_METADATA = "metadata";
-
- public static final String NS_DATA = "data";
-
- public static final String NS_SCHEME = "scheme";
-
- public static final String NAVIGATION_LINK_REL = "navigationLinkRel";
-
- public static final String ASSOCIATION_LINK_REL = "associationLinkRel";
-
- public static final String MEDIA_EDIT_LINK_REL = "mediaEditLinkRel";
-
- private static final Map<String, String> V30_NAMESPACES = Collections.unmodifiableMap(new HashMap<String, String>() {
-
- private static final long serialVersionUID = 3109256773218160485L;
-
- {
- put(NS_DATASERVICES, "http://schemas.microsoft.com/ado/2007/08/dataservices");
- put(NS_METADATA, "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");
- put(NS_SCHEME, "http://schemas.microsoft.com/ado/2007/08/dataservices/scheme");
- put(NAVIGATION_LINK_REL, "http://schemas.microsoft.com/ado/2007/08/dataservices/related/");
- put(ASSOCIATION_LINK_REL, "http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/");
- put(MEDIA_EDIT_LINK_REL, "http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/");
- }
- });
-
- private static final Map<String, String> V40_NAMESPACES = Collections.unmodifiableMap(new HashMap<String, String>() {
-
- private static final long serialVersionUID = 3109256773218160485L;
-
- {
- put(NS_METADATA, "http://docs.oasis-open.org/odata/ns/metadata");
- put(NS_DATA, "http://docs.oasis-open.org/odata/ns/data");
- }
- });
-
- /**
- * Validates format and range of a data service version string.
- *
- * @param version version string
- * @return <code>true</code> for a valid version
- */
- public static boolean validateDataServiceVersion(final String version) {
- final Matcher matcher = DATASERVICEVERSIONPATTERN.matcher(version);
- if (matcher.matches()) {
- final String possibleDataServiceVersion = matcher.group(1);
- return V10.toString().equals(possibleDataServiceVersion)
- || V20.toString().equals(possibleDataServiceVersion)
- || V30.toString().equals(possibleDataServiceVersion)
- || V40.toString().equals(possibleDataServiceVersion);
- } else {
- throw new IllegalArgumentException(version);
- }
- }
-
- /**
- * actual > comparedTo
- *
- * @param actual
- * @param comparedTo
- * @return <code>true</code> if actual is bigger than comparedTo
- */
- public static boolean isBiggerThan(final String actual, final String comparedTo) {
- if (!validateDataServiceVersion(comparedTo) || !validateDataServiceVersion(actual)) {
- throw new IllegalArgumentException("Illegal arguments: " + comparedTo + " and " + actual);
- }
-
- final double me = Double.parseDouble(extractDataServiceVersionString(actual));
- final double other = Double.parseDouble(extractDataServiceVersionString(comparedTo));
-
- return me > other;
- }
-
- private static String extractDataServiceVersionString(final String rawDataServiceVersion) {
- if (rawDataServiceVersion != null) {
- final String[] pattern = rawDataServiceVersion.split(";");
- return pattern[0];
- }
-
- return null;
- }
- private final String version;
-
- private ODataServiceVersion(final String version) {
- this.version = version;
- }
-
- public Map<String, String> getNamespaceMap() {
- return this == V10 || this == V20
- ? Collections.<String, String>emptyMap()
- : this == V30
- ? V30_NAMESPACES
- : V40_NAMESPACES;
- }
-
- @Override
- public String toString() {
- return version;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/StoreGeneratedPattern.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/StoreGeneratedPattern.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/StoreGeneratedPattern.java
deleted file mode 100644
index 3dad36b..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/constants/StoreGeneratedPattern.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.commons.api.edm.constants;
-
-public enum StoreGeneratedPattern {
-
- None,
- Identity,
- Computed
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/package-info.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/package-info.java b/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/package-info.java
deleted file mode 100644
index 3f32294..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/package-info.java
+++ /dev/null
@@ -1,19 +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.api.edm;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java
new file mode 100644
index 0000000..bb7dd98
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+public abstract class AbstractEdmBindingTarget extends EdmNamedImpl implements EdmBindingTarget {
+
+ protected final EdmEntityContainer container;
+
+ private final FullQualifiedName type;
+
+ public AbstractEdmBindingTarget(final Edm edm, final EdmEntityContainer container,
+ final String name, final FullQualifiedName type) {
+
+ super(edm, name);
+ this.container = container;
+ this.type = type;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer() {
+ return container;
+ }
+
+ @Override
+ public EdmEntityType getEntityType() {
+ final EdmEntityType entityType = edm.getEntityType(this.type);
+ if (entityType == null) {
+ throw new EdmException("Can´t find entity type: " + type + " for entity set or singleton: " + getName());
+ }
+ return entityType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java
new file mode 100644
index 0000000..346eb2e
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+
+public abstract class AbstractEdmComplexType extends AbstractEdmStructuredType implements EdmComplexType {
+
+ public AbstractEdmComplexType(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName) {
+ super(edm, fqn, EdmTypeKind.COMPLEX, baseTypeName);
+ }
+
+ @Override
+ protected EdmStructuredType buildBaseType(final FullQualifiedName baseTypeName) {
+ EdmComplexType baseType = null;
+ if (baseTypeName != null) {
+ baseType = edm.getComplexType(baseTypeName);
+ if (baseType == null) {
+ throw new EdmException("Can't find base type with name: " + baseTypeName + " for complex type: " + getName());
+ }
+ }
+ return baseType;
+ }
+
+ @Override
+ public EdmComplexType getBaseType() {
+ return (EdmComplexType) baseType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
new file mode 100644
index 0000000..5d108cb
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
@@ -0,0 +1,102 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmActionImport;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.EdmSingleton;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements EdmEntityContainer {
+
+ protected final FullQualifiedName entityContainerName;
+
+ private final Map<String, EdmSingleton> singletons = new HashMap<String, EdmSingleton>();
+
+ private final Map<String, EdmEntitySet> entitySets = new HashMap<String, EdmEntitySet>();
+
+ private final Map<String, EdmActionImport> actionImports = new HashMap<String, EdmActionImport>();
+
+ private final Map<String, EdmFunctionImport> functionImports = new HashMap<String, EdmFunctionImport>();
+
+ public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName) {
+ super(edm, entityContainerName.getName());
+ this.entityContainerName = entityContainerName;
+ }
+
+ @Override
+ public String getNamespace() {
+ return entityContainerName.getNamespace();
+ }
+
+ protected abstract EdmSingleton createSingleton(String singletonName);
+
+ @Override
+ public EdmSingleton getSingleton(final String singletonName) {
+ EdmSingleton singleton = singletons.get(singletonName);
+ if (singleton == null) {
+ singleton = createSingleton(singletonName);
+ singletons.put(singletonName, singleton);
+ }
+ return singleton;
+ }
+
+ protected abstract EdmEntitySet createEntitySet(String entitySetName);
+
+ @Override
+ public EdmEntitySet getEntitySet(final String entitySetName) {
+ EdmEntitySet entitySet = entitySets.get(entitySetName);
+ if (entitySet == null) {
+ entitySet = createEntitySet(entitySetName);
+ entitySets.put(entitySetName, entitySet);
+ }
+ return entitySet;
+ }
+
+ protected abstract EdmActionImport createActionImport(String actionImportName);
+
+ @Override
+ public EdmActionImport getActionImport(final String actionImportName) {
+ EdmActionImport actionImport = actionImports.get(actionImportName);
+ if (actionImport == null) {
+ actionImport = createActionImport(actionImportName);
+ actionImports.put(actionImportName, actionImport);
+ }
+ return actionImport;
+ }
+
+ protected abstract EdmFunctionImport createFunctionImport(String functionImportName);
+
+ @Override
+ public EdmFunctionImport getFunctionImport(final String functionImportName) {
+ EdmFunctionImport functionImport = functionImports.get(functionImportName);
+ if (functionImport == null) {
+ functionImport = createFunctionImport(functionImportName);
+ functionImports.put(functionImportName, functionImport);
+ }
+ return functionImport;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java
new file mode 100644
index 0000000..eb9d170
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java
@@ -0,0 +1,114 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.edm.Edm;
+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.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+
+public abstract class AbstractEdmEntityType extends AbstractEdmStructuredType implements EdmEntityType {
+
+ private final boolean hasStream;
+
+ protected EdmEntityType entityBaseType;
+
+ private final List<String> keyPredicateNames = new ArrayList<String>();
+
+ private final Map<String, EdmKeyPropertyRef> keyPropertyRefs = new LinkedHashMap<String, EdmKeyPropertyRef>();
+
+ private List<EdmKeyPropertyRef> keyPropertyRefsList;
+
+ protected AbstractEdmEntityType(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
+ final boolean hashStream) {
+
+ super(edm, fqn, EdmTypeKind.ENTITY, baseTypeName);
+ this.hasStream = hashStream;
+ }
+
+ protected void setEdmKeyPropertyRef(final List<EdmKeyPropertyRef> edmKey) {
+ for (EdmKeyPropertyRef ref : edmKey) {
+ if (ref.getAlias() == null) {
+ keyPredicateNames.add(ref.getKeyPropertyName());
+ keyPropertyRefs.put(ref.getKeyPropertyName(), ref);
+ } else {
+ keyPredicateNames.add(ref.getAlias());
+ keyPropertyRefs.put(ref.getAlias(), ref);
+ }
+ }
+ }
+
+ @Override
+ protected EdmStructuredType 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;
+ }
+
+ @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) {
+ final EdmKeyPropertyRef edmKeyPropertyRef = keyPropertyRefs.get(keyPredicateName);
+ if (edmKeyPropertyRef == null && entityBaseType != null) {
+ return entityBaseType.getKeyPropertyRef(keyPredicateName);
+ }
+ return edmKeyPropertyRef;
+ }
+
+ @Override
+ public boolean hasStream() {
+ return hasStream;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java
new file mode 100644
index 0000000..8fcf143
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java
@@ -0,0 +1,206 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.edm.Edm;
+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.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt64;
+
+public abstract class AbstractEdmEnumType extends EdmTypeImpl implements EdmEnumType {
+
+ private final boolean isFlags;
+
+ private final String uriPrefix;
+
+ private final String uriSuffix;
+
+ private List<String> memberNames;
+
+ private Map<String, EdmMember> members;
+
+ public AbstractEdmEnumType(final Edm edm, final FullQualifiedName fqn, final boolean isFlags) {
+ super(edm, fqn, EdmTypeKind.ENUM);
+
+ this.isFlags = isFlags;
+ this.uriPrefix = fqn.getFullQualifiedNameAsString() + '\'';
+ this.uriSuffix = "'";
+ }
+
+ protected abstract Collection<? extends EdmMember> getMembers();
+
+ @Override
+ public EdmMember getMember(final String name) {
+ if (members == null) {
+ members = new LinkedHashMap<String, EdmMember>();
+ for (final EdmMember member : getMembers()) {
+ members.put(member.getName(), member);
+ }
+ }
+ return members.get(name);
+ }
+
+ @Override
+ public List<String> getMemberNames() {
+ if (memberNames == null) {
+ memberNames = new ArrayList<String>();
+ for (final EdmMember member : getMembers()) {
+ memberNames.add(member.getName());
+ }
+ }
+ return memberNames;
+ }
+
+ @Override
+ public abstract EdmPrimitiveType getUnderlyingType();
+
+ @Override
+ public boolean isCompatible(final EdmPrimitiveType primitiveType) {
+ return equals(primitiveType);
+ }
+
+ @Override
+ public Class<?> getDefaultType() {
+ return getUnderlyingType().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;
+ }
+ }
+
+ private Long parseEnumValue(final String value) throws EdmPrimitiveTypeException {
+ Long result = null;
+ for (final String memberValue : value.split(",", isFlags ? -1 : 1)) {
+ Long memberValueLong = null;
+ for (final EdmMember member : 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;
+ }
+
+ @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;
+ }
+
+ 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");
+ }
+ }
+
+ protected String constructEnumValue(final long value) throws EdmPrimitiveTypeException {
+ long remaining = value;
+ StringBuilder result = new StringBuilder();
+
+ for (final EdmMember member : 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();
+ }
+
+ @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;
+ }
+ 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())");
+ }
+ }
+
+ @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)");
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java
new file mode 100644
index 0000000..9890dac
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmImpl.java
@@ -0,0 +1,252 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.edm.Edm;
+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.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+public abstract class AbstractEdmImpl 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<FullQualifiedName, EdmAction> unboundActions
+ = new HashMap<FullQualifiedName, EdmAction>();
+
+ private final Map<FunctionMapKey, EdmFunction> unboundFunctions
+ = new HashMap<FunctionMapKey, EdmFunction>();
+
+ private final Map<ActionMapKey, EdmAction> boundActions
+ = new HashMap<ActionMapKey, EdmAction>();
+
+ private final Map<FunctionMapKey, EdmFunction> boundFunctions
+ = new HashMap<FunctionMapKey, EdmFunction>();
+
+ private EdmServiceMetadata serviceMetadata;
+
+ private Map<String, String> aliasToNamespaceInfo;
+
+ @Override
+ public EdmEntityContainer getEntityContainer(final FullQualifiedName namespaceOrAliasFQN) {
+ final 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) {
+ final 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) {
+ final 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) {
+ final 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) {
+ final 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) {
+
+ EdmAction action = null;
+
+ final FullQualifiedName actionFqn = resolvePossibleAlias(actionName);
+ if (bindingParameterTypeName == null) {
+ action = unboundActions.get(actionName);
+ if (action == null) {
+ action = createUnboundAction(actionFqn);
+ if (action != null) {
+ unboundActions.put(actionName, action);
+ }
+ }
+ } else {
+ final FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
+ final ActionMapKey key = new ActionMapKey(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
+ action = boundActions.get(key);
+ if (action == null) {
+ action = createBoundAction(actionFqn, bindingParameterTypeFqn, isBindingParameterCollection);
+ if (action != null) {
+ boundActions.put(key, action);
+ }
+ }
+ }
+
+ return action;
+ }
+
+ @Override
+ public EdmFunction getFunction(final FullQualifiedName functionName,
+ final FullQualifiedName bindingParameterTypeName,
+ final Boolean isBindingParameterCollection, final List<String> parameterNames) {
+
+ EdmFunction function = null;
+
+ final FullQualifiedName functionFqn = resolvePossibleAlias(functionName);
+ if (bindingParameterTypeName == null) {
+ final FunctionMapKey key = new FunctionMapKey(
+ functionFqn, bindingParameterTypeName, isBindingParameterCollection, parameterNames);
+ function = unboundFunctions.get(key);
+ if (function == null) {
+ function = createUnboundFunction(functionFqn, parameterNames);
+ if (function != null) {
+ unboundFunctions.put(key, function);
+ }
+ }
+ } else {
+ final FullQualifiedName bindingParameterTypeFqn = resolvePossibleAlias(bindingParameterTypeName);
+ final FunctionMapKey key
+ = new FunctionMapKey(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection, parameterNames);
+ function = boundFunctions.get(key);
+ if (function == null) {
+ function = createBoundFunction(functionFqn, bindingParameterTypeFqn, isBindingParameterCollection,
+ parameterNames);
+ if (function != null) {
+ boundFunctions.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) {
+ final 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 createUnboundAction(FullQualifiedName actionName);
+
+ protected abstract EdmFunction createUnboundFunction(FullQualifiedName functionName, List<String> parameterNames);
+
+ protected abstract EdmAction createBoundAction(FullQualifiedName actionName,
+ FullQualifiedName bindingParameterTypeName,
+ Boolean isBindingParameterCollection);
+
+ protected abstract EdmFunction createBoundFunction(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/897db8ef/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmKeyPropertyRef.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmKeyPropertyRef.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmKeyPropertyRef.java
new file mode 100644
index 0000000..7e4597e
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmKeyPropertyRef.java
@@ -0,0 +1,80 @@
+/*
+ * 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;
+
+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.EdmStructuredType;
+
+public abstract class AbstractEdmKeyPropertyRef implements EdmKeyPropertyRef {
+
+ private final EdmEntityType edmEntityType;
+
+ private EdmProperty property;
+
+ public AbstractEdmKeyPropertyRef(final EdmEntityType edmEntityType) {
+ this.edmEntityType = edmEntityType;
+ }
+
+ @Override
+ public abstract String getKeyPropertyName();
+
+ @Override
+ public abstract String getAlias();
+
+ @Override
+ public abstract String getPath();
+
+ @Override
+ public EdmProperty getProperty() {
+ if (property == null) {
+ if (getAlias() == null) {
+ property = edmEntityType.getStructuralProperty(getKeyPropertyName());
+ if (property == null) {
+ throw new EdmException("Invalid key property ref specified. Can´t find property with name: "
+ + getKeyPropertyName());
+ }
+ } else {
+ if (getPath() == null || getPath().isEmpty()) {
+ throw new EdmException("Alias but no path specified for propertyRef");
+ }
+ final String[] splitPath = getPath().split("/");
+ EdmStructuredType structType = edmEntityType;
+ for (int i = 0; i < splitPath.length - 1; i++) {
+ final EdmProperty _property = structType.getStructuralProperty(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 = (EdmStructuredType) _property.getType();
+ }
+ property = structType.getStructuralProperty(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/897db8ef/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
new file mode 100644
index 0000000..dca80bd
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.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.commons.core.edm;
+
+import org.apache.olingo.commons.api.edm.Edm;
+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.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+public abstract class AbstractEdmNavigationProperty extends EdmElementImpl implements EdmNavigationProperty {
+
+ private EdmEntityType typeImpl;
+
+ private EdmNavigationProperty partnerNavigationProperty;
+
+ public AbstractEdmNavigationProperty(final Edm edm, final String name) {
+ super(edm, name);
+ }
+
+ protected abstract FullQualifiedName getTypeFQN();
+
+ @Override
+ public EdmType getType() {
+ if (typeImpl == null) {
+ typeImpl = edm.getEntityType(getTypeFQN());
+ if (typeImpl == null) {
+ throw new EdmException("Cannot find type with name: " + getTypeFQN());
+ }
+ }
+ return typeImpl;
+ }
+
+ protected abstract String internatGetPartner();
+
+ @Override
+ public EdmNavigationProperty getPartner() {
+ if (partnerNavigationProperty == null) {
+ String partner = internatGetPartner();
+ if (partner != null) {
+ EdmStructuredType type = (EdmStructuredType) getType();
+ EdmNavigationProperty property = null;
+ final String[] split = partner.split("/");
+ for (String element : split) {
+ property = type.getNavigationProperty(element);
+ if (property == null) {
+ throw new EdmException("Cannot find property with name: " + element + " at type " + type.getName());
+ }
+ type = (EdmStructuredType) property.getType();
+ }
+ partnerNavigationProperty = property;
+ }
+ }
+ return partnerNavigationProperty;
+ }
+
+ public abstract String getReferencingPropertyName(String referencedPropertyName);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java
new file mode 100644
index 0000000..b848540
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java
@@ -0,0 +1,114 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmException;
+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.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+
+public abstract class AbstractEdmOperation extends EdmTypeImpl implements EdmOperation {
+
+ private final Map<String, EdmParameter> parameters = new LinkedHashMap<String, EdmParameter>();
+
+ private String entitySetPath;
+
+ private boolean isBound;
+
+ private EdmReturnType returnType;
+
+ private List<String> parameterNames;
+
+ protected AbstractEdmOperation(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind) {
+ super(edm, fqn, kind);
+ }
+
+ protected void setParameters(final List<EdmParameter> _parameters) {
+ for (EdmParameter parameter : _parameters) {
+ parameters.put(parameter.getName(), parameter);
+ }
+ }
+
+ protected void setEntitySetPath(final String entitySetPath) {
+ this.entitySetPath = entitySetPath;
+ }
+
+ protected void setIsBound(final boolean isBound) {
+ this.isBound = isBound;
+ }
+
+ protected void setReturnType(final EdmReturnType returnType) {
+ this.returnType = returnType;
+ }
+
+ @Override
+ public EdmParameter getParameter(final String name) {
+ return parameters.get(name);
+ }
+
+ @Override
+ public List<String> getParameterNames() {
+ if (parameterNames == null) {
+ parameterNames = new ArrayList<String>(parameters.size());
+ for (String parameterName : parameters.keySet()) {
+ parameterNames.add(parameterName);
+ }
+ }
+ return parameterNames;
+ }
+
+ @Override
+ public EdmEntitySet getReturnedEntitySet(final EdmEntitySet bindingParameterEntitySet) {
+ EdmEntitySet returnedEntitySet = null;
+ if (bindingParameterEntitySet != null && entitySetPath != null) {
+ final EdmBindingTarget relatedBindingTarget = bindingParameterEntitySet.
+ getRelatedBindingTarget(entitySetPath);
+ if (relatedBindingTarget == null) {
+ throw new EdmException("Cannot find entity set with path: " + entitySetPath);
+ }
+ 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() {
+ return returnType;
+ }
+
+ @Override
+ public boolean isBound() {
+ return isBound;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/897db8ef/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java
new file mode 100644
index 0000000..96aa49f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm;
+
+import org.apache.olingo.commons.api.edm.Edm;
+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.Target;
+
+public abstract class AbstractEdmOperationImport extends EdmNamedImpl implements EdmOperationImport {
+
+ protected final EdmEntityContainer container;
+
+ private final Target entitySet;
+
+ private EdmEntitySet returnedEntitySet;
+
+ public AbstractEdmOperationImport(final Edm edm, final EdmEntityContainer container, final String name,
+ final Target entitySet) {
+
+ super(edm, name);
+ this.container = container;
+ this.entitySet = entitySet;
+ }
+
+ @Override
+ public EdmEntitySet getReturnedEntitySet() {
+ if (entitySet != null && returnedEntitySet == null) {
+ EdmEntityContainer entityContainer = edm.getEntityContainer(entitySet.getEntityContainer());
+ if (entityContainer == null) {
+ throw new EdmException("Can´t find entity container with name: " + entitySet.getEntityContainer());
+ }
+ returnedEntitySet = entityContainer.getEntitySet(entitySet.getTargetName());
+ if (returnedEntitySet == null) {
+ throw new EdmException("Can´t find entity set with name: " + entitySet.getTargetName());
+ }
+ }
+ return returnedEntitySet;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer() {
+ return container;
+ }
+}